/* =====================
   THEME VARIABLES
===================== */
:root {
  --primary: #1A3A5F;
  --secondary: #5D7FA1;
  --accent: #FF725E;
  --background: #F5F3EF;
  --card: #E3E7EB;
  --text: #1A1A1A;
  --white: #ffffff;
}

/* =====================
   GLOBAL RESET & BASE
===================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-top: 0;
  background-color: var(--background);
  color: var(--text);
  font-family: 'Source Sans 3', sans-serif;
  line-height: 1.65;
}

.top-header {
  padding: 10px 20px;
  background-color: var(--background);
  position: relative;
  z-index: 100;
}

/* =====================
   TYPOGRAPHY
===================== */
h1, h2, h3, h4, h5, h6, .Heading {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.Heading {
  text-align: center;
  margin: 60px 0 40px;
}

/* =====================
   LOGO
===================== */
#logo-container {
  position: relative;
  width: 120px;
  padding: 10px;
  flex-shrink: 0;
}

#LogoHome {
  width: 100%;
}

/* =====================
   NAVIGATION BAR
===================== */
.nav-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary);
  position: relative;
  z-index: 100;
  font-family: 'Source Sans 3', sans-serif;
  padding-right: 0; /* keep only right padding */
  padding-left: 0;  /* remove left padding */
}

.nav-bar ul,
.nav-bar ul li,
.nav-bar ul li ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu {
  display: flex;
  gap: 1.5rem;
}

.menu > li {
  position: relative;
}

.nav-bar ul li a {
  display: block;
  padding: 14px 22px;
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: background 0.2s ease;
}

.nav-bar ul li a:hover {
  background-color: var(--secondary);
}

/* =====================
   DROPDOWNS
===================== */
.dropdown-content,
.dropdown-sub-content {
  display: none;
  position: absolute;
  background-color: var(--primary);
  min-width: 220px;
  max-width: 320px;
  z-index: 150;
}

.dropdown-content {
  top: 100%;
  left: 0;
  transform: translateX(-20px); /* 🔑 FIX: cancels nav padding */
}

.dropdown-sub-content {
  top: 0;
  left: 100%;
  box-shadow: 4px 4px 14px rgba(0,0,0,0.25);
}

.dropdown-sub {
  position: relative;
}

.dropdown-content li a,
.dropdown-sub-content li a {
  display: block;
  width: 100%;
  padding: 12px 18px;
  color: var(--white);
  text-decoration: none;
  transition: background 0.2s ease;
}

.dropdown-content li a:hover,
.dropdown-sub-content li a:hover {
  background-color: var(--secondary);
}

.dropdown-sub > a span::after {
  content: '▶';
  font-size: 12px;
  margin-left: 8px;
}

.dropdown:hover > .dropdown-content,
.dropdown-sub:hover > .dropdown-sub-content {
  display: block;
}

/* Top-level menu links cover the entire li including any extra space */
.menu > li {
  position: relative; /* keep dropdown positioning */
}

/* Top-level dropdown hover should extend to dropdown width */
.menu > .dropdown {
  position: relative;
}

.menu > .dropdown > a {
  display: block;
  padding: 14px 22px;
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease;
  box-sizing: border-box; /* ensures padding is included in width */
}

.menu > .dropdown > .dropdown-content {
  top: 100%;
  left: 0;
  min-width: 220px;
  max-width: 320px;
}

.menu > .dropdown:hover > a {
  background-color: var(--secondary); /* remove width, min-width, display inline-block */
}

/* Highlight full li including space left of text */
.menu > li:hover > a {
  background-color: var(--secondary);
}

/* =====================
   LOGIN / REGISTER BUTTON
===================== */
.auth-container {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.auth-container button {
  padding: 0.5rem 1.2rem;
  background-color: var(--secondary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: background-color 0.25s ease, transform 0.15s ease;
}

.auth-container button:hover {
  background-color: var(--primary);
  transform: translateY(-2px);
}

/* =====================
   MODALS / REST UNCHANGED
===================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(26, 58, 95, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  background-color: var(--card);
  width: 90%;
  max-width: 420px;
  padding: 32px;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  animation: slideDown 0.4s ease;
}

.close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 26px;
  color: var(--secondary);
  cursor: pointer;
}

.close:hover {
  color: var(--primary);
}

.modal-content h2 {
  font-family: 'Playfair Display', serif;
  margin-top: 0;
  color: var(--primary);
}

.modal-content p {
  margin: 16px 0 22px;
}

.modal-content input {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid var(--secondary);
  font-size: 15px;
  background-color: var(--white);
}

.modal-content input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-content button {
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: none;
  background-color: var(--accent);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.modal-content button:hover {
  background-color: #e85f4d;
}

/* =====================
   LOGIN/REGISTER TABS
===================== */
.tab-buttons {
  display: flex;
  margin-bottom: 20px;
}

.tab-buttons button {
  flex: 1;
  padding: 12px;
  background-color: var(--card);
  border: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  outline: none;
  color: var(--primary);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.tab-buttons button.active {
  background-color: var(--primary);
  color: var(--white);
}

/* =====================
   AUTH MESSAGE
===================== */
#auth-message {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--primary);
  text-align: center;
}

#auth-message.error {
  color: red;
}

#auth-message.success {
  color: green;
}

/* =====================
   reCAPTCHA
===================== */
#recaptcha-container {
  margin: 12px 0;
}

/* Forms layout */
#login-form,
#register-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =====================
   CATEGORY SECTIONS
===================== */
.category-section {
  margin: 2rem 0;
  padding: 20px;
  background-color: var(--card);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.05);
}

.category-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* =====================
   SCROLL BUTTONS
===================== */
.scroll-left,
.scroll-right {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 12px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 1.2rem;
}

.scroll-left:hover,
.scroll-right:hover {
  background: var(--secondary);
}

/* =====================
   SEARCH BAR
===================== */
.book-search {
  max-width: 500px;
  margin: 0 auto 40px;
  position: relative;
}

.book-search input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--secondary);
  font-size: 16px;
  margin-top: 40px;
}

/* =====================
   ANIMATIONS
===================== */
@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.nav-container {
  width: 100%;
  display: flex;
  align-items: center;
}

.nav-bar,
.nav-bar a {
  font-family: 'Source Sans 3', sans-serif;
}

/* Cookie Banner Styles */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a1a1a;
  color: #fff;
  padding: 20px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
  z-index: 9999;
  max-width: 600px;
  margin: 0 auto;
  border-radius: 10px 10px 0 0;
}

.cookie-content h3 {
  margin: 0 0 10px 0;
  font-size: 1.2em;
}

.cookie-content p {
  margin: 0 0 15px 0;
  font-size: 0.9em;
  line-height: 1.5;
}

.cookie-content a {
  color: #4a9eff;
  text-decoration: underline;
}

.cookie-options {
  margin: 15px 0;
}

.cookie-option {
  margin: 10px 0;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
}

.cookie-option label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9em;
}

.cookie-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.cookie-option input[type="checkbox"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.cookie-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  transition: all 0.3s;
}

.cookie-accept {
  background: #4a9eff;
  color: white;
}

.cookie-accept:hover {
  background: #357abd;
}

.cookie-save {
  background: #28a745;
  color: white;
}

.cookie-save:hover {
  background: #218838;
}

.cookie-decline {
  background: #6c757d;
  color: white;
}

.cookie-decline:hover {
  background: #545b62;
}

/* Cookie Settings Button */
.cookie-settings-link {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 9998;
}

.cookie-settings-link:hover {
  background: #333;
}

/* =====================
   LOGOUT CONFIRMATION MODAL
===================== */
.logout-modal-content {
  max-width: 400px;
  text-align: center;
}

.logout-modal-content h2 {
  margin-bottom: 15px;
  color: var(--primary);
}

.logout-modal-content p {
  margin-bottom: 25px;
  font-size: 1rem;
  color: var(--text);
}

.logout-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.logout-confirm-btn,
.logout-cancel-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-confirm-btn {
  background-color: #dc3545;
  color: white;
}

.logout-confirm-btn:hover {
  background-color: #c82333;
  transform: translateY(-2px);
}

.logout-cancel-btn {
  background-color: var(--secondary);
  color: white;
}

.logout-cancel-btn:hover {
  background-color: var(--primary);
  transform: translateY(-2px);
}

/* =====================
   IMPROVED FOOTER
===================== */
.site-footer {
    position: relative;
    width: 100%;
    padding: 50px 20px;
    background-color: #0f0f0f;
    margin-top: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* TikTok Icon - Bottom Left */
.tiktok-icon-footer {
    position: absolute;
    left: 30px;
    bottom: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff0050 0%, #00f2ea 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 0, 80, 0.3);
}

.tiktok-icon-footer:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 0, 80, 0.5);
}

.footer-content {
    text-align: center;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.contact-button {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 36px;
    color: #ffffff;
    background-color: transparent;
    border: 2px solid #ffffff;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.contact-button:hover {
    background-color: #ffffff;
    color: #0f0f0f;
    transform: translateY(-2px);
}

/* Footer Links */
.footer-links {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Copyright Text - Pushed Down */
.copyright {
    margin: 30px 0 0 0 !important;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Modal Z-Index Fix */
#logout-modal {
  z-index: 1100 !important;
}

#reset-password-modal {
  z-index: 1050 !important;
}

#auth-modal {
  z-index: 1000 !important;
}

.modal {
  z-index: 1000;
}

/* Responsive Footer */
@media (max-width: 600px) {
    .tiktok-icon-footer {
        left: 15px;
        bottom: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .footer-content {
        gap: 15px;
    }

    .contact-button {
        padding: 12px 28px;
        font-size: 14px;
    }

    .copyright {
        margin-top: 20px !important;
    }
}

/* =====================
   MOBILE NAVIGATION
===================== */
.nav-toggle {
  display: none;
  font-size: 26px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 14px 18px;
}

/* Mobile styles */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .menu {
    display: none;
    flex-direction: column;
    width: 100%;
    background-color: var(--primary);
  }

  .menu.open {
    display: flex;
  }

  .menu > li {
    width: 100%;
  }

  .nav-bar ul li a {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }

  /* Disable hover dropdowns on mobile */
  .dropdown-content,
  .dropdown-sub-content {
    position: static;
    transform: none;
    box-shadow: none;
    display: none;
    width: 100%;
  }

  .dropdown.open > .dropdown-content {
    display: block;
  }

  .dropdown-sub.open > .dropdown-sub-content {
    display: block;
  }

  .dropdown-sub > a span::after {
    content: '▼';
  }
}
