/* Modern Storyboard Studio Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-solid: #121826;
  --bg-sidebar: #0f1523;
  --bg-input: #1a2234;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(99,102,241,0.15);
  --glass-backdrop: blur(16px) saturate(180%);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(99,102,241,0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(6,182,212,0.08) 0%, transparent 45%);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(10, 15, 35, 0.9); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
  border-radius: 8px;
  border: 2px solid rgba(10, 15, 35, 0.9);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-hover), #0891b2);
}

/* Firefox scrollbar support */
* {
  scrollbar-width: auto;
  scrollbar-color: var(--accent-cyan) rgba(10, 15, 35, 0.9);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; font-family: var(--font-heading); font-weight: 600;
  font-size: 0.9rem; border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; transition: var(--transition); outline: none; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent-cyan)); color: #fff; box-shadow: 0 4px 15px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.btn-secondary { background: rgba(255,255,255,0.05); border-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.btn-accent { background: linear-gradient(135deg, #ec4899, #8b5cf6); color: #fff; }
.btn-danger { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,0.3); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }

/* ---- SCREEN MANAGEMENT ---- */
.screen { display: none !important; opacity: 0; transition: opacity 0.3s ease; }
.screen.active { display: flex !important; opacity: 1; }

/* ---- LANDING SCREEN (HOME PAGE) ---- */
#landing-screen.active {
  height: 100vh;
  max-height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: var(--accent-cyan) rgba(10, 15, 35, 0.9);
}

#landing-screen.active::-webkit-scrollbar {
  width: 10px !important;
  display: block !important;
}
#landing-screen.active::-webkit-scrollbar-track {
  background: rgba(10, 15, 35, 0.9) !important;
}
#landing-screen.active::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan)) !important;
  border-radius: 8px !important;
}

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem; max-width: 900px; width: 100%; margin-top: 3rem;
}
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  padding: 1.5rem; border-radius: var(--radius-md); text-align: left;
  backdrop-filter: var(--glass-backdrop);
}
.feature-card i { font-size: 1.6rem; color: var(--accent-cyan); margin-bottom: 0.75rem; }
.feature-card h3 { font-family: var(--font-heading); font-size: 1rem; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.82rem; color: var(--text-muted); }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px;
  border-radius: var(--radius-full); background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc;
  font-size: 0.85rem; font-weight: 600; margin-bottom: 1.5rem;
}
.hero-title {
  font-family: var(--font-heading); font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800; line-height: 1.1; margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc 70%, #06b6d4 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); max-width: 650px; margin: 0 auto 2.5rem; }
.btn-start-hero {
  padding: 14px 38px; font-size: 1.15rem; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-cyan) 100%);
  color: #fff; box-shadow: 0 10px 30px rgba(99,102,241,0.4);
}

/* ---- APP SCREEN ---- */
#app-screen.active { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ---- STICKY TOP NAV ---- */
.top-nav {
  position: sticky; top: 0; left: 0; right: 0;
  min-height: 64px; height: auto;
  background: #0f1523; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1.25rem; z-index: 1000; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  flex-shrink: 0; flex-wrap: wrap; gap: 12px;
  box-sizing: border-box; width: 100%; max-width: 100vw;
}
.nav-brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-brand i { font-size: 1.3rem; color: var(--primary); }
.nav-brand h1 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.story-title-display {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); padding: 4px 12px;
  border-radius: var(--radius-full); border: 1px solid var(--border-color);
  font-size: 0.85rem; color: var(--accent-cyan); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-container {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius-full); padding: 4px 14px; width: 280px; max-width: 100%; transition: var(--transition);
}
.search-container:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-container input { background: transparent; border: none; outline: none; color: #fff; font-size: 0.88rem; width: 100%; }
.nav-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- WORKSPACE SPLIT ---- */
.workspace-body {
  flex: 1; display: flex; overflow: hidden;
  height: calc(100vh - 64px); width: 100%; max-width: 100vw;
  box-sizing: border-box;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 300px; background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; user-select: none; flex-shrink: 0;
  box-sizing: border-box; overflow: hidden;
}
.sidebar-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header h3 { font-family: var(--font-heading); font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.scene-list { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 10px; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border-color); }

/* ---- SCENE ITEM IN SIDEBAR ---- */
.scene-item {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 10px 12px; transition: var(--transition);
  display: flex; flex-direction: column; gap: 8px; width: 100%; box-sizing: border-box;
  overflow: hidden;
}
.scene-item:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); }
.scene-item.active { background: rgba(99,102,241,0.12); border-color: var(--primary); }
.scene-item-top { display: flex; align-items: center; justify-content: space-between; width: 100%; overflow: hidden; }
.scene-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; overflow: hidden; }
.scene-badge {
  width: 26px; height: 26px; border-radius: 6px; background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 0.8rem; color: var(--text-muted);
  flex-shrink: 0;
}
.scene-item.active .scene-badge { background: var(--primary); color: #fff; }
.scene-title-text {
  font-weight: 600; font-size: 0.88rem; color: var(--text-main);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.scene-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 6px; }

/* ---- MAIN CANVAS ---- */
.canvas-area {
  flex: 1; background: #080b12; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; padding: 1.25rem 1.75rem;
  width: 100%; max-width: 100%; box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(15, 21, 35, 0.8);
}
.canvas-area::-webkit-scrollbar { width: 10px; }
.canvas-area::-webkit-scrollbar-track { background: rgba(15, 21, 35, 0.8); border-radius: 6px; }
.canvas-area::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
  border-radius: 6px;
  border: 2px solid rgba(15, 21, 35, 0.8);
}
.canvas-area::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-hover), #0891b2);
}

.scene-header-panel {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
  backdrop-filter: var(--glass-backdrop); width: 100%; box-sizing: border-box;
}
.scene-name-editable {
  font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700;
  color: #fff; background: transparent; border: none; outline: none;
  border-bottom: 2px solid transparent; transition: var(--transition); width: 100%; margin-bottom: 0.5rem;
}
.scene-name-editable:focus { border-bottom-color: var(--primary); }
.storyboard-frame {
  background: #111726; border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-lg); min-height: 400px;
  max-height: calc(100vh - 280px);
  padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem;
  width: 100%; max-width: 100%; overflow-y: auto; overflow-x: hidden; box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(17, 23, 38, 0.8);
}
.storyboard-frame::-webkit-scrollbar { width: 10px; }
.storyboard-frame::-webkit-scrollbar-track { background: rgba(17, 23, 38, 0.8); border-radius: 6px; }
.storyboard-frame::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
  border-radius: 6px;
  border: 2px solid rgba(17, 23, 38, 0.8);
}
.storyboard-frame::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-hover), #0891b2);
}
.storyboard-frame.has-content { border-style: solid; border-color: var(--border-color); }
.empty-canvas-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; margin: auto; text-align: center; padding: 3rem 1rem; }
.empty-canvas-placeholder i { font-size: 3rem; color: var(--text-dim); margin-bottom: 1rem; }
.empty-canvas-placeholder h3 { font-family: var(--font-heading); font-size: 1.2rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.empty-canvas-placeholder p { color: var(--text-dim); font-size: 0.9rem; max-width: 350px; }
.add-content-bar { margin-top: 1rem; display: flex; justify-content: center; }

/* ---- 12-COLUMN GRID: images 3-per-row (4 cols each), videos 3-per-row (4 cols each) ---- */
.scene-elements-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  width: 100%; max-width: 100%;
  box-sizing: border-box; overflow: visible;
}
/* Image cards: 3 per row = 4 columns each */
.content-card.image-card { grid-column: span 4; }
/* Video cards: 3 per row = 4 columns each */
.content-card.video-card { grid-column: span 4; }
/* Context boxes span full width */
.content-card.full-width {
  grid-column: 1 / -1;
}

.content-card {
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); overflow: hidden;
  transition: var(--transition); position: relative;
  width: 100%; max-width: 100%; box-sizing: border-box;
  display: flex; flex-direction: column;
}
.content-card:hover { border-color: rgba(255,255,255,0.2); box-shadow: var(--shadow-lg); }

.content-card-header {
  padding: 6px 10px; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-color); width: 100%; box-sizing: border-box;
}
.content-type-tag { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 6px; border-radius: 4px; }
.tag-image { background: rgba(6,182,212,0.2); color: var(--accent-cyan); }
.tag-context { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.content-card-actions { display: flex; align-items: center; gap: 4px; }
.content-card-body { padding: 0; width: 100%; overflow: visible; box-sizing: border-box; }

/* 16:9 IMAGE WRAPPER — auto-shrink to fit */
.image-16-9-wrapper {
  width: 100%; max-width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden; background: #0a0e18;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.image-16-9-wrapper img {
  width: 100%; max-width: 100%; height: 100%;
  object-fit: contain; display: block;
  transition: transform 0.3s ease;
}
.image-16-9-wrapper:hover img {
  transform: scale(1.03);
}
.image-alt-caption {
  font-size: 0.82rem; font-weight: 500; color: var(--text-main);
  background: rgba(0, 0, 0, 0.55); border-top: 1px solid var(--border-color);
  padding: 8px 12px; line-height: 1.4; word-break: break-word; overflow-wrap: break-word;
  white-space: normal; display: flex; align-items: flex-start; gap: 8px;
  max-width: 100%; min-height: 32px;
}
.image-alt-caption i { color: var(--accent-cyan); font-size: 0.82rem; margin-top: 2px; flex-shrink: 0; }

/* 21:9 VIDEO WRAPPER */
.video-16-9-wrapper, .video-21-9-wrapper {
  width: 100%; aspect-ratio: 21 / 9;
  overflow: hidden; background: #000;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.video-16-9-wrapper video, .video-21-9-wrapper video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-alt-caption {
  font-size: 0.84rem; font-weight: 500; color: var(--text-main);
  background: rgba(0, 0, 0, 0.45); border-top: 1px solid var(--border-color);
  padding: 8px 12px; line-height: 1.45; word-break: break-word; overflow-wrap: break-word;
  white-space: normal; display: flex; align-items: flex-start; gap: 8px; max-width: 100%;
}
.video-alt-caption i { color: #a78bfa; font-size: 0.85rem; margin-top: 3px; flex-shrink: 0; }

/* Download button styling */
.btn-download-media {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399; cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
.btn-download-media:hover {
  background: rgba(16, 185, 129, 0.3); border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

/* ---- CONTEXT BOX ---- */
.context-box-render { display: flex; flex-direction: column; gap: 8px; padding: 1rem; }
.category-badge { align-self: flex-start; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); text-transform: uppercase; }
.cat-narration { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.4); }
.cat-technical { background: rgba(6,182,212,0.2); color: #22d3ee; border: 1px solid rgba(6,182,212,0.4); }
.cat-conversation { background: rgba(236,72,153,0.2); color: #f472b6; border: 1px solid rgba(236,72,153,0.4); }
.context-text-display {
  font-size: 0.95rem; line-height: 1.6; color: #fff;
  padding: 10px 14px; background: rgba(0,0,0,0.25);
  border-left: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap;
}

/* SEARCH HIGHLIGHT */
mark.search-highlight { background: #f59e0b; color: #000; font-weight: 700; border-radius: 2px; padding: 0 2px; }

/* ---- DRAG & DROP ZONE ---- */
.image-drop-zone {
  border: 2px dashed var(--border-highlight); border-radius: var(--radius-md);
  background: rgba(99,102,241,0.04); padding: 1.5rem 1rem;
  text-align: center; transition: var(--transition); cursor: pointer;
  position: relative;
}
.image-drop-zone.drag-over {
  border-color: var(--accent-cyan); background: rgba(6,182,212,0.1);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.2);
}
.drop-zone-icon { font-size: 2.2rem; color: var(--primary); margin-bottom: 0.5rem; }
.drop-zone-text { font-weight: 600; color: var(--text-main); font-size: 0.95rem; }
.drop-zone-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.drop-zone-limit { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }

.drop-zone-preview {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.drop-zone-preview-img {
  width: 80px; height: 45px; object-fit: cover;
  border-radius: 6px; border: 2px solid var(--accent-cyan);
}

/* ---- FULL-PAGE SCENE VIEW ---- */
.scene-view-fullpage {
  position: absolute; inset: 0; top: 64px; /* below sticky nav */
  background: var(--bg-dark); z-index: 500;
  display: flex; flex-direction: column; overflow: hidden;
}
.scene-view-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0.85rem 1.5rem; background: #0f1523;
  border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.scene-view-body {
  flex: 1; overflow-y: auto; padding: 2rem;
  background: #080b12;
}

/* Scene view full image grid (3 per row) */
.scene-view-images-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 1.5rem;
}
.scene-view-image-card {
  background: #111726; border: 1px solid var(--border-color);
  border-radius: var(--radius-md); overflow: hidden;
  transition: var(--transition);
  display: flex; flex-direction: column;
}
.scene-view-image-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(255,255,255,0.2); }

/* Scene view video grid (3 per row) */
.scene-view-videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 1.5rem;
}
.scene-view-video-card {
  background: #111726; border: 1px solid var(--border-color);
  border-radius: var(--radius-md); overflow: hidden;
  transition: var(--transition);
  display: flex; flex-direction: column;
}
.scene-view-video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(255,255,255,0.2); }

/* Context boxes stacked in view */
.scene-view-contexts { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.scene-view-context-card {
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); overflow: hidden;
}

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,8,15,0.85);
  backdrop-filter: blur(12px); display: flex; align-items: center;
  justify-content: center; z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease; padding: 1rem;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--bg-card-solid); border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg); width: 100%; max-width: 540px;
  padding: 1.75rem; box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.96); transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.active .modal-box { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h2 { font-family: var(--font-heading); font-size: 1.3rem; color: #fff; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; }
.modal-close:hover { color: #fff; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: #fff; font-family: var(--font-body); font-size: 0.92rem; transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); outline: none;
}
.form-textarea { resize: vertical; min-height: 90px; }

.content-type-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; margin-top: 1rem; }
.option-box {
  background: var(--bg-input); border: 2px solid var(--border-color);
  border-radius: var(--radius-md); padding: 1.5rem 1rem; text-align: center;
  cursor: pointer; transition: var(--transition);
}
.option-box:hover { border-color: var(--primary); background: rgba(99,102,241,0.1); transform: translateY(-2px); }
.option-box i { font-size: 2.2rem; margin-bottom: 0.75rem; }
.option-box.image-opt i { color: var(--accent-cyan); }
.option-box.video-opt i { color: #a78bfa; }
.option-box.video-opt:hover { border-color: #a78bfa; background: rgba(167,139,250,0.1); }
.option-box.context-opt i { color: var(--accent-pink); }
.option-box h4 { font-family: var(--font-heading); font-size: 1.05rem; margin-bottom: 0.3rem; color: #fff; }
.option-box p { font-size: 0.78rem; color: var(--text-muted); }

/* SKETCH CANVAS */
.sketch-canvas-container {
  width: 100%; height: 280px; background: #000;
  border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  touch-action: none; cursor: crosshair;
}
.sketch-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-card-solid); border: 1px solid var(--primary);
  color: #fff; padding: 12px 18px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); font-size: 0.88rem;
  display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.3s ease forwards;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---- INLINE CONTEXT TEXTAREA (types directly in scene) ---- */
.ctx-inline-textarea {
  width: 100%;
  min-height: 140px;
  max-height: 480px;
  resize: vertical;
  background: rgba(10, 15, 30, 0.7);
  border: none;
  border-top: 3px solid var(--primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: #f3f4f6;
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.7;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  scrollbar-width: thin;
}
.ctx-inline-textarea:focus {
  border-top-color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.2);
  background: rgba(6, 182, 212, 0.04);
}
.ctx-inline-textarea::placeholder { color: var(--text-dim); }

/* Master Prompt — golden accent */
.ctx-inline-textarea.ctx-master {
  border-top-color: #f59e0b;
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  letter-spacing: 0.2px;
  min-height: 110px;
}
.ctx-inline-textarea.ctx-master:focus {
  border-top-color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.03);
}

/* ---- WORD / CHAR COUNTER ---- */
.ctx-counter {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  white-space: nowrap;
  transition: var(--transition);
}
.ctx-counter-over {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ---- CLOUD AUTO-SAVE BADGE ---- */
.cloud-save-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-emerald);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.cloud-save-badge.saving {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
}
.cloud-save-badge.offline {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

/* Master Prompt category badge */
.cat-master {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Video drop zone variant */
.video-drop-zone {
  border: 2px dashed rgba(167,139,250,0.4); border-radius: var(--radius-md);
  background: rgba(167,139,250,0.04); padding: 1.5rem 1rem;
  text-align: center; transition: var(--transition); cursor: pointer;
  position: relative;
}
.video-drop-zone.drag-over {
  border-color: #a78bfa; background: rgba(167,139,250,0.1);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.2);
}
.video-drop-zone .drop-zone-icon { color: #a78bfa; }

.drop-zone-preview-video {
  width: 120px; height: 67px; object-fit: cover;
  border-radius: 6px; border: 2px solid #a78bfa;
  background: #000;
}

.tag-video { background: rgba(167,139,250,0.2); color: #a78bfa; }

/* ---- RESPONSIVE MEDIA QUERIES (DESKTOP, TABLET, MOBILE) ---- */
@media (max-width: 1200px) {
  .scene-elements-grid { grid-template-columns: repeat(12, 1fr); gap: 12px; }
  .content-card.image-card { grid-column: span 6; } /* 2 per row on mid screens */
  .content-card.video-card { grid-column: span 6; } /* 2 per row */
  .scene-view-images-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .top-nav { padding: 0.5rem 1rem; }
  .sidebar { width: 250px; }
  .scene-elements-grid { grid-template-columns: repeat(12, 1fr); }
  .content-card.image-card { grid-column: span 6; } /* 2 per row on tablets */
  .content-card.video-card { grid-column: span 6; } /* 2 per row on tablets */
  .scene-view-images-grid { grid-template-columns: repeat(2, 1fr); }
  .scene-view-videos-grid { grid-template-columns: repeat(2, 1fr); }
  .search-container { width: 220px; }
}

@media (max-width: 768px) {
  /* 1. MOBILE ROOT OVERFLOW & SCROLLBAR */
  html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  ::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
  }
  ::-webkit-scrollbar-track {
    background: rgba(10, 15, 30, 0.9) !important;
  }
  ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--accent-cyan)) !important;
    border-radius: 10px !important;
  }

  #app-screen.active,
  #stories-screen.active,
  #landing-screen.active,
  #scene-view-screen {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: visible !important;
  }

  /* 2. LANDING SCREEN MOBILE */
  #landing-screen.active {
    padding: 2rem 1rem !important;
  }
  .hero-title {
    font-size: 2rem !important;
    margin-bottom: 1rem;
  }
  .hero-subtitle {
    font-size: 0.92rem !important;
    padding: 0 0.5rem;
    margin-bottom: 1.5rem;
  }
  .hero-actions {
    flex-direction: column !important;
    width: 100%;
    gap: 10px !important;
  }
  .btn-start-hero {
    width: 100% !important;
    justify-content: center;
    padding: 12px 24px !important;
    font-size: 1rem !important;
  }
  .feature-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-top: 2rem;
  }

  /* 3. TOP NAV MOBILE STYLING */
  .top-nav {
    height: auto !important;
    padding: 0.5rem 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  .nav-brand {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    gap: 6px;
  }
  .nav-brand h1 {
    font-size: 1rem !important;
  }
  .story-title-display {
    max-width: 120px !important;
    font-size: 0.78rem !important;
    padding: 3px 8px !important;
  }
  .cloud-save-badge {
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
  }
  .search-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 38px !important;
  }
  .search-container input {
    font-size: 16px !important; /* Prevents mobile browser auto-zoom */
  }
  .nav-actions {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding-bottom: 4px;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
  }
  .nav-actions::-webkit-scrollbar { display: none; }
  .nav-actions .btn {
    flex: 0 0 auto !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    min-height: 36px;
    white-space: nowrap !important;
  }
  .btn-tasks-notes-trigger {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 14px !important;
  }

  /* 4. WORKSPACE & HORIZONTAL SCENE SELECTOR MOBILE */
  .workspace-body {
    flex-direction: column !important;
    height: auto !important;
    min-height: calc(100vh - 120px);
    overflow-y: visible !important;
    width: 100% !important;
  }
  .sidebar {
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    background: rgba(10, 15, 30, 0.98) !important;
  }
  .sidebar-header {
    margin-bottom: 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .sidebar-header h3 {
    font-size: 0.88rem !important;
  }
  .scene-list {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding: 4px 0 !important;
    max-height: none !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .scene-list::-webkit-scrollbar { display: none; }
  .scene-item {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 6px 12px !important;
    border-radius: var(--radius-full) !important;
    font-size: 0.82rem !important;
  }
  .sidebar-footer {
    padding-top: 0 !important;
  }
  .sidebar-footer .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px !important;
    font-size: 0.85rem !important;
  }

  .canvas-area {
    padding: 0.75rem 0.5rem !important;
    height: auto !important;
    flex: none !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .scene-header-panel {
    padding: 0.75rem !important;
    margin-bottom: 0.85rem !important;
  }
  .scene-name-editable {
    font-size: 1.2rem !important;
    width: 100% !important;
  }

  .scene-elements-grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
  }
  .content-card.image-card, .content-card.video-card, .content-card {
    grid-column: span 1 !important;
    width: 100% !important;
  }
  .scene-view-images-grid { grid-template-columns: 1fr !important; }
  .scene-view-videos-grid { grid-template-columns: 1fr !important; }
  .content-type-options { grid-template-columns: 1fr !important; gap: 10px !important; }

  .prompt-compact-bar {
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 8px !important;
  }
  .prompt-compact-bar button {
    flex: 1 !important;
    min-width: 100px !important;
    justify-content: center !important;
  }

  /* 5. ALL MODALS MOBILE RESPONSIVENESS */
  .modal-overlay {
    padding: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .modal-box {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    padding: 1rem !important;
    border-radius: var(--radius-md) !important;
  }
  .modal-box input[type="text"],
  .modal-box input[type="url"],
  .modal-box textarea,
  .form-input, .form-textarea {
    font-size: 16px !important; /* Prevents mobile browser auto-zoom */
  }
  .modal-box div[style*="justify-content: flex-end"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 1.25rem !important;
  }
  .modal-box div[style*="justify-content: flex-end"] button {
    flex: 1 !important;
    min-width: 110px !important;
    justify-content: center !important;
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
  }

  .tasks-notes-modal-box.tn-expanded {
    width: 98vw !important;
    max-width: 98vw !important;
    height: 92vh !important;
    max-height: 92vh !important;
  }

  /* 6. STORIES GALLERY MOBILE */
  .stories-body-container {
    padding: 1rem 0.75rem !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  .stories-grid-container {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    width: 100% !important;
  }
  .story-card {
    width: 100% !important;
    padding: 1rem !important;
  }
  .story-card-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .story-card-actions button {
    flex: 1 !important;
    min-width: 90px !important;
    justify-content: center !important;
  }

  /* 7. SCENE VIEW MOBILE */
  .scene-view-topbar {
    padding: 0.75rem !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.75rem !important; }
  .hero-subtitle { font-size: 0.88rem !important; }
  .nav-brand h1 { font-size: 0.92rem !important; }
  .scene-name-editable { font-size: 1.1rem !important; }
  .btn { padding: 8px 12px !important; font-size: 0.82rem !important; min-height: 38px !important; }
  .story-card-actions { flex-wrap: wrap !important; }
  .story-card-actions button { flex: 1 !important; }
  .hero-actions { flex-direction: column !important; width: 100% !important; }
  .btn-start-hero { width: 100% !important; justify-content: center !important; }
}


/* ---- STORIES GALLERY LIST SCREEN ---- */
.stories-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding-bottom: 2rem;
}

.stories-scroll-wrapper {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-card-solid);
}

.stories-scroll-wrapper::-webkit-scrollbar {
  width: 10px;
}
.stories-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--bg-card-solid);
  border-radius: var(--radius-sm);
}
.stories-scroll-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-card-solid);
}
.stories-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-hover), #0891b2);
}

.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
  backdrop-filter: var(--glass-backdrop);
  position: relative;
  overflow: hidden;
}
.story-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  opacity: 0.7;
  transition: var(--transition);
}
.story-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4), 0 0 15px rgba(99,102,241,0.2);
}
.story-card:hover::before {
  opacity: 1;
  height: 4px;
}

.story-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.story-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.story-card-genre {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  margin-top: 4px;
}

.story-card-stats {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.story-card-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.story-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

/* ---- PROMPT MEDIA CARDS & DUAL COPY BUTTONS ---- */
.prompt-box-wrapper {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.copy-icon-btn, .expand-icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}
.copy-icon-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border-color: rgba(99, 102, 241, 0.5);
}
.expand-icon-btn:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: rgba(6, 182, 212, 0.5);
  color: var(--accent-cyan);
}

.bottom-copy-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-color);
}

.expand-text-scroll-container::-webkit-scrollbar {
  width: 8px;
}
.expand-text-scroll-container::-webkit-scrollbar-track {
  background: rgba(15, 21, 35, 0.8);
  border-radius: 4px;
}
.expand-text-scroll-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
  border-radius: 4px;
}

/* ---- TASKS & NOTES BUTTON (NAV) ---- */
.btn-tasks-notes-trigger {
  position: relative;
  overflow: hidden;
}
.btn-tasks-notes-trigger::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(6,182,212,0.08));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.btn-tasks-notes-trigger:hover::after {
  opacity: 1;
}

/* ---- TASKS & NOTES MODAL ---- */
.tasks-notes-modal-box {
  display: flex;
  flex-direction: column;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state */
.tasks-notes-modal-box.tn-expanded {
  max-width: 90vw !important;
  width: 90vw;
  max-height: 88vh;
  height: 88vh;
}
.tasks-notes-modal-box.tn-expanded .tn-tasks-list {
  max-height: calc(88vh - 260px);
}
.tasks-notes-modal-box.tn-expanded .tn-notes-scroll-wrapper {
  max-height: calc(88vh - 200px);
}
.tasks-notes-modal-box.tn-expanded .tn-notes-textarea {
  min-height: calc(88vh - 220px);
}

/* Header actions (expand + close) */
.tn-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Expand/Collapse Button */
.tn-expand-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.tn-expand-btn:hover {
  background: rgba(16,185,129,0.12);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  transform: scale(1.08);
}

/* Toggle Tabs */
.tn-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.25rem;
  position: relative;
}
.tn-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}
.tn-tab:hover {
  color: var(--text-main);
}
.tn-tab.active {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(6,182,212,0.15));
  color: #fff;
  box-shadow: 0 2px 12px rgba(16,185,129,0.2);
}
.tn-tab.active i {
  color: var(--accent-emerald);
}
.tn-tab i {
  font-size: 0.88rem;
  transition: color 0.25s ease;
}

/* Panels */
.tn-panel {
  display: none;
  flex-direction: column;
  animation: tnFadeIn 0.25s ease;
}
.tn-panel.active {
  display: flex;
}
@keyframes tnFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- TASKS LIST ---- */
.tn-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-emerald) transparent;
}
.tn-tasks-list::-webkit-scrollbar { width: 5px; }
.tn-tasks-list::-webkit-scrollbar-track { background: transparent; }
.tn-tasks-list::-webkit-scrollbar-thumb { background: rgba(16,185,129,0.3); border-radius: 10px; }

/* Single Task Item */
.tn-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.tn-task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-emerald);
  opacity: 0.5;
  transition: all 0.3s ease;
}
.tn-task-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}
.tn-task-item.completed {
  background: rgba(16,185,129,0.05);
  border-color: rgba(16,185,129,0.15);
}
.tn-task-item.completed::before {
  background: var(--accent-emerald);
  opacity: 1;
}

/* Custom Checkbox */
.tn-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  flex-shrink: 0;
  position: relative;
}
.tn-checkbox:hover {
  border-color: var(--accent-emerald);
  background: rgba(16,185,129,0.1);
  transform: scale(1.1);
}
.tn-checkbox.checked {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 12px rgba(16,185,129,0.35);
}
.tn-checkbox.checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.65rem;
  color: #fff;
  animation: tnCheckPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes tnCheckPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Task Text */
.tn-task-text {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.4;
  transition: all 0.3s ease;
  word-break: break-word;
}
.tn-task-item.completed .tn-task-text {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* Task Delete Button */
.tn-task-delete {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  opacity: 0;
  flex-shrink: 0;
}
.tn-task-item:hover .tn-task-delete {
  opacity: 1;
}
.tn-task-delete:hover {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}

/* Task Input Row */
.tn-task-input-row {
  margin-bottom: 8px;
}
.tn-task-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #fff;
  font-size: 0.92rem;
  width: 100%;
  transition: all 0.25s ease;
}
.tn-task-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
  outline: none;
}
.tn-task-input::placeholder {
  color: var(--text-dim);
}

/* Empty State */
.tn-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-dim);
}
.tn-empty-state i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: rgba(16,185,129,0.3);
}
.tn-empty-state p {
  font-size: 0.85rem;
  max-width: 250px;
}

/* ---- NOTES SCROLL WRAPPER ---- */
.tn-notes-scroll-wrapper {
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-cyan) transparent;
  flex: 1;
}
.tn-notes-scroll-wrapper::-webkit-scrollbar { width: 5px; }
.tn-notes-scroll-wrapper::-webkit-scrollbar-track { background: transparent; }
.tn-notes-scroll-wrapper::-webkit-scrollbar-thumb { background: rgba(6,182,212,0.3); border-radius: 10px; }

/* ---- NOTES TEXTAREA ---- */
.tn-notes-textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  padding: 16px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.tn-notes-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.12);
}
.tn-notes-textarea::placeholder {
  color: var(--text-dim);
}
