/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { overflow-x: hidden; }

body {
  background: #0d0f13;
  font-family: "DM Sans", sans-serif;
  color: #fff;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Login ── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo {
  font-size: 28px;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 28px;
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#login-form input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}
#login-form input:focus {
  border-color: rgba(0,201,167,0.4);
}
#login-form input::placeholder {
  color: rgba(255,255,255,0.3);
}
.login-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 12px;
}

#create-account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
#create-account-form input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}
#create-account-form input:focus {
  border-color: rgba(0,201,167,0.4);
}
#create-account-form input::placeholder {
  color: rgba(255,255,255,0.3);
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 19, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #00c9a7, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  max-width: 140px;
}
.account-select option {
  background: #1a1d24;
  color: #fff;
}
.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.btn-logout:hover { color: rgba(255,255,255,0.6); }
.nav { display: flex; gap: 4px; }
.nav-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover {
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
}
.nav-btn.active {
  background: rgba(0, 201, 167, 0.08);
  border-color: rgba(0, 201, 167, 0.2);
  color: #00e8c0;
}

/* ── Layout ── */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ── Screens ── */
.screen { display: none; animation: fadeUp 0.3s ease; }
.screen.active { display: block; }

.screen-header {
  padding: 24px 0 16px;
}
.screen-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.step-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00e8c0;
  margin-bottom: 4px;
  display: block;
}

/* ── Slot Header Row ── */
.slot-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Back Button ── */
.back-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  transition: color 0.2s;
}
.back-btn:hover { color: #00e8c0; }

/* ── Template Cards ── */
.template-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.template-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
  color: #fff;
  width: 100%;
}
.template-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}
.template-card:active {
  background: linear-gradient(135deg, rgba(0,201,167,0.08), rgba(0,212,255,0.05));
  border-color: rgba(0,201,167,0.3);
}
.template-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  flex-shrink: 0;
}
.template-info { flex: 1; }
.template-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
.template-info p {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.template-slides {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Slot Progress ── */
.slot-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00e8c0;
  background: rgba(0,201,167,0.1);
  padding: 3px 8px;
  border-radius: 4px;
}
.slot-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  font-family: "JetBrains Mono", monospace;
}

/* ── Prior Selections ── */
.prior-selections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.prior-pill {
  font-size: 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
  color: rgba(255,255,255,0.5);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prior-pill .prior-label {
  color: rgba(255,255,255,0.25);
  margin-right: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
}

/* ── Options ── */
.options-container {
  min-height: 200px;
}
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  color: rgba(255,255,255,0.8);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeUp 0.25s ease both;
}
.option-btn:nth-child(1) { animation-delay: 0.00s; }
.option-btn:nth-child(2) { animation-delay: 0.04s; }
.option-btn:nth-child(3) { animation-delay: 0.08s; }
.option-btn:nth-child(4) { animation-delay: 0.12s; }
.option-btn:nth-child(5) { animation-delay: 0.16s; }

.option-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}
.option-btn:active {
  background: linear-gradient(135deg, rgba(0,201,167,0.1), rgba(0,212,255,0.06));
  border-color: rgba(0,201,167,0.4);
  color: #00e8c0;
}
.option-meta {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 4px;
}

/* ── Loading ── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
}
.loading-spinner.hidden { display: none; }
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.06);
  border-top-color: #00e8c0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Error ── */
.options-error {
  text-align: center;
  padding: 32px 0;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}
.options-error p { margin-bottom: 12px; }

/* ── Slot Actions ── */
.slot-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

/* ── Buttons ── */
.btn-primary {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #00c9a7, #00b4d8);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #0d0f13;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.8);
}

/* ── Preview Header Row ── */
.preview-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.preview-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Toggle ── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  user-select: none;
}
.toggle-label input { display: none; }
.toggle-track {
  width: 34px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  transition: all 0.2s;
}
.toggle-label input:checked + .toggle-track {
  background: rgba(0,201,167,0.3);
}
.toggle-label input:checked + .toggle-track::after {
  left: 18px;
  background: #00e8c0;
}

/* ── Image Controls ── */
.image-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.image-controls .btn-secondary {
  font-size: 12px;
  padding: 5px 12px;
}
.image-controls .btn-slide-nav {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

/* ── Slide Preview ── */
.slide-preview {
  margin-bottom: 20px;
}
.slide-preview canvas {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.slide-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}
.btn-slide-nav {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  font-family: inherit;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-slide-nav:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.btn-slide-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.slide-dots {
  display: flex;
  gap: 6px;
}
.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: all 0.2s;
}
.slide-dot.active {
  background: #00e8c0;
}

/* ── Review Actions ── */
.review-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.review-actions .btn-secondary {
  flex-shrink: 0;
}
.review-actions .btn-primary {
  flex: 1;
}

/* ── Review ── */
.review-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.review-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
}
.review-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00e8c0;
  margin-bottom: 6px;
}
.review-card-text {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  margin: -6px -8px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  field-sizing: content;
}
.review-card-text:hover {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
}
.review-card-text:focus {
  border-color: rgba(0,201,167,0.3);
  background: rgba(255,255,255,0.04);
}

/* ── Library ── */
.library-filters {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}
.filter-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
}
.filter-btn.active {
  background: rgba(0,201,167,0.08);
  border-color: rgba(0,201,167,0.2);
  color: #00e8c0;
}

.library-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.2s;
  animation: fadeUp 0.25s ease both;
}
.library-item:hover {
  border-color: rgba(255,255,255,0.15);
}
.library-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.library-item-kind {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00e8c0;
  background: rgba(0,201,167,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.library-item-status {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-weight: 500;
}
.library-item-status.scheduled { color: #00d4ff; }
.library-item-status.posted { color: #00e8c0; }

.library-item-preview {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.library-item-date {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
}

.library-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.library-item-actions button {
  font-size: 11px;
  padding: 4px 10px;
}

.empty-state {
  text-align: center;
  padding: 48px 0;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
}


/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1d24;
  border: 1px solid rgba(0,201,167,0.3);
  color: #00e8c0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
