/* Master Theme Overrides */
html, body {
  background: #090d16 !important;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.18) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.18) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    linear-gradient(135deg, #070913 0%, #0d1322 50%, #15102a 100%) !important;
  background-attachment: fixed !important;
  color: #f8fafc !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  min-height: 100vh !important;
  margin: 0 !important;
}

/* Base resets for Bootstrap elements */
.container, .container-fluid {
  color: #f8fafc !important;
}

.page-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-top: 10px !important;
}

.page-header h1 {
  font-family: 'Outfit', sans-serif !important;
  font-weight: 800 !important;
  color: #ffffff !important;
}

/* Navbar Modernization */
.navbar-inverse {
  background: rgba(13, 19, 34, 0.88) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.navbar-inverse .navbar-brand {
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #38bdf8 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.navbar-inverse .navbar-nav > li > a {
  color: #94a3b8 !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  border-radius: 8px !important;
  margin: 6px 4px !important;
  padding: 8px 16px !important;
}

.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > .active > a {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.navbar-inverse .dropdown-menu {
  background: #111827 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45) !important;
  padding: 8px !important;
}

.navbar-inverse .dropdown-menu > li > a {
  color: #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 9px 14px !important;
}

.navbar-inverse .dropdown-menu > li > a:hover,
.navbar-inverse .dropdown-menu > li > a:focus {
  color: #ffffff !important;
  background: rgba(139, 92, 246, 0.2) !important;
}

.navbar-inverse .dropdown-menu .divider {
  background: rgba(255, 255, 255, 0.08) !important;
}

.navbar-logout-form {
  margin: 6px 4px !important;
}

.navbar-logout-button {
  display: block !important;
  padding: 8px 16px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font: inherit !important;
  font-weight: 500 !important;
  line-height: 20px !important;
  cursor: pointer !important;
}

.navbar-logout-button:hover,
.navbar-logout-button:focus {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
  outline: none !important;
}

.empty-state {
  max-width: 680px !important;
  margin: 40px auto !important;
  padding: 40px !important;
  text-align: center !important;
  background: rgba(15, 23, 42, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6) !important;
}

.empty-state h2 {
  margin-top: 0 !important;
  color: #ffffff !important;
}

.empty-state p {
  margin: 14px 0 24px !important;
  color: #94a3b8 !important;
}

.empty-state .btn + .btn {
  margin-left: 10px !important;
}

/* Auth / Login Page Redesign */
.auth-page-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: calc(100vh - 120px) !important;
  padding: 40px 15px !important;
}

.auth-glass-card {
  width: 100% !important;
  max-width: 440px !important;
  background: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 24px !important;
  padding: 40px 36px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7),
              0 0 40px rgba(99, 102, 241, 0.25) !important;
}

.auth-badge {
  width: 64px !important;
  height: 64px !important;
  margin: 0 auto 20px auto !important;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%) !important;
  border-radius: 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4) !important;
  font-size: 1.8rem !important;
}

.auth-header-title {
  font-family: 'Outfit', sans-serif !important;
  font-size: 2rem !important;
  font-weight: 800 !important;
  text-align: center !important;
  color: #ffffff !important;
  margin: 0 0 8px 0 !important;
}

.auth-header-desc {
  color: #94a3b8 !important;
  font-size: 0.95rem !important;
  text-align: center !important;
  margin: 0 0 32px 0 !important;
}

.custom-form-group {
  margin-bottom: 20px !important;
}

.custom-form-group label {
  display: block !important;
  color: #cbd5e1 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

.custom-input {
  width: 100% !important;
  height: 52px !important;
  background: rgba(30, 41, 59, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  padding: 0 18px !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  transition: all 0.25s ease !important;
  box-sizing: border-box !important;
}

.custom-input:focus {
  border-color: #a855f7 !important;
  background: rgba(30, 41, 59, 0.95) !important;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25) !important;
  outline: none !important;
}

.custom-btn-primary {
  width: 100% !important;
  height: 52px !important;
  margin-top: 10px !important;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%) !important;
  border: none !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.custom-btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 15px 35px rgba(139, 92, 246, 0.5) !important;
  opacity: 0.95 !important;
}

.custom-btn-primary:active {
  transform: translateY(0) !important;
}

.auth-nav-links {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-top: 24px !important;
  padding-top: 20px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.auth-nav-links a {
  color: #818cf8 !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  transition: color 0.2s ease !important;
}

.auth-nav-links a:hover {
  color: #c084fc !important;
  text-decoration: none !important;
}

/* Editorial catalog — desktop first, with a lightweight Kindle fallback. */
:root {
  --ink: #11100e;
  --paper: #f6f3ed;
  --paper-muted: #ded8ce;
  --orange: #ff5d37;
  --orange-dark: #d83d1c;
  --night: #151719;
}

html,
body {
  background: var(--paper) !important;
  background-image: none !important;
  color: var(--ink) !important;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif !important;
}

body { padding-top: 78px !important; }

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: Georgia, "Times New Roman", serif !important;
  letter-spacing: -0.035em !important;
}

.navbar-inverse {
  min-height: 62px !important;
  padding: 6px 0 !important;
  background: rgba(21, 23, 25, .97) !important;
  border-bottom: 3px solid var(--orange) !important;
  box-shadow: none !important;
}

.navbar-inverse .navbar-brand {
  color: #fff !important;
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  font-size: 22px !important;
}

.navbar-inverse .navbar-brand span { color: var(--orange); }

.navbar-inverse .navbar-nav > li > a,
.navbar-logout-button {
  color: #d7d3cc !important;
  font-weight: 700 !important;
}

.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > .active > a,
.navbar-logout-button:hover {
  color: #fff !important;
  background: #2a2c2f !important;
}

.navbar-inverse .dropdown-menu {
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: #1d1f21 !important;
  border: 1px solid #424447 !important;
  border-radius: 4px !important;
  box-shadow: 0 18px 35px rgba(0, 0, 0, .25) !important;
}

.navbar-inverse .dropdown-menu > li > a { color: #e8e4dd !important; }

.navbar-form .form-control {
  height: 38px !important;
  color: #fff !important;
  background: #292c2f !important;
  border: 1px solid #494c50 !important;
  border-radius: 2px !important;
}

.catalog-shell,
.manga-detail {
  padding: 42px 0 70px;
}

.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid #cfc8bc;
}

.catalog-heading-compact { align-items: center; padding-bottom: 18px; }
.catalog-heading-compact h1 { font-size: 30px; line-height: 1; }
.catalog-heading-compact p { margin-top: 5px; font-size: 13px; }

.catalog-tabs {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  overflow-x: auto;
}

.catalog-tabs a {
  min-width: 126px;
  padding: 13px 22px;
  border: 1px solid #d2cdc5;
  border-radius: 999px;
  color: #777169;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.catalog-tabs a.active,
.catalog-tabs a:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

.catalog-heading h1,
.detail-copy h1 {
  max-width: 720px;
  margin: 0;
  color: var(--ink) !important;
  font-size: clamp(34px, 4vw, 48px);
  line-height: .98;
}

.catalog-heading p {
  margin: 14px 0 0;
  color: #68625a;
  font-size: 16px;
}

.catalog-search {
  display: flex;
  min-width: 360px;
  border-bottom: 2px solid var(--ink);
}

.catalog-search input {
  min-width: 0;
  flex: 1;
  padding: 13px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.catalog-search button,
.subscribe-form button,
.catalog-action {
  padding: 12px 18px;
  border: 0;
  background: var(--orange);
  color: #fff !important;
  font-weight: 900;
  text-decoration: none !important;
  cursor: pointer;
}

.catalog-filters {
  display: flex;
  gap: 8px;
  margin: 15px 0 28px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.catalog-filters a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid #bdb5aa;
  border-radius: 999px;
  color: #514b44;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.catalog-filters a:hover,
.catalog-filters a.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.manga-shelf {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 30px 15px;
}

.manga-tile { min-width: 0; }

.manga-cover {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--paper-muted);
  box-shadow: 7px 8px 0 #cfc8bc;
}

.manga-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none !important;
}

.manga-state {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  background: rgba(17, 16, 14, .88);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.manga-copy { padding: 17px 3px 0; }
.manga-copy h2 { margin: 4px 0 10px; font-size: 17px; line-height: 1.12; }
.manga-copy h2 a { color: var(--ink); text-decoration: none; }
.manga-source { margin: 0; color: #746d64; font-size: 12px; font-weight: 800; text-transform: uppercase; }

.manga-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.manga-tags span { padding: 5px 8px; background: #e5ded3; color: #4b463f; font-size: 11px; font-weight: 800; }

.catalog-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 55px;
  padding-top: 22px;
  border-top: 1px solid #cfc8bc;
}
.catalog-pagination a, .catalog-pagination span { color: #68625a; font-weight: 800; }
.catalog-pagination > :last-child { text-align: right; }

.catalog-empty {
  max-width: 620px;
  margin: 60px auto;
  text-align: center;
}
.catalog-empty > span { font-size: 70px; color: var(--orange); }
.catalog-empty h2 { color: var(--ink) !important; font-size: 36px; }
.catalog-empty p { margin-bottom: 25px; color: #68625a; }

.detail-back { display: inline-block; margin-bottom: 26px; color: #5b554e; font-weight: 800; }
.detail-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 70px; }
.detail-cover img { display: block; width: 100%; height: auto; box-shadow: 12px 14px 0 #cfc8bc; }
.detail-copy h1 { margin-bottom: 14px; }
.detail-credits { color: #6d665d; font-size: 16px; }
.detail-copy h2 { margin-top: 34px; color: var(--ink) !important; font-size: 22px; }
.detail-description { max-width: 720px; color: #403c36; font-family: Georgia, serif; font-size: 17px; line-height: 1.72; }
.subscribe-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 0; max-width: 620px; margin-top: 32px; }
.subscribe-form label { grid-column: 1 / -1; margin-bottom: 8px; color: #5c564e; font-size: 12px; text-transform: uppercase; }
.subscribe-form select { min-height: 48px; padding: 0 13px; border: 1px solid #a9a197; background: #fff; color: var(--ink); }
.detail-warning { padding: 16px; border-left: 4px solid var(--orange); background: #eee5dc; }
.read-now { display: inline-block; margin-top: 20px; padding: 12px 20px; background: var(--ink); color: #fff !important; font-weight: 900; text-decoration: none !important; }
.detail-chapters { margin-top: 34px; border-top: 1px solid #cbc4b9; }
.detail-chapters h2 { margin: 22px 0 10px; }
.detail-chapters a { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid #ddd6cc; color: var(--ink); text-decoration: none; }
.detail-chapters a span, .detail-chapters a time { color: #756e65; font-size: 12px; }

.reader-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 34px; padding: 28px 0 88px; }
.reader-main { min-width: 0; }
.reader-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #d5cec4; }
.reader-heading h1 { margin: 0; color: var(--ink) !important; font-size: 28px; }
.reader-heading time { color: #777067; font-size: 13px; }
.reader-pages { max-width: 760px; margin: 0 auto; background: #e8e4de; }
.reader-pages img { display: block; width: 100%; height: auto; margin: 0; }
.reader-sidebar { position: sticky; top: 86px; align-self: start; max-height: calc(100vh - 120px); overflow: hidden; border: 1px solid #d4cdc3; background: #fff; }
.reader-series { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 13px; padding: 16px; }
.reader-series img { width: 72px; height: 96px; object-fit: cover; }
.reader-series h2 { margin: 4px 0 8px; color: var(--ink) !important; font-family: "Trebuchet MS", sans-serif !important; font-size: 18px; line-height: 1.2; letter-spacing: -.02em !important; }
.reader-series p { color: #777067; font-size: 12px; }
.reader-subscribe { display: block; margin: 0 16px 16px; padding: 11px; border: 2px solid var(--ink); color: var(--ink); font-weight: 900; text-align: center; text-decoration: none !important; }
.reader-sidebar > h3 { margin: 0; padding: 13px 16px; background: #f0ede8; color: #4a4641; font-family: "Trebuchet MS", sans-serif !important; font-size: 13px; letter-spacing: 0 !important; }
.reader-chapters { max-height: calc(100vh - 360px); overflow-y: auto; }
.reader-chapters a { display: block; padding: 10px 16px; border-bottom: 1px solid #ece8e2; color: var(--ink); text-decoration: none; }
.reader-chapters a small { display: block; color: #999188; }
.reader-chapters a strong { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-chapters a.active { border-left: 4px solid var(--orange); background: #f6eee8; }
.reader-controls { position: fixed; z-index: 1030; right: 0; bottom: 0; left: 0; display: flex; justify-content: flex-end; gap: 2px; padding: 10px max(20px, calc((100vw - 1170px) / 2)); background: #222329; color: #fff; }
.reader-controls a, .reader-controls span { min-width: 120px; padding: 10px 16px; color: #fff; font-weight: 800; text-align: center; text-decoration: none; }
.reader-controls span { color: #777980; }
.reader-unavailable { padding: 50px; background: #efeae3; text-align: center; }

/* Clean sign-in, aligned with the compact catalog language. */
.auth-page-container { min-height: calc(100vh - 190px) !important; padding: 55px 15px !important; }
.auth-glass-card { max-width: 360px !important; padding: 10px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; backdrop-filter: none !important; }
.auth-badge { width: 44px !important; height: 44px !important; margin-bottom: 14px !important; border-radius: 50% !important; background: var(--orange) !important; box-shadow: none !important; }
.auth-badge svg { width: 24px; fill: none; stroke: #fff; stroke-width: 1.8; }
.auth-header-title { color: var(--ink) !important; font-size: 28px !important; }
.auth-header-desc { margin-bottom: 28px !important; color: #746e66 !important; }
.custom-form-group label { color: #4b4640 !important; text-transform: none !important; letter-spacing: 0 !important; }
.custom-input { height: 46px !important; border: 1px solid #c8c1b7 !important; border-radius: 3px !important; background: #fff !important; color: var(--ink) !important; }
.custom-input:focus { border-color: var(--orange) !important; background: #fff !important; box-shadow: 0 0 0 2px rgba(255, 93, 55, .14) !important; }
.custom-btn-primary { height: 46px !important; border-radius: 3px !important; background: var(--orange) !important; box-shadow: none !important; font-family: "Trebuchet MS", sans-serif !important; font-size: 15px !important; }
.auth-nav-links { border-top-color: #d8d1c7 !important; }
.auth-nav-links a { color: var(--orange-dark) !important; }
.kindle-quick-nav { display: none; }

@media (prefers-reduced-motion: no-preference) and (min-width: 801px) {
  .manga-tile { animation: shelf-in .42s both; animation-delay: calc(var(--tile-index) * 45ms); }
  .manga-cover { transition: transform .18s ease, box-shadow .18s ease; }
  .manga-tile:hover .manga-cover { transform: translate(-3px, -4px); box-shadow: 11px 13px 0 var(--orange); }
  @keyframes shelf-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}

/* Kindle and compact screens: low-cost rendering, no blur, no motion dependency. */
@media (max-width: 800px) {
  html, body { background: #f7f5ef !important; }
  body { padding-top: 0 !important; font-size: 16px !important; }
  .navbar-fixed-top { position: static !important; }
  .navbar-inverse { background: #171717 !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .navbar-inverse .navbar-collapse { max-height: none !important; }
  .navbar-header { display: flex; align-items: center; width: 100%; }
  .kindle-quick-nav { display: flex; gap: 4px; margin-left: auto; }
  .kindle-quick-nav a { padding: 12px 10px; color: #fff; font-size: 13px; font-weight: 800; text-decoration: none; }
  .navbar-toggle { display: none !important; }
  .navbar-inverse .dropdown-menu { max-height: none; overflow: visible; box-shadow: none !important; }
  .catalog-shell, .manga-detail { padding: 24px 0 45px; }
  .catalog-heading { display: block; }
  .catalog-heading h1, .detail-copy h1 { font-size: 38px; }
  .catalog-search { min-width: 0; margin-top: 24px; }
  .catalog-filters { flex-wrap: wrap; overflow: visible; }
  .manga-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 15px; }
  .manga-cover { box-shadow: 4px 5px 0 #cfc8bc; }
  .manga-copy h2 { font-size: 20px; }
  .detail-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 28px; }
  .detail-cover img { box-shadow: 6px 7px 0 #cfc8bc; }
  .detail-description { font-size: 16px; line-height: 1.55; }
  .subscribe-form { grid-template-columns: 1fr; }
  .subscribe-form label { grid-column: 1; }
  .subscribe-form select, .subscribe-form button { min-height: 50px; }
  .reader-layout { display: block; padding-top: 18px; }
  .reader-sidebar { position: static; max-height: none; margin-top: 24px; overflow: visible; }
  .reader-chapters { max-height: none; }
  .reader-controls { justify-content: space-between; padding: 8px; }
  .reader-controls a, .reader-controls span { min-width: 0; padding: 10px 8px; }
  .reader-pages { width: calc(100% + 30px); margin-left: -15px; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 480px) {
  .manga-shelf { grid-template-columns: 1fr 1fr; }
  .manga-source { font-size: 10px; }
  .manga-copy h2 { font-size: 17px; }
  .manga-tags span:nth-child(n+2) { display: none; }
  .detail-layout { display: block; }
  .detail-cover { max-width: 230px; margin: 0 auto 36px; }
}
