/**
 * My A2O - Master Design System
 * Prestigious luxury dark academic aesthetic
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800;900&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ========================================================
   DESIGN TOKENS (Single dark theme)
   ======================================================== */
:root {
  --bg-main: #090c10;
  --bg-surface: #111622;
  --bg-card: #151b29;
  --bg-card-header: #192030;
  --bg-input: #0c1018;

  --gold-primary: #c5a059;
  --gold-light: #e8c67c;
  --gold-dark: #997839;
  --gold-gradient: linear-gradient(135deg, #f6dc9c 0%, #c5a059 50%, #94712d 100%);
  --gold-border: rgba(197, 160, 89, 0.32);
  --gold-glow: rgba(197, 160, 89, 0.22);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-gold: #e8c67c;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --nav-bg: rgba(9, 12, 16, 0.94);
  --modal-bg: #111622;
  --card-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(197, 160, 89, 0.12);
  --shadow-gold: 0 4px 20px rgba(197, 160, 89, 0.35);

  --font-serif: 'Cinzel', 'Georgia', serif;
  --font-editorial: 'Cormorant Garamond', 'Georgia', serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  background-color: var(--bg-main) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================
   2. TOP NAVIGATION BAR
   ======================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--gold-border);
  height: 72px;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.nav-container {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-frame {
  width: 32px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.brand-logo:hover .brand-logo-frame {
  transform: scale(1.06);
}

.brand-logo-img {
  width: 32px !important;
  height: 42px !important;
  max-width: 32px !important;
  max-height: 42px !important;
  object-fit: contain !important;
  display: block;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.brand-title .gold-accent {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--gold-primary);
}

.nav-link-external {
  color: var(--gold-primary);
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
}

[data-theme="light"] .nav-link-external {
  background: rgba(122, 84, 22, 0.1);
}

.nav-link-external:hover {
  background: var(--gold-gradient);
  color: #0c0f14 !important;
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}


/* User Profile Navbar State */
.user-profile-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #0c0f14;
}

.user-email-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-nav-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.btn-nav-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Form Error Alert */
.form-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-alert-error::before {
  content: '⚠️';
  font-size: 14px;
}

/* Pill Buttons */
.btn-gold-pill {
  background: var(--gold-gradient);
  color: #0c0f14;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
  transition: var(--transition-smooth);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-gold-pill:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-secondary-dark {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--gold-border);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary-dark:hover {
  border-color: var(--gold-primary);
  background: rgba(197, 160, 89, 0.12);
  color: var(--gold-primary);
}

/* ========================================================
   3. CENTER STUDENT LOGIN PAGE (Before Login)
   ======================================================== */
.main-wrapper {
  flex-grow: 1;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 80px 24px;
}

.center-login-wrapper {
  max-width: 480px;
  margin: 30px auto;
  width: 100%;
}

.center-login-card {
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.center-login-emblem {
  width: 48px;
  height: 60px;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-login-emblem img {
  width: 48px !important;
  height: 60px !important;
  object-fit: contain !important;
}

.center-login-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.center-login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.login-footer-links {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-link-btn {
  background: transparent;
  border: none;
  color: var(--gold-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  transition: var(--transition-smooth);
}

.login-link-btn:hover {
  color: var(--text-primary);
}

/* ========================================================
   4. UNLOCKED EBOOK LIBRARY (After Login)
   ======================================================== */
.library-hero-header {
  margin-bottom: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 24px;
}

.library-title-group h1 {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.8vw, 38px);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.library-title-group h1 .gold-accent {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.library-user-welcome {
  color: var(--text-secondary);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.library-user-welcome strong {
  color: var(--gold-primary);
}

.library-unlocked-badge {
  background: rgba(197, 160, 89, 0.14);
  border: 1px solid var(--gold-border);
  color: var(--gold-primary);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* User Books Grid */
.user-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 28px;
}

.purchased-book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.purchased-book-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.18), 0 0 25px var(--gold-glow);
}

.book-card-header {
  background: var(--bg-card-header);
  padding: 24px 20px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.part-badge {
  background: var(--bg-main);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: 1px;
}

.status-unlocked-tag {
  color: #10b981;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.book-cover-mockup {
  background: linear-gradient(145deg, #fdfbf7 0%, #f1ece1 100%);
  border-radius: 6px 12px 12px 6px;
  padding: 20px 16px;
  color: #1e293b;
  border-left: 6px solid var(--gold-primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.14);
  position: relative;
  overflow: hidden;
}

.mini-cover-logo {
  width: 24px !important;
  height: 32px !important;
  object-fit: contain !important;
  margin-bottom: 6px;
}

.cover-title-text {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 4px;
}

.cover-sub-text {
  font-size: 11px;
  color: #475569;
  line-height: 1.3;
}

.cover-ornament {
  font-size: 11px;
  color: var(--gold-dark);
  margin-top: 8px;
}

.book-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-kicker-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.book-card-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0 12px 0;
}

.book-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
}

.book-feature-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  flex-grow: 1;
}

.book-feature-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.bullet-check {
  color: var(--gold-primary);
  font-weight: 700;
}

.book-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-open-reader {
  width: 100%;
}

.btn-primary-gold {
  background: var(--gold-gradient);
  color: #0c0f14;
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-gold);
  text-decoration: none;
}

.btn-primary-gold:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.reader-meta-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Card for Store Promotion (Explore More Guides) */
.store-promo-card {
  background: var(--bg-surface);
  border: 1px dashed var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.promo-logo-img {
  width: 40px !important;
  height: 52px !important;
  object-fit: contain !important;
  margin-bottom: 14px;
}

.store-promo-card h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.store-promo-card p {
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 320px;
  margin-bottom: 20px;
}

/* ========================================================
   5. MODALS (Login & Checkout Simulator)
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 6, 9, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--modal-bg);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 30px var(--gold-glow);
  overflow: hidden;
  position: relative;
}

.modal-dialog-large {
  max-width: 640px;
}

.modal-header {
  padding: 22px 28px 18px 28px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 28px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-glow);
}

.form-alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Quick Demo Chips */
.demo-accounts-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.demo-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.demo-chips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-user-chip {
  background: var(--bg-input);
  border: 1px solid var(--gold-border);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.demo-user-chip:hover {
  background: rgba(197, 160, 89, 0.12);
  border-color: var(--gold-primary);
}

.demo-chip-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.demo-chip-books {
  font-size: 10px;
  color: var(--gold-primary);
}

/* Simulator Checkbox Grid */
.sim-books-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.sim-book-choice {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sim-book-choice input[type="checkbox"] {
  accent-color: var(--gold-primary);
  width: 16px;
  height: 16px;
}

.sim-presets-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.btn-preset-checkout {
  background: var(--bg-input);
  border: 1px solid var(--gold-border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-preset-checkout:hover {
  color: var(--gold-primary);
  border-color: var(--gold-primary);
  background: rgba(197, 160, 89, 0.1);
}

.sim-success-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid #10b981;
  color: #d1fae5;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
}

[data-theme="light"] .sim-success-box {
  color: #065f46;
}

.sim-success-header {
  color: #10b981;
  font-size: 14px;
  margin-bottom: 6px;
}

.sim-alert-footer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gold-primary);
}

.form-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.form-alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 18px;
}

/* Utilities */
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .user-books-grid {
    grid-template-columns: 1fr;
  }
  .demo-chips-grid, .sim-books-selector {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   GOOGLE SIGN-IN BUTTON & DIVIDER
   ======================================================== */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.login-divider-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-google-signin {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  letter-spacing: 0.2px;
}

.btn-google-signin:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.btn-google-signin:active:not(:disabled) {
  transform: translateY(0);
}

.btn-google-signin:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
