/* app.css — Planner Builder UI Shell */
:root {
  --bg-primary:    #06182d;
  --bg-secondary:  #0b2139;
  --bg-elevated:   #0f2d4a;
  --bg-deep:       #040f1c;
  --teal-bright:   #5ce5d3;
  --teal-primary:  #3eccbe;
  --teal-mid:      #2db8b0;
  --teal-deep:     #149aa6;
  --blue-mid:      #4fb9cf;
  --text-primary:  #ffffff;
  --text-secondary:#e6edf5;
  --text-muted:    #7a96b0;
  --border:        #0f2d4a;
  --border-bright: #1a4060;
  --danger:        #ff5f57;
  --warn:          #febc2e;
  --success:       #28c840;
}

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

body {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── HEADER ── */
#header {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-bright);
  padding: 0 16px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sigma {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--teal-bright);
  letter-spacing: 1px;
}

.brand-dot {
  width: 4px;
  height: 4px;
  background: var(--teal-mid);
  border-radius: 50%;
}

.brand-tool {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin-left: 10px;
}

.build-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: var(--teal-bright);
  border: none;
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.build-btn:hover { background: var(--teal-primary); transform: translateY(-1px); }
.build-btn:active { transform: translateY(0); }
.build-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ── MAIN LAYOUT ── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── LEFT SIDEBAR ── */
#sidebar-left {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-bright);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px;
}

.sidebar-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.lib-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--teal-mid);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.lib-card {
  background: rgba(15, 45, 74, 0.5);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  overflow: hidden;
  position: relative;
}
.lib-card:hover {
  border-color: rgba(92, 229, 211, 0.35);
  box-shadow: 0 4px 16px rgba(4, 12, 24, 0.6), 0 0 12px rgba(92, 229, 211, 0.06);
  transform: translateY(-1px);
}

.lib-thumb {
  height: 100px;
  overflow: hidden;
  padding: 4px;
  position: relative;
}

.lib-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.lib-icon { font-size: 12px; }

.lib-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.lib-add {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal-bright);
  color: var(--bg-deep);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.lib-card:hover .lib-add { opacity: 1; }
.lib-add:hover { transform: scale(1.15); }

/* ── CENTER PREVIEW ── */
#center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  overflow: hidden;
  background: var(--bg-primary);
}

#preview-area {
  flex: 1;
  width: 100%;
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-page {
  width: 380px;
  height: 492px;  /* 612:792 ratio */
  background: #ffffff;
  box-shadow:
    0 20px 60px rgba(4, 12, 24, 0.5),
    0 8px 20px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  transform: perspective(1000px) rotateY(-2deg);
  transition: transform 0.3s ease;
}
.preview-page:hover {
  transform: perspective(1000px) rotateY(0deg);
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}
.preview-empty-icon { font-size: 48px; opacity: 0.3; }
.preview-empty-text { font-size: 13px; max-width: 220px; line-height: 1.5; }

/* Navigation */
#preview-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.nav-arrow {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.nav-arrow:hover { border-color: var(--teal-mid); color: var(--teal-bright); }

#page-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  min-width: 100px;
  text-align: center;
}

/* Page strip */
#page-strip {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding: 4px 0;
  max-width: 100%;
}

.strip-thumb {
  width: 46px;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.strip-thumb.active {
  border-color: var(--teal-bright);
  box-shadow: 0 0 8px rgba(92, 229, 211, 0.25);
}
.strip-thumb:hover { border-color: var(--teal-mid); }

.strip-thumb-inner {
  width: 100%;
  height: 100%;
  transform: scale(0.3);
  transform-origin: top left;
  width: 333%;
  height: 333%;
  pointer-events: none;
  overflow: hidden;
}

/* ── RIGHT SIDEBAR ── */
#sidebar-right {
  width: 250px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-bright);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.settings-input {
  width: 100%;
  background: rgba(15, 45, 74, 0.6);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.settings-input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 2px rgba(92, 229, 211, 0.1);
}

.settings-input-sm {
  width: 80px;
  text-align: center;
}

/* Theme picker */
#theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  border: 2px solid transparent;
}
.theme-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.theme-swatch.active {
  box-shadow: 0 0 0 3px rgba(92, 229, 211, 0.3);
}

#theme-name {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  min-height: 16px;
}

/* Build list */
#build-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.build-list-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 10px;
  font-style: italic;
}

.build-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(15, 45, 74, 0.4);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: grab;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.build-item:hover { border-color: var(--border-bright); background: rgba(15, 45, 74, 0.7); }
.build-item.dragging { opacity: 0.4; }
.build-item.drag-over { border-color: var(--teal-bright); border-style: dashed; }

.build-grip {
  color: var(--text-muted);
  font-size: 10px;
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.4;
}

.build-label {
  flex: 1;
  font-size: 11px;
  color: var(--text-secondary);
}

.build-move {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 8px;
  cursor: pointer;
  padding: 2px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.build-move:hover { opacity: 1; color: var(--teal-bright); }
.build-move:disabled { opacity: 0.2; cursor: default; }

.build-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.build-remove:hover { opacity: 1; }

/* Page count */
#page-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

/* Build footer */
.build-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.build-footer .build-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

/* ── EMAIL MODAL ── */
.email-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 24, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.email-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.email-modal h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.email-modal p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 45, 74, 0.6);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.email-input:focus {
  border-color: var(--teal-mid);
}

.email-submit {
  padding: 10px;
  background: var(--teal-bright);
  color: var(--bg-deep);
  border: none;
  border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
}
.email-submit:hover { background: var(--teal-primary); }

.email-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  margin-top: 12px;
  text-decoration: underline;
  opacity: 0.6;
}
.email-skip:hover { opacity: 1; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-deep); }
