/* ============================================
   Content Studio - Standalone Stylesheet
   Samify AI brand tokens + layout + components
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Colors */
  --bg-primary: #07121c;
  --bg-panel: #0d2031;
  --accent-blue: #4e70a3;
  --accent-orange: #fb7b52;
  --accent-orange-light: #ff9b7a;
  --success: #10b981;
  --text-heading: #ffffff;
  --text-primary: #d1dce8;
  --text-secondary: #e2e8f0;
  --border: rgba(78, 112, 163, 0.2);
  --slate: #3a5272;

  /* Glass */
  --glass-bg: rgba(13, 32, 49, 0.6);
  --glass-blur: blur(12px);

  /* Typography */
  --font-primary: 'Montserrat', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-card: 12px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width: 260px;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg-primary: #f7f9fc;
  --bg-panel: #e4e9f1;
  --text-heading: #1e2d3d;
  --text-primary: #4a5a6e;
  --text-secondary: #576779;
  --border: rgba(78, 112, 163, 0.18);
  --slate: #94a3b8;
  --glass-bg: rgba(237, 240, 245, 0.7);
}

[data-theme="light"] .sidebar {
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .header {
  background: rgba(247, 249, 252, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .view-toggle {
  background: rgba(78, 112, 163, 0.08);
}

[data-theme="light"] .view-btn.active {
  background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, rgba(78, 112, 163, 0.15), rgba(78, 112, 163, 0.06));
}

[data-theme="light"] .btn-primary:hover {
  background: linear-gradient(135deg, rgba(78, 112, 163, 0.35), rgba(78, 112, 163, 0.18));
}

[data-theme="light"] .glass-panel {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(78, 112, 163, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .edge-glow {
  box-shadow: inset 0 0 80px 0px rgba(78, 112, 163, 0.04);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 20px rgba(78, 112, 163, 0.25);
}

[data-theme="light"] .btn-orange:hover {
  box-shadow: 0 4px 20px rgba(251, 123, 82, 0.25);
}

[data-theme="light"] .btn-secondary {
  background: rgba(78, 112, 163, 0.1);
  border-color: rgba(78, 112, 163, 0.25);
  color: #4a5a6e;
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(78, 112, 163, 0.18);
  border-color: var(--accent-blue);
}

[data-theme="light"] .sidebar-link:hover {
  background: rgba(78, 112, 163, 0.06);
}

[data-theme="light"] .sidebar-link.active {
  background: rgba(78, 112, 163, 0.1);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.2);
}

/* Studio Theme Toggle */
.studio-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  flex-shrink: 0;
}

.studio-theme-toggle:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.studio-theme-toggle .icon-sun,
.studio-theme-toggle .icon-moon {
  width: 16px;
  height: 16px;
}

.studio-theme-toggle .icon-sun { display: none; }
.studio-theme-toggle .icon-moon { display: block; }

[data-theme="light"] .studio-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .studio-theme-toggle .icon-moon { display: none; }

.login-theme-toggle-studio {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 10;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Edge Glow ---------- */
.edge-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  box-shadow: inset 0 0 80px rgba(78, 112, 163, 0.1);
}

/* ---------- Glass Panel ---------- */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  backdrop-filter: var(--glass-blur);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, rgba(78, 112, 163, 0.15), rgba(13, 32, 49, 0.8));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(78, 112, 163, 0.3);
}

.btn-primary:hover { box-shadow: 0 0 30px rgba(78, 112, 163, 0.5); }

.btn-secondary {
  background: rgba(78, 112, 163, 0.2);
  border-color: rgba(78, 112, 163, 0.4);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(78, 112, 163, 0.3);
  border-color: var(--accent-blue);
}

.btn-full { width: 100%; }

.btn-danger {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.4) !important;
  background: rgba(248, 113, 113, 0.1) !important;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2) !important;
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.3) !important;
}

.btn-orange {
  background: linear-gradient(135deg, rgba(251, 123, 82, 0.2), rgba(251, 123, 82, 0.05));
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}
.btn-orange:hover { box-shadow: 0 0 30px rgba(251, 123, 82, 0.5); }

.btn-approved {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border-color: var(--success);
  color: var(--success);
}
.btn-approved:hover { box-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }
.btn-approved:disabled { opacity: 0.5; cursor: not-allowed; }

.regen-status {
  font-size: 0.85rem;
  color: var(--accent-orange);
  font-style: italic;
  align-self: center;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-sm);
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(7, 18, 28, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(78, 112, 163, 0.2);
}

.form-status {
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: var(--space-sm);
  opacity: 0;
  transition: opacity 0.3s;
}

.form-status.show { opacity: 1; }
.form-status.error { color: var(--accent-orange); }
.form-status.success { color: var(--success); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-xl);
  text-align: center;
}

.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-sm);
  border-radius: var(--radius-sm);
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

/* ---------- App Layout ---------- */
#app-view {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.sidebar-header img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.sidebar-header span {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-heading);
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-sm);
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-link:hover { background: rgba(78, 112, 163, 0.1); color: var(--text-heading); }
.sidebar-link.active { background: rgba(78, 112, 163, 0.15); color: var(--accent-blue); }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }

.user-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 0.7rem;
  color: var(--slate);
  text-transform: capitalize;
}

.logout-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--slate);
  transition: var(--transition);
  border-radius: 50%;
}

.logout-btn:hover { color: var(--accent-orange); background: rgba(251, 123, 82, 0.1); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.show { display: block; }

/* ---------- Main Content ---------- */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 18, 28, 0.8);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-heading);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.sidebar-toggle svg {
  width: 24px;
  height: 24px;
}

.content {
  flex: 1;
  padding: var(--space-lg);
}

/* ---------- Loading ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  max-width: 400px;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.toast.error { background: rgba(251, 123, 82, 0.15); color: var(--accent-orange); border: 1px solid rgba(251, 123, 82, 0.3); }
.toast.info { background: rgba(78, 112, 163, 0.15); color: var(--accent-blue); border: 1px solid rgba(78, 112, 163, 0.3); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: var(--space-md);
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-overlay.show { opacity: 1; }

.modal-content {
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-lg);
  position: relative;
}

.modal-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-md);
  padding-right: 36px;
}

.modal-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover { color: var(--text-heading); background: rgba(78, 112, 163, 0.1); }

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.stat-value.stat-pending { color: #eab308; }
.stat-value.stat-approved { color: var(--success); }
.stat-value.stat-published { color: var(--accent-blue); }

.stat-label {
  font-size: 0.8rem;
  color: var(--slate);
  font-weight: 500;
  margin-top: 4px;
}

/* ---------- Week Navigation ---------- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.week-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  min-width: 220px;
  text-align: center;
}

.week-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ---------- View Toggle ---------- */
.view-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: var(--space-md);
  background: rgba(7, 18, 28, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.view-btn {
  background: none;
  border: none;
  padding: 8px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  font-family: var(--font-primary);
}

.view-btn:hover { color: var(--text-heading); }

.view-btn.active {
  background: rgba(78, 112, 163, 0.15);
  color: var(--accent-blue);
}

/* ---------- Calendar Grid ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.day-card {
  padding: var(--space-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.day-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(78, 112, 163, 0.15);
}

.day-card.day-today {
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(78, 112, 163, 0.2);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.day-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-heading);
}

.today-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-blue);
  background: rgba(78, 112, 163, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.day-slots {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.slot-type { color: var(--text-primary); }
.slot-empty .slot-type { color: var(--slate); opacity: 0.6; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.day-count {
  font-size: 0.7rem;
  color: var(--slate);
  margin-top: var(--space-xs);
  text-align: center;
}

/* ---------- Week Actions ---------- */
.week-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* ---------- Day Detail ---------- */
.day-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.day-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-heading);
}

.day-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

/* ---------- Post Cards ---------- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-md);
  align-items: stretch;
}

.post-card {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.type-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.type-badge svg { width: 18px; height: 18px; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.badge-approved { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-rejected { background: rgba(251, 123, 82, 0.12); color: var(--accent-orange); }
.badge-regenerated { background: rgba(78, 112, 163, 0.12); color: var(--accent-blue); }
.badge-published {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.badge-published-text {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.post-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.post-topic {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin: 0;
}

/* ---------- Post Images ---------- */
.post-images {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}

.thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.thumb:hover { border-color: var(--accent-blue); transform: scale(1.05); }

.post-no-media {
  padding: var(--space-md);
  text-align: center;
  font-size: 0.85rem;
  color: var(--slate);
  background: rgba(7, 18, 28, 0.4);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.post-empty { opacity: 0.5; }

.post-empty-msg {
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  font-size: 0.9rem;
  color: var(--slate);
}

/* ---------- Caption Tabs ---------- */
.caption-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.caption-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-family: var(--font-primary);
}

.caption-tab:hover { color: var(--text-heading); }
.caption-tab.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

.caption-content {
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.caption-text {
  font-family: var(--font-primary);
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding: var(--space-sm) 0;
}

.caption-empty {
  font-size: 0.8rem;
  color: var(--slate);
  padding: var(--space-sm) 0;
  margin: 0;
}

/* ---------- Rejection Reason ---------- */
.rejection-reason {
  font-size: 0.8rem;
  color: var(--accent-orange);
  background: rgba(251, 123, 82, 0.08);
  border: 1px solid rgba(251, 123, 82, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
}

/* ---------- Post Actions ---------- */
.post-actions {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.post-actions .btn {
  font-size: 0.8rem;
  padding: 6px 16px;
  min-height: 34px;
}

.post-actions .action-delete {
  margin-left: auto;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
}

/* ---------- Image Preview ---------- */
.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.preview-img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.preview-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.preview-counter {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 60px;
  text-align: center;
}

.preview-prev,
.preview-next {
  width: 36px;
  height: 36px;
  padding: 0;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.preview-prev:disabled,
.preview-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- Month Grid ---------- */
.month-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.month-header-cell {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.month-cell {
  padding: var(--space-xs) var(--space-xs);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
}

.month-cell:hover:not(.month-cell-empty) {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(78, 112, 163, 0.12);
}

.month-cell.day-today {
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(78, 112, 163, 0.2);
}

.month-cell-empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.month-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.month-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
  font-family: var(--font-mono);
}

.month-cell .day-slots {
  gap: 3px;
}

.month-cell .slot {
  font-size: 0.65rem;
}

.month-cell .dot {
  width: 6px;
  height: 6px;
}

.month-cell .today-badge {
  font-size: 0.55rem;
  padding: 1px 6px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--slate); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .calendar { grid-template-columns: repeat(4, 1fr); }
  .month-grid { gap: 4px; }
  .month-cell { min-height: 70px; }
  .month-cell .slot-type { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

  .sidebar-toggle { display: block; }

  .calendar { grid-template-columns: repeat(2, 1fr); }
  .month-cell { min-height: 60px; padding: 4px; }
  .month-cell .day-slots { display: none; }
  .month-cell-has-posts::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    margin: auto;
  }
  .posts-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }

  .stats-bar .stat { padding: var(--space-sm); }
  .stat-value { font-size: 1.4rem; }

  .week-actions,
  .day-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .week-actions .btn,
  .day-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .day-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .day-title { font-size: 1.05rem; }

  .header { padding: var(--space-sm) var(--space-md); }
  .header h2 { font-size: 1.05rem; }

  .content { padding: var(--space-sm); }

  .post-card { padding: var(--space-md); }

  .thumb {
    width: 64px;
    height: 64px;
  }

  .post-images {
    gap: 6px;
    flex-wrap: wrap;
  }

  .week-label { font-size: 0.95rem; min-width: 180px; }
}

@media (max-width: 480px) {
  .calendar { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }

  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.7rem; }

  .modal-content { padding: var(--space-md); }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn { width: 100%; }

  .content { padding: var(--space-xs); }

  .post-card { padding: var(--space-sm); gap: var(--space-xs); }

  .post-title { font-size: 0.9rem; }
  .post-topic { font-size: 0.8rem; }

  .thumb {
    width: 56px;
    height: 56px;
  }

  .caption-tab { padding: 6px 12px; font-size: 0.75rem; }

  .caption-content { min-height: 60px; }

  .post-actions .btn { font-size: 0.75rem; padding: 6px 12px; min-height: 30px; }
  .post-actions .action-delete { width: 30px; height: 30px; }

  .day-actions .btn,
  .week-actions .btn { font-size: 0.8rem; padding: 8px 16px; min-height: 38px; }

  .week-nav { gap: var(--space-sm); }
  .week-label { font-size: 0.85rem; min-width: 160px; }
}

/* ---------- Generate Week Progress Overlay ---------- */

.gen-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 28, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.gen-progress-panel {
  width: min(480px, 90vw);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.gen-progress-panel h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}

.gen-progress-msg {
  font-size: 0.95rem;
  color: var(--text-primary);
  min-height: 1.4em;
}

.progress-bar-track {
  height: 8px;
  background: rgba(78, 112, 163, 0.15);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4e70a3, #fb7b52);
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gen-progress-pct {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-align: right;
  margin-top: -12px;
}

.gen-warnings {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.gen-warning {
  font-size: 0.82rem;
  color: var(--accent-orange);
  background: rgba(251, 123, 82, 0.08);
  border: 1px solid rgba(251, 123, 82, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
}

/* ---------- Reel Upload Dropzone ---------- */
.reel-upload-zone {
  border: 2px dashed rgba(78, 112, 163, 0.3);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.reel-upload-zone:hover,
.reel-upload-zone.drag-over {
  border-color: var(--accent-orange);
  background: rgba(251, 123, 82, 0.05);
}

.reel-upload-zone.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.reel-upload-zone .upload-icon {
  display: block;
  margin: 0 auto var(--space-xs);
  color: var(--accent-blue);
}

.reel-upload-zone .upload-icon svg {
  width: 32px;
  height: 32px;
}

.reel-upload-zone .upload-text {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.reel-upload-zone .upload-hint {
  color: #8a9bb5;
  font-size: 0.8rem;
}

.reel-upload-zone input[type="file"] {
  display: none;
}

/* ---------- Reel Processing ---------- */
.reel-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--space-lg);
}

.reel-processing .processing-text {
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ---------- Reel Media Tabs ---------- */
.media-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-xs);
}

.media-tab {
  background: rgba(78, 112, 163, 0.1);
  border: 1px solid rgba(78, 112, 163, 0.15);
  color: #8a9bb5;
  padding: 4px 14px;
  border-radius: 6px 6px 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-primary);
  transition: var(--transition);
}

.media-tab:hover {
  color: var(--text-heading);
}

.media-tab.active {
  background: rgba(78, 112, 163, 0.3);
  border-color: var(--accent-blue);
  color: #ffffff;
}

/* ---------- Reel Video Player ---------- */
.reel-video-container {
  position: relative;
  max-height: 360px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.reel-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reel-expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-primary);
  transition: var(--transition);
}

.reel-expand-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* ---------- Reel Cover Image ---------- */
.reel-cover-container {
  max-height: 360px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
}

.reel-cover-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Reel Script Button ---------- */
.btn-script {
  background: rgba(78, 112, 163, 0.1);
  border: 1px solid rgba(78, 112, 163, 0.3);
  color: var(--accent-blue);
}

.btn-script:hover {
  box-shadow: 0 0 20px rgba(78, 112, 163, 0.3);
}

/* ---------- Regen Scope Radio Buttons ---------- */
.regen-scope-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  accent-color: var(--accent-orange);
}

/* ---------- Reel Upload Progress ---------- */
.upload-progress {
  margin-top: 12px;
}

.upload-progress .progress-bar-track {
  height: 4px;
}

.upload-progress-text {
  font-size: 0.8rem;
  color: var(--accent-blue);
  text-align: center;
  margin-top: 4px;
}

/* ---------- Video Lightbox ---------- */
.preview-video {
  max-height: 80vh;
  max-width: 45vh;
  border-radius: var(--radius-sm);
}

/* ---------- Reel Upload File List ---------- */
.upload-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-xs);
}

.upload-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--success);
}

.upload-file-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------- Reel Responsive ---------- */
@media (max-width: 768px) {
  .reel-video-container {
    max-height: 280px;
  }

  .reel-cover-container {
    max-height: 280px;
  }
}

@media (max-width: 480px) {
  .reel-video-container {
    max-height: 220px;
  }

  .reel-cover-container {
    max-height: 220px;
  }

  .reel-upload-zone {
    padding: var(--space-sm);
  }
}
