/**
 * Animate Studio Pro - Professional Studio Theme
 * Focused on high-end 2D art and animation workflow.
 */

:root {
  --studio-bg: #0b0f19;
  --studio-panel: #161b26;
  --studio-border: rgba(255, 255, 255, 0.08);
  --studio-accent: #0ea5e9;
  --studio-text: #e2e8f0;
  --studio-muted: #64748b;
  --studio-hover: rgba(14, 165, 233, 0.15);
  --font-studio: 'Inter', sans-serif;
  --header-height: 60px;
  --sidebar-width: 60px;
  --inspector-width: 280px;
  --timeline-height: 180px;
}

body.studio-layout {
  margin: 0;
  padding: 0;
  background-color: var(--studio-bg);
  color: var(--studio-text);
  font-family: var(--font-studio);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Supress Global Nav for Studio */
body.studio-layout nav {
  display: none !important;
}

/* Hide global mesh-bg if it's too distracting for art */
.studio-layout .mesh-bg {
  opacity: 0.1;
}

/* Navbar override for Studio */
#studio-nav {
  height: var(--header-height);
  border-bottom: 1px solid var(--studio-border);
  background: var(--studio-panel);
}

.studio-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ---------------------- */
/* LEFT SIDEBAR (TOOLS)   */
/* ---------------------- */
.sidebar-tools {
  width: var(--sidebar-width);
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 0;
  gap: 10px;
}

.tool-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--studio-muted);
  transition: all 0.2s ease;
  font-size: 18px;
}

.tool-btn:hover {
  background: var(--studio-hover);
  color: var(--studio-accent);
}

.tool-btn.active {
  background: var(--studio-accent);
  color: #fff;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.divider {
  width: 60%;
  height: 1px;
  background: var(--studio-border);
  margin: 10px 0;
}

.color-preview {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid #fff;
  cursor: pointer;
  background: #000;
}

#colorPicker {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

/* ---------------------- */
/* MAIN WORKSPACE         */
/* ---------------------- */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000; /* Contrast for canvas */
}

.top-bar {
  height: 60px;
  background: var(--studio-panel);
  border-bottom: 1px solid var(--studio-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mini-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: transform 0.3s;
}

.mini-logo:hover {
  transform: scale(1.1);
}

.project-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-info h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.frame-nav-top {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--studio-border);
  margin-left: 15px;
}

.nav-btn-top {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--studio-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-btn-top:hover {
  background: rgba(255,255,255,0.05);
  color: var(--studio-accent);
}

.btn-add-frame {
  background: var(--studio-accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
  transition: all 0.3s;
}

.btn-add-frame:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.5);
}

.badge {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.quick-settings {
  display: flex;
  align-items: center;
  gap: 30px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-item label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--studio-muted);
  text-transform: uppercase;
}

.setting-item input[type="range"] {
  width: 120px;
  accent-color: var(--studio-accent);
}

.setting-item input[type="number"] {
  background: var(--studio-bg);
  border: 1px solid var(--studio-border);
  color: #fff;
  padding: 5px;
  border-radius: 4px;
  width: 50px;
}

.export-actions {
  display: flex;
  gap: 12px;
}

.btn-play {
  background: var(--studio-accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-export {
  background: rgba(255,255,255,0.05);
  color: #fff;
  border: 1px solid var(--studio-border);
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* Canvas Display */
.canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 50px;
  background-image: 
    linear-gradient(45deg, #111 25%, transparent 25%),
    linear-gradient(-45deg, #111 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #111 75%),
    linear-gradient(-45deg, transparent 75%, #111 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px 20px, 20px 0;
  background-color: #0d0d0d;
}

.canvas-holder {
  background: #fff;
  box-shadow: 0 0 100px rgba(0,0,0,0.8);
  border-radius: 4px;
  position: relative;
}

canvas {
  display: block;
}

/* ---------------------- */
/* TIMELINE PANEL         */
/* ---------------------- */
.timeline-panel {
  height: var(--timeline-height);
  background: var(--studio-panel);
  border-top: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
}

.timeline-header {
  padding: 10px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--studio-border);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.timeline-controls span {
  font-weight: 700;
  font-size: 0.9rem;
}

.timeline-track {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 25px;
  display: flex;
  gap: 15px;
  background: rgba(0,0,0,0.3);
  align-items: center;
}

.frame-thumb {
  min-width: 110px;
  height: 80px;
  background: var(--studio-bg);
  border: 1px solid var(--studio-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}

.frame-thumb:hover {
  border-color: var(--studio-accent);
  background: var(--studio-hover);
}

.frame-thumb.active {
  border-color: var(--studio-accent);
  background: rgba(14, 165, 233, 0.1);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
}

.frame-thumb canvas {
  width: 90px;
  height: 50px;
  border-radius: 4px;
  background: #fff;
  pointer-events: none;
}

.frame-thumb span {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--studio-muted);
  margin-top: 5px;
}

.frame-thumb.active span {
  color: var(--studio-accent);
}

/* ---------------------- */
/* RIGHT INSPECTOR        */
/* ---------------------- */
.sidebar-inspector {
  width: var(--inspector-width);
  background: var(--studio-panel);
  border-left: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.inspector-section {
  padding: 20px;
  border-bottom: 1px solid var(--studio-border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h3 {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--studio-muted);
  letter-spacing: 1px;
  margin: 0;
}

.layers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--studio-border);
  cursor: pointer;
  transition: all 0.2s;
}

.layer:hover { background: var(--studio-hover); }
.layer.selected { border-color: var(--studio-accent); background: rgba(14, 165, 233, 0.08); }

.layer .thumb {
  width: 50px; height: 35px;
  background: #000;
  border-radius: 4px;
}

.layer .meta { flex: 1; font-size: 0.8rem; font-weight: 600; }

.swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.swatch {
  width: 24px; height: 24px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
}

.swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
  z-index: 10;
}

.frames-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.frame-item-v {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--studio-border);
  cursor: pointer;
  transition: all 0.2s;
}

.frame-item-v:hover { background: var(--studio-hover); }
.frame-item-v.selected { border-color: var(--studio-accent); background: rgba(14, 165, 233, 0.08); }

.frame-item-v .thumb {
  width: 40px; height: 30px;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

.frame-item-v .thumb canvas { width: 100%; height: 100%; }
.frame-item-v .meta { flex: 1; font-size: 0.75rem; font-weight: 700; color: var(--studio-muted); }
.frame-item-v.selected .meta { color: var(--studio-accent); }

.item-ctrls {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s;
}

.frame-item-v:hover .item-ctrls {
  opacity: 1;
}

.item-ctrls button {
  background: transparent;
  border: none;
  color: var(--studio-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.item-ctrls button:hover {
  background: var(--studio-accent);
  color: #fff;
}

.bg-controls {
  display: flex;
  gap: 10px;
}

.btn-outline {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--studio-border);
  background: transparent;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-outline:hover { background: rgba(255,255,255,0.05); }

.preview-box canvas {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
}

.status-bar {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--studio-accent);
  text-transform: uppercase;
}

/* ---------------------- */
/* Mobile Responsiveness  */
/* ---------------------- */

/* ---------------------- */
/* Device Restriction     */
/* ---------------------- */

.mobile-warning {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #0f172a;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.warning-content i {
  font-size: 4rem;
  color: var(--studio-accent);
  margin-bottom: 20px;
  display: block;
}

.warning-content h2 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 15px;
}

.warning-content p {
  color: #94a3b8;
  max-width: 350px;
  margin: 0 auto 30px auto;
  line-height: 1.6;
}

/* Hide Studio for Phones (< 768px) */
@media (max-width: 767px) {
  .mobile-warning {
    display: flex;
  }
  .top-bar, .sidebar-tools, .main-workspace, .sidebar-inspector, .timeline-panel, .mesh-bg {
    display: none !important;
  }
}

/* Maintain Optimized Layout for Tablets (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .studio-layout {
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar-tools {
    width: 100%; height: auto;
    flex-direction: row; padding: 12px;
    border-right: none; border-bottom: 1px solid var(--studio-border);
    justify-content: center; gap: 20px;
    background: var(--studio-panel);
  }
  .sidebar-inspector {
    width: 100%; border-left: none; border-top: 1px solid var(--studio-border);
    padding: 20px;
  }
  #canvas {
    max-width: 100%;
    height: auto !important;
  }
}

/* ---------------------- */
/* UTILS                  */
/* ---------------------- */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--studio-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
}

.icon-btn:hover { color: var(--studio-accent); }

.btn-sm {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--studio-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-sm.ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--studio-border);
}

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background: var(--studio-panel);
  min-width: 160px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 1000;
  border-radius: 8px;
  border: 1px solid var(--studio-border);
  margin-top: 5px;
}
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a {
  color: var(--studio-text);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
}
.dropdown-content a:hover { background: var(--studio-hover); }
