/* Writer Bro — style.css */

:root {
  --bg: #0f0e0d;
  --surface: #1a1917;
  --surface2: #242220;
  --surface3: #2e2b28;
  --border: #3a3733;
  --accent: #e8a048;
  --accent2: #c97d2a;
  --text: #e8e4de;
  --text-dim: #9a9288;
  --text-faint: #5a5550;
  --scene: #f0c060;
  --action: #d4cfc8;
  --character: #7eb8d4;
  --dialogue: #b8d4a0;
  --transition: #d4a0b8;
  --parenthetical: #c8b894;
  --paper: #faf8f4;
  --paper-border: #e0dbd4;
  --ink: #1a1814;
  --ink-dim: #5a5550;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.topbar-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

.title-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Noto Sans Kannada', 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  width: 220px;
}
.title-input::placeholder { color: var(--text-faint); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 500; }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: var(--bg); }

/* ── WORKSPACE ── */
.workspace { display: flex; flex: 1; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 210px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.scene-list { flex: 1; overflow-y: auto; padding: 8px 0; }

.scene-item {
  padding: 7px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.12s;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Noto Sans Kannada', sans-serif;
}
.scene-item:hover { background: var(--surface2); color: var(--text); }
.scene-item.active { border-left-color: var(--accent); background: var(--surface2); color: var(--accent); }

.scene-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  margin-right: 6px;
}

.sidebar-bottom { border-top: 1px solid var(--border); padding: 10px; }

.kannada-note {
  background: rgba(232,160,72,0.07);
  border: 1px solid rgba(232,160,72,0.18);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 10px;
  color: var(--accent);
  line-height: 1.5;
}

/* ── EDITOR AREA ── */
.editor-area {
  flex: 1;
  overflow-y: auto;
  background: #28261f;
  display: flex;
  justify-content: center;
  padding: 40px 24px;
}

.script-page {
  width: 100%;
  max-width: 680px;
  background: var(--paper);
  box-shadow: 0 4px 48px rgba(0,0,0,0.55);
  border-radius: 2px;
  padding: 72px 80px;
  min-height: 920px;
}

.page-header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--paper-border);
}

.page-title {
  font-family: 'Noto Sans Kannada', 'Playfair Display', serif;
  font-size: 22px;
  color: var(--ink);
  outline: none;
  text-align: center;
  width: 100%;
  border: none;
  background: transparent;
  margin-bottom: 6px;
  display: block;
}

.page-subtitle {
  font-size: 12px;
  color: var(--ink-dim);
  outline: none;
  text-align: center;
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  display: block;
}

/* ── SCRIPT BLOCKS ── */
.script-block {
  position: relative;
  margin-bottom: 2px;
  border-radius: 2px;
  transition: background 0.1s;
}

.script-block:focus-within { background: rgba(0,0,0,0.025); }

.block-badge {
  position: absolute;
  right: -90px;
  top: 4px;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  pointer-events: none;
}
.script-block:focus-within .block-badge { opacity: 1; }

.block-scene      .block-badge { background:#fff8e0; color:#8a6010; border:1px solid #e8c840; }
.block-action     .block-badge { background:#f0ede8; color:#5a5248; border:1px solid #d0ccc4; }
.block-character  .block-badge { background:#e8f4f8; color:#2a6080; border:1px solid #90c8e0; }
.block-dialogue   .block-badge { background:#eef4e8; color:#3a6020; border:1px solid #a0c880; }
.block-transition .block-badge { background:#f8eff4; color:#703050; border:1px solid #d090b0; }
.block-parenthetical .block-badge { background:#f8f4ec; color:#6a5a30; border:1px solid #c8b870; }

.block-content {
  outline: none;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.65;
  resize: none;
  overflow: hidden;
  min-height: 24px;
  caret-color: var(--ink);
  padding: 2px 0;
  color: var(--ink);
  font-family: 'Noto Sans Kannada', 'Courier New', monospace;
}

.block-scene .block-content {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 12px;
  border-bottom: 1px solid var(--paper-border);
  padding-bottom: 5px;
  margin-bottom: 3px;
  color: #111;
}

.block-action .block-content { color: #2a2620; }

.block-character .block-content {
  font-weight: 700;
  text-align: center;
  font-size: 12px;
  margin-left: 30%;
  width: 40%;
  letter-spacing: 0.04em;
  color: #111;
  text-transform: uppercase;
}

.block-dialogue .block-content {
  margin-left: 18%;
  width: 64%;
  color: #2a2620;
}

.block-parenthetical .block-content {
  color: #5a5048;
  margin-left: 25%;
  width: 50%;
  font-style: italic;
  font-size: 12px;
}

.block-transition .block-content {
  font-weight: 700;
  text-align: right;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #111;
}

/* ── RIGHT PANEL ── */
.block-panel {
  width: 175px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-header {
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.block-types { padding: 8px; display: flex; flex-direction: column; gap: 3px; }

.block-type-btn {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
  font-family: 'DM Sans', sans-serif;
}
.block-type-btn:hover { background: var(--surface2); }
.block-type-btn.active { background: var(--surface3); border-color: var(--border); }

.bt-label { font-size: 11px; font-weight: 500; display: block; }
.bt-hint  { font-size: 9px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; margin-top: 2px; display: block; }

.bt-scene         .bt-label { color: var(--scene); }
.bt-action        .bt-label { color: var(--action); }
.bt-character     .bt-label { color: var(--character); }
.bt-dialogue      .bt-label { color: var(--dialogue); }
.bt-transition    .bt-label { color: var(--transition); }
.bt-parenthetical .bt-label { color: var(--parenthetical); }

.panel-footer-hint {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px;
}

.hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.hint-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── FOOTBAR ── */
.footbar {
  height: 28px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 20px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.foot-item { display: flex; align-items: center; gap: 5px; }
.foot-dot  { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── OVERLAYS ── */
.shortcut-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.shortcut-overlay.visible { display: flex; }

.shortcut-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.shortcut-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 16px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 12px;
  margin-bottom: 4px;
}

.sc-key {
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
  color: var(--accent);
  font-size: 10px;
  white-space: nowrap;
  align-self: center;
}
.sc-desc { color: var(--text-dim); align-self: center; font-size: 12px; }
.close-btn { margin-top: 16px; width: 100%; }

/* Saved scripts list */
.saved-script-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
}
.saved-script-item:hover { border-color: var(--accent); }
.saved-script-name { color: var(--text); font-size: 13px; font-family: 'Noto Sans Kannada', sans-serif; }
.saved-script-date { color: var(--text-faint); font-size: 10px; font-family: 'JetBrains Mono', monospace; }
.saved-script-del { color: var(--text-faint); font-size: 16px; padding: 0 4px; cursor: pointer; }
.saved-script-del:hover { color: #e06060; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── PRINT ── */
@media print {
  .topbar, .sidebar, .block-panel, .footbar, .shortcut-overlay { display: none !important; }
  .editor-area { background: white; padding: 0; display: block; }
  .script-page { box-shadow: none; max-width: 100%; padding: 40px 60px; min-height: auto; }
  .block-badge { display: none !important; }
  body { overflow: auto; height: auto; }
  .workspace { display: block; height: auto; overflow: visible; }
}