
:root{--bg:#f6f7fb;--card:#fff;--accent:#0066ff;--muted:#6b7280}
.container{max-width:1000px;margin:2rem auto;padding:0 1rem}
.full-height {
  min-height: 100vh; /* ensure sections stretch to full viewport height on phones */
  display: flex;
  flex-direction: column;
}
/* ========== Header Styles ========== */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 1.5rem;
    width: 100%;
    left: 0;
    right: 0;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.brand-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s ease;
}

.brand:hover {
    opacity: 0.8;
}

.brand-accent {
    color: #1f2937;
    font-weight: 800;
}


.topnav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.topnav a {
    color: var(--accent);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.topnav a:hover {
    background: rgba(0, 102, 255, 0.08);
}

.discord-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5865F2 !important;
    padding: 0.5rem 0.75rem !important;
}

.discord-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.discord-text {
    display: none;
}

/* Mobile menu toggle - hidden by default (desktop) */
.mobile-menu-toggle {
    display: none;
}

/* Navigation menu wrapper - desktop default */
.nav-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 1.5rem 0;
    line-height: 1.3;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: #fff;
    border: 1px solid #e6e9ef;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12);
    min-width: 180px;
    z-index: 1000;
    margin-top: 0;
    padding: 0.5rem 0;
}

/* Create invisible bridge between toggle and menu */
.dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.5rem;
    background: transparent;
    display: none;
    z-index: 999;
}

.dropdown:hover .dropdown-menu,
.dropdown:hover::after {
    display: block;
}

/* Keep menu open when hovering over it */
.dropdown-menu:hover {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--accent);
    text-decoration: none;
    border-radius: 0;
    margin: 0;
}

.dropdown-menu a:hover {
    background: rgba(0, 102, 255, 0.08);
}

/* Ensure topnav is always visible and links render as inline blocks */
.topnav{display:flex!important}
.topnav a{display:inline-block!important;color:var(--accent)!important}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1rem}
.card{background:var(--card);border-radius:10px;box-shadow:0 4px 16px rgba(16,24,40,0.06);overflow:hidden;display:flex;flex-direction:column;min-height:320px;height:auto;transition:transform 0.2s ease,box-shadow 0.2s ease;cursor:pointer}
.card:hover{transform:translateY(-4px);box-shadow:0 8px 24px rgba(16,24,40,0.12)}
.card img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}
.card-body{padding:0.75rem;display:flex;flex-direction:column;flex:1;min-height:160px;overflow:visible;padding-bottom:0.75rem;flex-grow:1}
.card-body h3{margin:0 0 0 0;font-size:1rem;flex-shrink:0;line-height:1.3;height:2.6em;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;padding-bottom:0}
.card-body p.small:not(.meta){margin:-0.3rem 0 0.75rem 0;color:var(--muted);font-size:0.9rem;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.5;min-height:3em;padding-top:0}
.card-body p:not(.small){margin:0;color:var(--muted);font-size:0.9rem;flex-shrink:0}
.card-body .meta{margin-top:auto;color:var(--muted);font-size:0.85rem;flex-shrink:0;padding-top:0.75rem;margin-bottom:0}
.button{display:inline-block;background:var(--accent);color:#fff;padding:0.45rem 0.65rem;border-radius:8px;text-decoration:none}
.reader img{display:block;margin:0 auto;max-width:720px;width:100%}
.form-row{margin-bottom:0.5rem}
.input,textarea{width:100%;padding:0.6rem;border:1px solid #e6e9ef;border-radius:8px}
.footer{margin-top:3rem;color:var(--muted);text-align:center;font-size:0.9rem}

/* Homepage spacing tweaks */
.container h2 { margin-top: 2.25rem; margin-bottom: 0.9rem; font-size: 1.35rem; }
.grid { margin-bottom: 3rem; }
.table{width:100%;border-collapse:collapse;background:var(--card);border-radius:10px;overflow:hidden}
.table th,.table td{padding:0.6rem;border-bottom:1px solid #eee;text-align:left}
.small{font-size:0.85rem;color:var(--muted)}

.form-card {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-card label {
  font-weight: bold;
}
.form-card input[type="text"],
.form-card textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.form-card button {
  background: #1e90ff;
  color: white;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.form-card button:hover {
  background: #0074d9;
}
.alert.success {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* Auth action alignment: left link, right button */
.auth-actions {
  width: 100%;
  max-width: 1000px; /* match page container max width */
  margin: 0.75rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between; /* push items to left/right */
  padding: 0 0.5rem; /* small horizontal padding so button isn't flush to viewport */
}
.auth-actions .auth-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}
.auth-actions .auth-link:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .auth-actions { padding: 0 0.25rem; }
  /* On very small screens, stack vertically to avoid cramped layout */
  .auth-actions { gap: 0.5rem; }
  .auth-actions .button { width: auto; }
}

/* ========== Global Reset & Base Styles ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}
body {
  font-family: "Poppins", sans-serif;
  background-color: #f5f6fa;
  color: #222;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* prevent horizontal scrolling caused by off-canvas elements */
html, body { overflow-x: hidden; }

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ========== Navbar ========== */
.navbar {
  background: #1e90ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  flex-wrap: wrap;
}

.navbar a {
  color: white;
  text-decoration: none;
  margin: 0.5rem;
  font-weight: 500;
}

.navbar a:hover {
  text-decoration: underline;
}

/* ========== Card Layout ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-5px);
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-content {
  padding: 1rem;
}

/* ========== Forms ========== */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

button {
  background: #1e90ff;
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #0074d9;
}

/* ========== Alerts ========== */
.alert.success {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* ========== Footer ========== */
footer {
  text-align: center;
  background: #1e90ff;
  color: white;
  padding: 1rem;
  margin-top: auto;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px){
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Mobile Header Redesign */
  .header-inner {
    padding: 0.75rem 1rem;
  }
  
  .brand {
    font-size: 1.15rem;
  }
  
  /* Mobile Menu Toggle - Modern Hamburger */
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    flex-shrink: 0;
    margin-left: 1rem;
  }
  
  .hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
    display: block;
  }
  
  .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
  }
  
  .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  
  .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
  }
  
  /* Mobile Navigation - Full Screen Overlay Style */
  .topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .topnav.open {
    opacity: 1;
    visibility: visible;
  }
  
  .nav-menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    max-height: calc(100vh - 0px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }
  
  .topnav.open .nav-menu {
    transform: translateX(0);
  }
  
  .topnav a,
  .topnav .dropdown-toggle {
    display: block;
    padding: 1rem 1.5rem;
    color: #111827;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease, color 0.2s ease;
    background: #fff;
  }
  
  .topnav a:last-child,
  .topnav .dropdown:last-child .dropdown-toggle {
    border-bottom: none;
  }
  
  .topnav a:active,
  .topnav .dropdown-toggle:active {
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent);
  }
  
  /* Mobile Dropdown Styling */
  .topnav .dropdown {
    width: 100%;
    border-bottom: 1px solid #f3f4f6;
  }
  
  .topnav .dropdown:last-child {
    border-bottom: none;
  }
  
  .topnav .dropdown-toggle {
    width: 100%;
    text-align: left;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
  }
  
  .topnav .dropdown.active .dropdown-toggle {
    background: #f8f9fa;
    color: var(--accent);
  }
  
  .topnav .dropdown-menu {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .topnav .dropdown.active .dropdown-menu {
    max-height: 500px;
  }
  
  .topnav .dropdown-menu a {
    padding: 0.875rem 1.5rem 0.875rem 3rem;
    color: #4b5563;
    font-weight: 400;
    font-size: 0.95rem;
    background: #f8f9fa;
  }
  
  .topnav .dropdown-menu a:last-child {
    border-bottom: none;
  }
  
  .topnav .dropdown-menu a:active {
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent);
  }
  
  /* Discord Link in Mobile */
  .topnav .discord-link {
    color: #5865F2 !important;
  }
  
  
  .topnav .discord-link svg {
    width: 20px;
    height: 20px;
  }
  
  /* Page Title Mobile Optimization */
  .page-title {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    padding: 0 0.25rem;
  }

  .navbar a {
    margin: 0.25rem 0;
  }

  .form-card {
    padding: 1rem;
  }

  .card img {
    height: 150px;
  }

  body {
    font-size: 0.95rem;
  }

  /* Container adjustments for mobile */
  .container { 
    margin: 0 auto; 
    padding: 0 1rem; 
    width: 100%; 
    max-width: 100%;
  }
  
  /* Header adjustments - ensure full width */
  .header {
    width: 100%;
    margin-bottom: 1.25rem;
  }
}

/* Desktop: brand left, menu items extreme right */
@media (min-width: 769px){
  /* Desktop Header - keep full width */
  .header {
    width: 100%;
  }
  
  .header-inner {
    padding: 1rem 1.5rem;
  }
  
  /* Hide mobile menu toggle on desktop */
  .mobile-menu-toggle {
    display: none;
  }
  
  /* Desktop navigation styling */
  .topnav {
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-height: none;
    opacity: 1;
    visibility: visible;
    overflow: visible;
    display: flex !important;
  }
  
  .nav-menu {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    transform: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
  
  .topnav a {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-bottom: none;
    background: transparent !important;
  }
  
  .topnav .dropdown {
    position: relative;
    display: inline-block;
    border-bottom: none;
  }
  
  .topnav .dropdown-toggle {
    padding: 0.5rem 0.75rem;
    border-bottom: none;
    background: transparent !important;
    display: inline-block;
  }
  
  .topnav .dropdown-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: #fff;
    border: 1px solid #e6e9ef;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12);
    min-width: 180px;
    margin-top: 0;
    padding: 0.5rem 0;
    max-height: none;
    display: none;
  }
  
  /* Create invisible bridge between toggle and menu */
  .topnav .dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.5rem;
    background: transparent;
    display: none;
    z-index: 999;
  }
  
  .topnav .dropdown:hover .dropdown-menu,
  .topnav .dropdown:hover::after {
    display: block;
  }
  
  /* Keep menu open when hovering over it */
  .topnav .dropdown-menu:hover {
    display: block;
  }
  
  .topnav .dropdown-menu a {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
  }
  
  
  .page-title {
    font-size: 2rem;
    padding: 0;
  }

  /* Make header span the full viewport so nav can sit at the extreme right edge */
  /* Keep header inside the centered container so nav isn't flush to the browser edges */
  .header{
    position:static;
    left:auto; right:auto;
    margin-left:0; margin-right:0;
    width:100%;
    padding:0; /* use container padding instead */
    box-sizing:border-box;
    background:transparent;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 0.5rem;
  }

  button, .topnav a, .navbar a {
    padding: 0.9rem 0.75rem; /* larger tap targets */
    font-size: 1.05rem;
  }

  .brand { font-size: 1.1rem; }
  .page-title { font-size: 1.375rem; }

  /* Larger webtoon images to feel immersive */
  .card img { height: 260px; }
  .card img[style] { height: auto; max-height: 260px; }
  
  /* Episode card images - increase height on mobile */
  .card > div:first-child {
    height: 260px !important;
  }
  .card > div:first-child img {
    height: 100% !important;
  }
}

/* Hamburger removed: responsive `.topnav` is handled above; no off-canvas drawer or toggle needed. */

/* Reader specific styles */
body.reader-page { overflow:hidden; }
.reader-shell { background: #000; color: #fff; min-height:100vh; height:100vh; display:flex; flex-direction:column; overflow:hidden; }
.reader-header { display:flex; justify-content:space-between; align-items:center; padding:0.75rem 1rem; background:rgba(0,0,0,0.6); position:sticky; top:0; z-index:20; flex-shrink:0; }
.reader-header .brand { color:#fff; font-size:1.1rem }
.reader-nav a { color:#fff; text-decoration:none }
.reader-toolbar { display:flex; justify-content:space-between; align-items:center; padding:0.5rem 1rem; background:rgba(0,0,0,0.45); z-index:19; flex-shrink:0; }
.reader-title { font-weight:600 }
.reader-btn { color:#fff; padding:0.4rem 0.6rem; text-decoration:none; border-radius:6px; background:rgba(255,255,255,0.06) }
.reader-btn.disabled { opacity:0.35 }
.reader { flex:1; overflow-y:auto; overflow-x:hidden; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; padding:1rem 0 4rem 0; }
.reader-img { width:100%; max-width:900px; height:auto; margin:0; display:block; image-rendering:auto; will-change:auto }
.reader-placeholder { color:#bbb; padding:1rem }

/* Hidden header/toolbar */
.reader-header.hidden, .reader-toolbar.hidden { transform:translateY(-110%); transition:transform 200ms ease-in-out; }

/* Admin modal styles */
.admin-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.5);align-items:center;justify-content:center;z-index:9999}
.admin-modal-dialog{background:#fff;border-radius:10px;max-width:1000px;width:95%;max-height:90vh;overflow:auto;box-shadow:0 8px 32px rgba(0,0,0,0.3)}
.admin-modal-header{padding:0.75rem;border-bottom:1px solid #eee;text-align:right}
.admin-modal-body{padding:1rem}

@media (max-width:480px){
  .admin-modal-dialog{width:98%;max-height:95vh}
}

@media (max-width: 480px) {
  .reader-header .brand { font-size:1.2rem }
  .reader-toolbar { padding:0.4rem; }
  .reader-img { margin-bottom:0.5rem }
}

/* Admin Dashboard Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  width: 100%;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .stats-grid > div {
    grid-column: span 1 !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-grid > div {
    grid-column: span 1 !important;
  }
}

/* Hero Section Styles */
.hero-slider {
  margin-bottom: 3rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero-slider-container {
  position: relative;
  width: 100%;
  min-height: 400px;
}

.hero-slide {
  border-radius: 12px;
  overflow: hidden;
}

.hero-slider-prev:hover,
.hero-slider-next:hover {
  background: rgba(255, 255, 255, 1) !important;
}

.hero-slider-dot:hover {
  background: rgba(255, 255, 255, 0.8) !important;
}

@media (max-width: 768px) {
  .hero-slider-container {
    min-height: 300px !important;
  }
  
  .hero-slide {
    min-height: 300px !important;
  }
  
  .hero-slide h1 {
    font-size: 1.8rem !important;
  }
  
  .hero-slide p {
    font-size: 1rem !important;
  }
  
  .hero-slide a {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
  }
  
  .hero-slider-prev,
  .hero-slider-next {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.2rem !important;
  }
  
  .hero-slider-prev {
    left: 0.5rem !important;
  }
  
  .hero-slider-next {
    right: 0.5rem !important;
  }
  
  .hero-slider-dots {
    gap: 0.4rem !important;
  }
  
  .hero-slider-dot {
    width: 8px !important;
    height: 8px !important;
  }
}
