/* =============================================================================
   FFMPEG STUDIO HUB - COMMAND CENTER STYLES
   ============================================================================= */

:root {
  --bg: #08080c;
  --bg-secondary: #0f0f15;
  --fg: #e8e8ed;
  --fg-muted: #7a7a8a;
  --accent: #00d4aa;
  --accent-warm: #ff6b35;
  --card: #111118;
  --border: #1e1e2a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { 
  height: 100%; 
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', sans-serif;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===================== LOADER ===================== */
#hub-loader {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#hub-loader.fade-out { opacity: 0; visibility: hidden; }
.loader-content { text-align: center; }
.loader-icon { animation: float 2s ease-in-out infinite; }
.loader-bar {
  width: 200px; height: 2px; background: var(--border); border-radius: 2px; margin-top: 2rem; overflow: hidden;
}
.loader-progress {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-warm)); width: 0%;
  animation: load 1.5s ease-out forwards;
}
@keyframes load { 0% { width: 0; } 100% { width: 100%; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ===================== APP LAYOUT ===================== */
#app {
  display: flex; flex-direction: column; 
  height: 100vh; 
  overflow: hidden; 
  opacity: 0; transition: opacity 0.5s ease 0.3s;
}
#app.visible { opacity: 1; }

/* Header - FIXED POSITION */
.hub-header {
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  
  /* Fixed position for transparency effect */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  
  /* Transparency */
  background: rgba(8, 8, 12, 0.9); 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Main Grid Layout */
.hub-main {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

/* Sidebar */
.hub-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 80px 1rem 1.5rem 1rem; 
  display: flex; flex-direction: column;
  height: calc(100vh); 
  position: sticky;
  top: 0; 
  overflow-y: auto;
  overflow-x: hidden; 
  flex-shrink: 0;
  z-index: 10; 
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; 
}

.sidebar-section { margin-bottom: 2rem; margin-top: 40px; }

.sidebar-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-muted); margin-bottom: 1rem; padding-left: 0.5rem;
  transition: opacity 0.2s;
}

/* Sidebar Link Structure */
.sidebar-link {
  width: 100%; 
  display: flex; 
  align-items: center; 
  gap: 12px;
  padding: 8px; 
  border-radius: 8px;
  background: transparent; color: var(--fg-muted);
  text-decoration: none; font-size: 0.85rem;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05); color: var(--fg);
}
.sidebar-link.active {
  background: rgba(0, 212, 170, 0.05); 
}

/* Icon Box */
.sidebar-icon-box {
  width: 40px; 
  height: 40px; 
  border-radius: 8px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.sidebar-link:hover .sidebar-icon-box {
  transform: scale(1.05);
}

/* Label Text */
.sidebar-label {
  white-space: nowrap;
  transition: opacity 0.2s, width 0.3s, margin 0.3s;
}

/* Workspace */
.hub-workspace {
  padding: 80px 2rem 2rem 2rem;
  background: var(--bg);
  position: relative;
  overflow-y: auto; 
  min-height: 0;
}

/* Particle Canvas Styles */
.particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.hub-workspace::before {
  content: ''; position: absolute; inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none; z-index: 0;
}

.workspace-section {
  position: relative; z-index: 1; margin-bottom: 3rem;
  scroll-margin-top: 100px; 
}

.section-header { margin-bottom: 1.5rem; }

/* Tool Grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Tool Card */
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.tool-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--accent); opacity: 0; transition: opacity 0.3s;
}

.tool-card:hover {
  border-color: rgba(0, 212, 170, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tool-card:hover::before { opacity: 1; }

.tool-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.tool-info { flex: 1; min-width: 0; }
.tool-info h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; }
.tool-info p { 
  font-size: 0.8rem; 
  color: var(--fg-muted); 
  white-space: normal; 
  overflow: visible; 
  line-height: 1.4;
}

.tool-arrow {
  color: var(--fg-muted); opacity: 0; transform: translateX(-10px);
  transition: all 0.3s;
  align-self: center; 
  margin-top: 0; 
}
.tool-card:hover .tool-arrow { opacity: 1; transform: translateX(0); color: var(--accent); }

/* Footer */
.hub-footer {
  height: 40px; flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 10;
}

/* Reveal Animation */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* =============================================================================
   SHARED COMPONENT FIXES (Support Section)
   ============================================================================= */

/* Card Component */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; transition: opacity 0.3s;
}

.card:hover {
  border-color: rgba(0, 212, 170, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card:hover::before { opacity: 1; }

/* Button Outline */
.btn-outline {
  border: 1px solid var(--border);
  color: var(--fg-muted); 
  font-weight: 500;
  padding: 10px 20px; 
  border-radius: 8px;
  transition: all 0.3s;
  background: transparent;
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 170, 0.05);
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button Style */
.btn-upi-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  transition: 0.3s;
  border: none;
  width: 100%; 
}

.btn-upi-app:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
}

/* Headline & Text */
.headline {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.mono-text { font-family: 'JetBrains Mono', monospace; }

/* =============================================================================
   SIDEBAR TOGGLE & COLLAPSE FUNCTIONALITY
   ============================================================================= */

/* Redesigned Toggle Button */
.sidebar-toggle-btn {
  position: absolute;
  top: 75px; 
  right: 20px; 
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg); 
  border: 1px solid var(--border);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  transform: scale(1.1);
}

.sidebar-toggle-btn svg {
  transition: transform 0.3s ease;
}

/* The Main Grid Container Transition */
.hub-main {
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed Grid State */
.hub-main.sidebar-collapsed {
  grid-template-columns: 80px 1fr;
}

/* Sidebar Collapsed State */
.hub-main.sidebar-collapsed .hub-sidebar {
  width: 80px !important; 
  padding: 80px 0 1.5rem 0; 
}

/* Hide Text Elements when Collapsed */
.hub-main.sidebar-collapsed .sidebar-title,
.hub-main.sidebar-collapsed .sidebar-info-text {
  opacity: 0;
  visibility: hidden;
}

/* Fix for Sidebar Label */
.hub-main.sidebar-collapsed .sidebar-label {
  width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* Center Icons when Collapsed */
.hub-main.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 8px; 
}

/* Adjust Toggle Button Position when Collapsed */
.hub-main.sidebar-collapsed .sidebar-toggle-btn {
  right: 26px; 
}

.hub-main.sidebar-collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* =============================================================================
   FIX: NAVIGATION ALIGNMENT FOR STUDIO LAYOUT
   Animates logo movement with sidebar collapse
   ============================================================================= */

@media (min-width: 769px) {
  /* 1. Restore Container Padding (PC) */
  .shared-nav-inner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    /* Vertical 1rem, Horizontal 2rem (matches workspace) */
    padding: 1rem 2rem !important;
  }

  /* 2. Align Logo with Workspace Content (Default/Expanded State) */
  .nav-brand {
    margin-left: 220px;
    /* SYNC: This transition matches the sidebar's duration and easing */
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* 3. Collapsed State - Applied via JS */
  /* When nav has .sidebar-collapsed, reduce the logo margin */
  .shared-nav.sidebar-collapsed .nav-brand {
    margin-left: 80px; /* Matches collapsed sidebar width */
  }

  /* 4. Hide Empty Center Links Container */
  .nav-links-wrapper:empty {
    display: none;
  }
}

/* Mobile Fix */
@media (max-width: 768px) {
  .shared-nav-inner {
    width: 100% !important;
    margin: 0 !important;
    /* FIX: Restored Vertical Padding (1rem) to prevent header collapse */
    padding: 1rem 1rem !important; 
  }
  
  .nav-brand { margin-left: 0; }
  
  .hub-main { grid-template-columns: 1fr; }
  .hub-sidebar { display: none; }
  .tool-grid { grid-template-columns: 1fr; }
  .hub-workspace { padding: 80px 1.5rem 1.5rem 1.5rem; }
}