/* Custom Styles & Overrides for MyNovelList / SastraArchive */

:root {
  --primary: #142839;
  --primary-container: #2b3e50;
  --on-primary: #ffffff;
  --on-primary-container: #95a9be;
  --secondary: #855300;
  --secondary-container: #fea619;
  --secondary-gold: #f59e0b;
  --background: #fbfbfa;
  --surface: #f9f9f8;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f3f4f3;
  --surface-container: #eeeeed;
  --surface-container-high: #e8e8e7;
  --outline: #d8d8d8;
  --outline-variant: #c4c7cc;
  --on-surface: #1a1c1c;
  --on-surface-variant: #43474c;
}

body {
  background-color: var(--background);
  color: var(--on-surface);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[data-profile-theme="ocean"] { --primary: #124559; --primary-container: #1d6b87; --secondary-container: #55c2da; }
body[data-profile-theme="forest"] { --primary: #244b36; --primary-container: #356b4b; --secondary-container: #a8d08d; }
body[data-profile-theme="sunset"] { --primary: #6d3340; --primary-container: #924e58; --secondary-container: #f4a261; }

/* Material Symbols configuration */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

.filled-icon {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Typography styles */
.font-merriweather {
  font-family: 'Merriweather', Georgia, serif;
}

/* Data table utilities */
.data-table-header {
  background-color: #2b3e50;
  color: #ffffff;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-row-alternate:nth-child(even) {
  background-color: #f7f7f6;
}

.table-row-alternate:nth-child(odd) {
  background-color: #ffffff;
}

.table-row-alternate:hover {
  background-color: #f0f4f8;
}

/* Line clamps */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Custom transitions */
.fade-in {
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f0;
}

::-webkit-scrollbar-thumb {
  background: #c4c7cc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #95a9be;
}

/* Hide scrollbar helper */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.auth-modal {
  background: rgba(15, 31, 46, .58);
  backdrop-filter: blur(5px);
  animation: authFadeIn .2s ease-out;
}
.auth-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  animation: authSlideUp .25s ease-out;
}
.auth-eyebrow { color: var(--secondary); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 3px; }
.auth-close { color: var(--on-surface-variant); font-size: 25px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.auth-close:hover { background: var(--surface-container-low); color: var(--primary); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 20px 24px; padding: 4px; background: var(--surface-container-low); border-radius: 10px; }
.auth-tab { border: 0; border-radius: 8px; padding: 9px; color: var(--on-surface-variant); font-size: 13px; font-weight: 700; }
.auth-tab:hover, .auth-tab.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(20,40,57,.12); }
.auth-submit:hover { background: var(--secondary-gold); transform: translateY(-1px); }
.auth-input { width: 100%; border: 1px solid var(--outline-variant); border-radius: 9px; padding: 11px 12px; font-size: 13px; outline: none; transition: border-color .2s, box-shadow .2s; }
.auth-input:focus { border-color: var(--secondary-gold); box-shadow: 0 0 0 3px rgba(254,166,25,.2); }
.auth-label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 700; }
.auth-help { margin-top: 4px; color: var(--on-surface-variant); font-size: 10px; }
.auth-submit { width: 100%; border: 0; border-radius: 9px; padding: 11px; background: var(--secondary-container); color: var(--on-secondary-container); font-size: 13px; font-weight: 800; transition: .2s; }
.auth-google { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1px solid var(--outline-variant); border-radius: 9px; padding: 10px; color: var(--on-surface); font-size: 12px; font-weight: 700; transition: background .2s, transform .2s; }
.auth-google:hover { background: var(--surface-container-low); transform: translateY(-1px); }
.auth-error { border-radius: 8px; background: #fef2f2; color: #b91c1c; padding: 8px 10px; font-size: 11px; }
@keyframes authFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes authSlideUp { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: translateY(0) scale(1) } }
@media (max-width: 480px) { .auth-card { border-radius: 14px; } .auth-tabs { margin: 16px 20px; } }

/* First-visit WhatsApp poster */
.first-visit-poster[hidden] {
  display: none !important;
}

.first-visit-poster {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .72);
  animation: authFadeIn .2s ease-out;
}

.first-visit-poster__content {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  border-radius: 12px;
  background: #142839;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  overflow: hidden;
}

.first-visit-poster__link {
  display: grid;
  min-height: 220px;
  max-height: 90vh;
  place-items: center;
  color: #fff;
  text-align: center;
  text-decoration: none;
}

.first-visit-poster__image {
  display: block;
  width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.first-visit-poster__fallback {
  display: none;
  gap: 14px;
  padding: 56px 28px 32px;
  background: radial-gradient(ellipse at top right, #2b6690, transparent 55%), #142839;
  font-size: 16px;
  line-height: 1.5;
}

.first-visit-poster__fallback strong {
  color: #fea619;
  font-size: clamp(22px, 6vw, 32px);
  line-height: 1.2;
}

.first-visit-poster__fallback .first-visit-poster__cta {
  display: inline-block;
  justify-self: center;
  padding: 10px 16px;
  border-radius: 7px;
  background: #25d366;
  color: #10291b;
  font-weight: 800;
}

.first-visit-poster__content.is-image-missing .first-visit-poster__image {
  display: none;
}

.first-visit-poster__content.is-image-missing .first-visit-poster__fallback {
  display: grid;
}

.first-visit-poster__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  font: 30px/1 Arial, sans-serif;
  cursor: pointer;
}

.first-visit-poster__close:hover {
  background: #000;
}

.first-visit-poster__close:focus-visible,
.first-visit-poster__link:focus-visible {
  outline: 3px solid #fea619;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .first-visit-poster {
    animation: none;
  }
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: #142839;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s ease-out;
  border-left: 4px solid #fea619;
}

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