:root {
  --bg-parchment: #fdfbf7;
  --bg-card: #ffffff;
  --bg-night: #181f33;
  --bg-night-accent: #232c45;
  --text-dark: #272d3b;
  --text-muted: #64748b;
  --gold-accent: #d4a373;
  --gold-bright: #e9c46a;
  --border-subtle: #eeddc9;
  --shadow-warm: 0 4px 20px -2px rgba(45, 35, 20, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-parchment);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-serif {
  font-family: "Georgia", "Cambria", serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  font-family: "Georgia", serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--bg-night);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-dark);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--gold-accent);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background-color: var(--bg-night);
  color: #fff;
  border: 1px solid var(--bg-night);
}

.btn-primary:hover {
  background-color: var(--bg-night-accent);
  box-shadow: 0 4px 12px rgba(24, 31, 51, 0.2);
}

.btn-gold {
  background-color: var(--gold-bright);
  color: #1a1a1a;
}

.btn-gold:hover {
  background-color: #dfb657;
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--text-dark);
}

.btn-outline:hover {
  border-color: var(--text-dark);
  background: #f8fafc;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-warm);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active { background: #dcfce7; color: #166534; }
.badge-trial { background: #fef3c7; color: #92400e; }
.badge-night { background: #e2e8f0; color: #1e293b; }

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  background-color: #fff;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--bg-night);
}

.form-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Reader Mode */
.reader-container {
  max-width: 680px;
  margin: 40px auto;
  background: #ffffff;
  padding: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.story-text p {
  font-family: "Georgia", serif;
  font-size: 19px;
  line-height: 1.85;
  margin-bottom: 1.4em;
  color: #24292e;
}

/* ==========================================================================
   Parent Dashboard Redesign (Phase 4)
   ========================================================================== */

/* Header Navigation */
.nav-link-main {
  color: var(--bg-night);
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;
}
.nav-link-secondary {
  color: #4b5563;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.nav-link-secondary:hover {
  color: var(--bg-night);
  background: #f3ece4;
}
.nav-link-subtle {
  color: #8c9ba5;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
}
.nav-link-subtle:hover {
  color: #475569;
}

/* Level 1: Tonight's Story Hero Card */
.dashboard-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.story-header-area {
  margin-bottom: 28px;
  text-align: left;
}

.story-supertitle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #925828;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.story-main-title {
  font-size: 38px;
  line-height: 1.25;
  color: var(--bg-night);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.story-subtitle {
  font-size: 17px;
  color: #64748b;
  line-height: 1.5;
}

.tonight-hero-card {
  background: #ffffff;
  border: 1px solid #ebd9c8;
  border-radius: 16px;
  padding: 36px 36px 30px;
  box-shadow: 0 10px 30px -4px rgba(45, 35, 20, 0.08);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.tonight-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #d4a373, #e9c46a, #232c45);
}

.tonight-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.tonight-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #854d0e;
  background: #fef3c7;
  padding: 5px 12px;
  border-radius: 20px;
}

.chapter-number-pill {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
}

.tonight-title {
  font-size: 28px;
  color: #1e293b;
  margin-bottom: 16px;
  line-height: 1.3;
}

.tonight-preview-box {
  background: #faf8f5;
  border-left: 3px solid #d4a373;
  padding: 18px 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 28px;
}

.tonight-preview-text {
  font-family: "Georgia", serif;
  font-size: 16px;
  line-height: 1.7;
  color: #475569;
  font-style: italic;
  margin: 0;
}

.tonight-cta-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-tonight-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--bg-night);
  color: #ffffff !important;
  font-size: 18px;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 6px 16px rgba(24, 31, 51, 0.25);
  text-align: center;
}

.btn-tonight-primary:hover {
  background-color: #273352;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(24, 31, 51, 0.32);
}

.delivery-schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #f1e5d8;
  font-size: 14px;
  color: #64748b;
  flex-wrap: wrap;
  gap: 8px;
}

.delivery-time-text {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
}

.btn-text-subtle {
  background: none;
  border: none;
  color: #925828;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.btn-text-subtle:hover {
  color: #6f3e15;
}

/* Level 2: Trial Continuation Card */
.continuation-card {
  background: #fbf7ee;
  border: 1px solid #e7d8be;
  border-radius: 12px;
  padding: 22px 28px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.continuation-title {
  font-family: "Georgia", serif;
  font-size: 18px;
  color: #1e293b;
  font-weight: 600;
  margin-bottom: 4px;
}

.continuation-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

.continuation-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-continue-story {
  background: #d4a373;
  color: #1a1a1a !important;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-continue-story:hover {
  background: #c38f5f;
}

.continuation-price {
  font-size: 13px;
  color: #78716c;
  font-weight: 500;
}

/* Level 3: The Story So Far */
.story-so-far-section {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-warm);
}

.section-label {
  font-family: "Georgia", serif;
  font-size: 20px;
  color: var(--bg-night);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-so-far-body {
  font-family: "Georgia", serif;
  font-size: 16px;
  line-height: 1.8;
  color: #cbd5e1;
  margin: 0;
}

/* Level 4: Story Library (Previous Chapters) */
.story-library-section {
  margin-bottom: 40px;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-header-title {
  font-family: "Georgia", serif;
  font-size: 22px;
  color: var(--bg-night);
  font-weight: 600;
  margin: 0;
}

.section-header-subtitle {
  font-size: 13px;
  color: #94a3b8;
}

.story-library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chapter-library-item {
  display: block;
  background: #ffffff;
  border: 1px solid #ebd9c8;
  border-radius: 10px;
  padding: 16px 20px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(45, 35, 20, 0.03);
}

.chapter-library-item:hover {
  border-color: #d4a373;
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(45, 35, 20, 0.07);
}

.chapter-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.chapter-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-badge-num {
  font-size: 13px;
  font-weight: 700;
  color: #925828;
  background: #fbf5ee;
  border: 1px solid #ebd9c8;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.chapter-item-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.chapter-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-relative-tag {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.chapter-read-cta {
  font-size: 13px;
  font-weight: 600;
  color: #925828;
}

.chapter-item-snippet {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 2px;
}

/* Level 5: Story Friends */
.story-friends-section {
  margin-bottom: 40px;
}

.story-friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.friend-card {
  background: #ffffff;
  border: 1px solid #ebd9c8;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(45, 35, 20, 0.04);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fae8c8 100%);
  border: 2px solid #ecd8c5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #925828;
  flex-shrink: 0;
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.friend-role {
  font-size: 12px;
  font-weight: 600;
  color: #925828;
  text-transform: capitalize;
  margin-bottom: 6px;
}

.friend-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

/* Level 6: Profile & Settings Footer Controls */
.dashboard-controls-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid #eeddc9;
  margin-top: 20px;
  flex-wrap: wrap;
}

.control-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #d5c3b1;
  color: #475569;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.control-link-btn:hover {
  border-color: var(--bg-night);
  color: var(--bg-night);
  background: #faf8f5;
}

/* Accessible Modal Overlay / Drawer */
.bs-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(6, 10, 24, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.bs-modal-overlay.active {
  display: flex;
}

.bs-modal-dialog {
  background: linear-gradient(180deg, #17203d 0%, #0f1629 100%);
  color: #f8fafc;
  border: 1px solid rgba(246, 197, 98, 0.35);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(246, 197, 98, 0.08);
  padding: 30px;
  position: relative;
  z-index: 1001;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.bs-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(246, 197, 98, 0.2);
  padding-bottom: 16px;
}

.bs-modal-title {
  font-family: "Lora", Georgia, serif;
  font-size: 22px;
  color: #fefae0;
  font-weight: 600;
  margin: 0;
}

.bs-modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.bs-modal-close:hover {
  color: #f6c562;
  background: rgba(246, 197, 98, 0.15);
  border-color: rgba(246, 197, 98, 0.4);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .dashboard-wrapper {
    padding: 24px 16px 60px;
  }
  .story-main-title {
    font-size: 28px;
  }
  .tonight-hero-card {
    padding: 24px 20px;
  }
  .tonight-title {
    font-size: 22px;
  }
  .btn-tonight-primary {
    font-size: 16px;
    padding: 14px 20px;
  }
  .continuation-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }
  .continuation-action {
    width: 100%;
    justify-content: space-between;
  }
  .story-friends-grid {
    grid-template-columns: 1fr;
  }
  .chapter-item-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .chapter-item-meta {
    align-self: flex-start;
    margin-top: 2px;
  }
  .reader-container {
    margin: 16px auto;
    padding: 24px 16px;
    border-radius: 10px;
  }
  .story-text p {
    font-size: 17.5px;
    line-height: 1.75;
  }
}

