:root {
    --bg: #05080f;
    --panel: #0d121d;
    --cyan: #00f2ff;
    --green: #00ff88;
}

body { background: var(--bg); color: white; margin: 0; font-family: 'Inter', sans-serif; display: flex; height: 100vh; overflow: hidden; }
.app-container { display: flex; width: 100%; height: 100vh; }

/* Sidebar: Professional Fixed Aesthetic */
.sidebar { width: 200px; background: #030508; border-right: 1px solid #1a2235; padding: 20px; flex-shrink: 0; position: relative; display: flex; flex-direction: column; transition: width 0.3s; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--cyan); margin-bottom: 30px; }
.brand h2 { font-size: 0.95rem; font-weight: 900; letter-spacing: 1px; margin: 0; white-space: nowrap; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px; color: #94a3b8; cursor: pointer; border-radius: 8px; font-size: 0.7rem; font-weight: 800; }
.nav-item.active { background: rgba(0, 242, 255, 0.1); color: var(--cyan); }

/* WIDGETS & BUTTONS - ONLY BOX THE SIDEBAR WIDGETS */
.stored-box, .rescue-widget-btn, .exit-btn {
    background: rgba(22, 30, 45, 0.6) !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
    padding: 8px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}
.rescue-widget-btn { border-color: #ff4444 !important; color: #ff4444 !important; }

/* TOP BAR BUTTONS */
.ratio-btn, .freq-btn, .engine-dropdown, .sync-trigger-btn {
    background: rgba(22, 30, 45, 0.6) !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
    border-radius: 6px;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.7rem;
}
.ratio-btn.active, .freq-btn.active { background: var(--cyan) !important; color: black !important; }

/* REMOVING THE BOX FROM ENHANCE */
.ai-btn { background: none !important; border: none !important; color: var(--cyan) !important; cursor: pointer; display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 0.65rem; }

/* Workspace Layout - FIXED BOX-SIZING */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.prod-top-bar { display: flex; background: #080b12; padding: 12px 30px; border-bottom: 1px solid #161e2d; align-items: center; justify-content: space-between; flex-shrink: 0; }
.production-workspace { display: flex; gap: 15px; padding: 20px; flex: 1; overflow-x: auto; }

.character-column { flex: 1; min-width: 320px; background: var(--panel); border-radius: 15px; border: 1px solid rgba(0, 242, 255, 0.1); padding: 18px; display: flex; flex-direction: column; box-sizing: border-box; }

.photo-box { height: 180px; background: #060912; border: 1px dashed #1e293b; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; flex-shrink: 0; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.label-row span { font-size: 0.65rem; color: var(--cyan); font-weight: 800; }

textarea { width: 100%; background: #05080f; border: 1px solid #161e2d; color: white; padding: 12px; border-radius: 8px; flex: 1; resize: none; box-sizing: border-box; font-size: 0.85rem; }

.generation-footer { background: #030508; border-top: 1px solid #161e2d; padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; }
.generate-now-btn { background: var(--cyan); color: black; border: none; padding: 12px 35px; border-radius: 6px; font-weight: 900; cursor: pointer; }

/* ================================
   SIDEBAR TOGGLE + COLLAPSE SUPPORT
   Paste at bottom of style.css
   ================================ */

/* Make sure sidebar header can host an arrow button cleanly */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

/* The arrow button itself (matches your HTML class: sidebar-toggle-arrow) */
.sidebar-toggle-arrow {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(22, 30, 45, 0.85);
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  z-index: 50;
}

/* Keep the icon inside aligned */
.sidebar-toggle-arrow i {
  display: inline-flex;
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: 50px;
  padding: 20px 12px;
}

/* Hide labels when collapsed */
.sidebar.collapsed .brand h2,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .stored-box span,
.sidebar.collapsed .rescue-widget-btn span,
.sidebar.collapsed .exit-btn span {
  display: none;
}

/* Keep icons centered when collapsed */
.sidebar.collapsed .nav-item,
.sidebar.collapsed .stored-box,
.sidebar.collapsed .rescue-widget-btn,
.sidebar.collapsed .exit-btn {
  justify-content: center;
}

/* Optional: tighten gaps in collapsed mode */
.sidebar.collapsed .nav-item {
  gap: 0;
}

/* Prevent main content overlap and allow it to shrink properly */
.main-content {
  min-width: 0;
}
/* ================================
   DASHBOARD (INDEX) STYLES
   ================================ */

.top-action-bar{
  padding: 18px 30px;
  border-bottom: 1px solid #161e2d;
  background: #080b12;
  flex-shrink: 0;
}

.primary-btn{
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
  font-size: 0.75rem;
}

.section-header{
  padding: 18px 30px 10px 30px;
  flex-shrink: 0;
}

.section-header h1{
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.grid-display{
  padding: 18px 30px 30px 30px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  overflow: auto;
}

.media-card{
  background: var(--panel);
  border: 1px solid rgba(0, 242, 255, 0.10);
  border-radius: 14px;
  overflow: hidden;
}

.media-card.empty{
  padding: 18px;
  color: #94a3b8;
}

.card-thumb{
  height: 140px;
  background: #060912;
  background-size: cover;
  background-position: center;
  position: relative;
}

.badge{
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(0, 242, 255, 0.25);
  color: var(--cyan);
  font-size: 0.6rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
}

.card-info{
  padding: 12px 12px 14px 12px;
}

.card-info h3{
  margin: 0 0 6px 0;
  font-size: 0.85rem;
}

.card-meta{
  margin: 0 0 10px 0;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
}

.card-actions{
  display: flex;
  gap: 8px;
  align-items: center;
}

.edit-btn, .dl-btn{
  background: rgba(22, 30, 45, 0.6);
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.65rem;
}

.edit-btn:hover, .dl-btn:hover{
  border-color: rgba(0, 242, 255, 0.35);
}

/* --- Sidebar Alignment & Center Fix --- */

/* 1. Ensure the sidebar handles the transition and centers content */
.sidebar {
    transition: width 0.3s ease; /* Smooth opening/closing */
    overflow-x: hidden; /* Prevents text from bleeding out when narrow */
    display: flex;
    flex-direction: column;
}

/* 2. Style the collapsed state (60px is the sweet spot for icons) */
.sidebar.collapsed {
    width: 60px !important;
    padding: 20px 0 !important;
    align-items: center; /* Horizontally centers the SVG icons */
}

/* Ensure everything stays inside its container */
* { box-sizing: border-box; }

/* Ensure everything stays inside its container */
* { box-sizing: border-box; }

/* Fixed Stored Box & Sidebar Buttons */
.stored-box, .rescue-widget-btn, .exit-btn {
    width: 100%;             /* Fits the sidebar width */
    min-height: 40px;        /* Consistent height */
    padding: 8px 12px;       /* Internal spacing */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Aligns icon and text to the left */
    overflow: hidden;        /* Prevents text from pushing the box wider */
    white-space: nowrap;
}

/* Sidebar Collapsed State Alignment */
.sidebar.collapsed {
    width: 60px !important;
    padding: 20px 8px !important;
    align-items: center;
}

.sidebar.collapsed .nav-item, 
.sidebar.collapsed .stored-box, 
.sidebar.collapsed .rescue-widget-btn,
.sidebar.collapsed .exit-btn {
    justify-content: center !important; /* Centers icon in the small bar */
    padding: 10px 0 !important;
    margin: 5px 0;
}

/* Hide labels in collapsed mode to stop the "off-centered" look */
.sidebar.collapsed span, 
.sidebar.collapsed .label,
.sidebar.collapsed .count,
.sidebar.collapsed h2 {
    display: none !important;
}