/* CSS Variables & Design System */
:root {
  --color-primary: #105D95;
  /* Deep Blue */
  --color-primary-dark: #1b3d73;
  --color-accent: #71A84A;
  /* Green */
  --color-accent-hover: #6ea449;
  --color-logo-text: #1F428B;
  --color-logo-pharm: #71A84A;
  --color-text-main: #1a1a1a;
  --color-text-muted: #666666;
  --color-bg-light: #f8f9fa;
  --color-white: #ffffff;
  --color-border: #e0e0e0;

  /* Header Placeholder needs to be sticky */
  --header-height: 70px;
  /* Estimate if needed, but not using this variable yet */


  --font-family: 'Inter', system-ui, -apple-system, sans-serif;

  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 4rem;

  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius-md: 8px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --color-primary: #5886CA;
  --color-primary-dark: #5886CA;
  --color-logo-text: #66b3ff;
  --color-logo-pharm: #85c25e;
  --color-text-main: #e0e0e0;
  --color-text-muted: #a0a0a0;
  --color-bg-light: #121212;
  --color-white: #1e1e1e;
  --color-border: #333333;
}

/* Theme Toggle Button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--color-text-main);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.mobile-theme-toggle {
  display: none;
  /* Hidden on desktop */
}

.theme-toggle {
  color: var(--color-primary);
}

.theme-toggle:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  color: var(--color-text-main);
  line-height: 1.5;
  background-color: var(--color-bg-light);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

ul {
  list-style: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

/* Full Width Overrides for Header & Footer */
.header .container,
.footer .container {
  max-width: 100%;
  padding: 0 5%;
}

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  /* Slightly rounded as per design */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
}

.btn-outline {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-outline-white {
  border-color: var(--color-white);
  color: var(--color-white);
}

.btn-outline-white:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
}

/* Header */
#header-placeholder {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header {
  background: var(--color-white);
  padding: var(--spacing-xs) 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  /* sticky moved to placeholder */
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
}



.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-logo-text);
  display: flex;
  align-items: center;
  gap: 0;
}

.logo svg {
  height: 40px;
  width: auto;
}

/* Inline SVG Styles */
.logo-svg .str0 {
  stroke: black;
  stroke-width: 8.86;
  stroke-miterlimit: 22.9256;
}

.logo-svg .fil0 {
  fill: var(--color-primary);
  /* Brand Color Circle */
}

.logo-svg .fil1 {
  fill: white;
}

.logo span {
  color: var(--color-logo-pharm);
}

.nav-links {
  display: flex;
  gap: var(--spacing-md);
}

.mobile-join-item {
  display: none;
}

.nav-links a {
  color: var(--color-text-muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--color-primary);
}

.auth-buttons {
  display: flex;
  gap: var(--spacing-sm);
  height: 40px;
  align-items: center;
  /* Ensure vertical alignment */
}

/* Search Bar Styles */
.search-container {
  /* display: none; Removed for animation */
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 1s ease;

  /* Flex item properties when hidden */
  flex: 0 0 0;
}

.search-container.overflow-visible {
  overflow: visible;

  max-width: 0;
  margin: 0;
  /* Remove margin when hidden to avoid spacing issues */
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  padding-right: 2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  white-space: nowrap;
  /* Prevent placeholder wrap during anim */
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-close {
  position: absolute;
  right: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--color-text-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0s;
  /* Instant hide when class is removed */
}

.search-container.overflow-visible .search-close {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
  /* Smooth fade in when class is added */
}

.search-close:hover {
  color: var(--color-primary);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--color-white);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-bg-light);
  cursor: pointer;
  transition: background-color 0.2s;
  display: block;
  width: 100%;
  text-align: left;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
}

.search-result-title {
  font-weight: 500;
  display: block;
}

/* Search Trigger Button - Square Box */
/* Reuse btn-outline styles basically but force square */
.search-trigger {
  width: 42px;
  /* Match height of Join Now roughly */
  height: 42px;
  border: none;
  /* Same as outline btn */
  border-radius: 50%;
  /* Same border radius */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  background: transparent;
  transition: all 0.2s;
  padding: 0;
  /* Override default padding */
  font-size: 1.25rem;
  z-index: 1002;
  position: relative;
}

.search-trigger:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Nav Animation */
nav {
  /* Center Nav Logic */
  flex: 1;
  display: flex;
  justify-content: center;
  /* End Center Logic */

  transition: all 1s ease;
  overflow: hidden;
  /* default to hidden for animation */
  max-width: 1000px;
  opacity: 1;
}

nav.nav-visible {
  overflow: visible;
  /* allow dropdowns to show when static */
}

.nav-links {
  min-width: max-content;
  /* Ensure content doesn't break during squish */
}


/* Active Search State */
.header.search-active nav {
  /* Hide nav */
  max-width: 0;
  opacity: 0;
  margin: 0;
  flex: 0;
  /* Remove flex grow so search can take over */
}

.header.search-active .search-container {
  /* Show search */
  width: auto;
  flex: 1;
  max-width: 800px;
  /* Expanded from 600px */
  opacity: 1;
  margin: 0 auto;
  /* Center in the available flex space */
}

.header.search-active .search-trigger {
  /* Hide trigger smoothly or just display none since it's removed from flow */
  display: none;
}

/* Hero Section */
.hero {
  background-color: var(--color-primary);
  color: var(--color-white);
  padding: var(--spacing-lg) 0;
  text-align: center;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
}

.hero h1 {
  margin-bottom: var(--spacing-sm);
  font-size: 3rem;
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: var(--spacing-md);
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
}

/* Features Section */
.features {
  padding: var(--spacing-lg) 0;
}

.features-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-md);
}

.feature-card {
  background: var(--color-white);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card h3 {
  color: var(--color-text-main);
  margin-bottom: var(--spacing-sm);
}

.feature-card p {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
  font-size: 0.95rem;
}

.link-arrow {
  color: var(--color-accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.link-arrow:hover {
  gap: 8px;
  /* subtle animation */
}

/* Footer */
/* Footer */
.footer {
  background: var(--color-white);
  padding: var(--spacing-lg) 0 var(--spacing-md);
  color: var(--color-text-main);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.footer-logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-logo-text);
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--spacing-xs);
}

.footer-logo svg {
  height: 48px;
  /* Slightly larger for footer */
  width: auto;
}

.footer-logo .fil0 {
  fill: var(--color-primary);
}

.footer-logo span {
  color: var(--color-logo-pharm);
}

.tagline {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--spacing-md);
}

.footer-col1 h4,
.footer-col2 h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-main);
}

.footer-col1 {
  translate: -100px;
}


.footer-links li {
  margin-bottom: 0.6rem;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* Subscribe Form */
.subscribe-area {
  margin-top: var(--spacing-md);
}

.subscribe-form {
  display: flex;
  gap: var(--spacing-xs);
  max-width: 400px;
}

.subscribe-form input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  /* match btn radius */
  font-family: inherit;
}

.subscribe-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Footer Bottom */
.footer-bottom {
  text-align: center;
  padding-top: var(--spacing-md);
  border-top: 1px solid #f0f0f0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  font-size: 1.25rem;
}

.social-links a {
  color: var(--color-text-muted);
}

.social-links a:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  /* Footer Mobile Margins */
  .footer .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .footer-links {
    margin-left: 1rem;
  }
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--color-white);
  min-width: 200px;
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: var(--spacing-xs) 0;
  z-index: 200;
  flex-direction: column;
}

.dropdown-menu li {
  width: 100%;
}

.dropdown-menu a {
  display: block;
  padding: 0.8rem var(--spacing-sm);
  color: var(--color-text-main);
  font-size: 0.95rem;
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

.dropdown:hover .dropdown-menu {
  display: flex;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  /* Hidden by default on desktop */
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  background: transparent;
  transition: all 0.2s;
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.mobile-menu-toggle:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Mobile Nav Header (Default hidden) */
.mobile-nav-header {
  display: none;
}

/* Responsive Styles */
@media (max-width: 900px) {

  /* Header Adjustments */
  .header {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  #header-placeholder {
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .header-inner {
    position: relative;
    justify-content: space-between;
  }

  .logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .mobile-menu-toggle {
    display: flex;
    /* Show on mobile */
  }



  .auth-buttons .theme-toggle {
    display: none;
  }

  .auth-buttons .btn-primary {
    display: none;
  }


  .nav-links {
    display: flex;
    /* Hide default nav */
    position: fixed;
    top: 0;
    left: 0;
    /* Left side drawer */
    bottom: 0;
    background-color: var(--color-white);
    flex-direction: column;
    gap: 0;
    width: 280px;
    height: 100vh;
    /* Professional Shadow + Backdrop Hack */
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1), 0 0 0 100vw rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
    z-index: 1001;
    /* Higher than header */
    overflow-y: auto;
    transform: translateX(-100%);
    /* Start from left */
    visibility: hidden;
    /* Hide when closed */
    transition: transform 0.3s ease-in-out, visibility 0s 0.3s;
    /* Delay visibility change on close */
  }

  /* Show nav when active */
  .nav-links.nav-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s ease-in-out, visibility 0s 0s;
    /* Show immediately on open */
    animation: none;
    /* Reset prev animation */
  }

  /* Add a close button inside nav if needed, or rely on outside click */

  /* Search Container Mobile: Below Header */
  /* Apply positioning ALWAYS on mobile to prevent jump on close */
  .search-container {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;

    /* Remove white background box, make it transparent to match animation pill */
    background: transparent;
    padding: 10px 0;
    /* Vertical padding only, let width:90% handle horizontal centering */

    /* Remove box shadow from container, it will be on input */
    box-shadow: none;
    z-index: 999;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    /* Hidden by default on mobile */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    /* Smooth fade */

    /* Override flex: 0 0 0 from desktop styles */
    flex: auto;
  }

  /* When active on mobile, just show it */
  .header.search-active .search-container {
    opacity: 1;
    pointer-events: all;
    overflow: visible;
    position: absolute;
    margin: 0;
    width: 100%;
    left: 0;
  }

  .search-container .search-input {
    width: 100%;
    max-width: 340px;
    /* Exactly match animation max-width (300px body + 40px circles) */
    background: var(--color-white);
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    height: 40px;
    border-radius: 20px;
    padding-left: 1.5rem;

    /* Explicit Layout Controls to prevent shifts */
    box-sizing: border-box;
    margin: 0;
  }

  [data-theme="dark"] .search-container .search-input {
    background: var(--color-white);
    color: var(--color-text-main);
  }

  .search-results {
    width: 100%;
    max-width: 340px;
    left: 0;
    right: 0;
    margin: 8px auto 0;
    transform: none;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    overflow: hidden;
  }

  /* Don't hide the search trigger on mobile, use it as toggle */
  .header.search-active .search-trigger {
    display: flex;
    z-index: 1000;
    /* Ensure clickable over search bar if needed, though they shouldn't overlap much */
    position: relative;
  }

  /* Hide the internal cross on mobile ALWAYS since we use the main button */
  .search-close {
    display: none !important;
  }

  /* Ensure body dimming or overlay could be added here in future */



  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Mobile Nav Items */
  .nav-links li {
    width: 100%;
    border-bottom: 1px solid var(--color-bg-light);
  }

  .mobile-nav-header {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem 1rem 0.5rem 1rem;
    /* Adjust padding as needed */
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-bg-light);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .mobile-theme-toggle {
    display: flex;
    /* Show on mobile */
    font-size: 1.5rem;
    color: var(--color-primary);
    width: auto;
    height: auto;
    margin: 0;
  }

  /* Indent Dropdown Items on Mobile */
  .nav-links .dropdown-menu li a {
    padding-left: 2rem;
    /* Subtler indentation */
    background-color: var(--color-white);
    /* Remove distinct background for cleaner look */
    color: var(--color-text-muted);
    /* Muted text to indicate hierarchy */
    border-left: 2px solid var(--color-border);
    /* Thin line guide */
    font-size: 0.95rem;
  }

  .nav-links .dropdown-menu li a:hover,
  .nav-links .dropdown-menu li a:active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    background-color: transparent;
  }

  [data-theme="dark"] .nav-links .dropdown-menu li a {
    background-color: var(--color-white);
    color: var(--color-text-muted);
    border-left-color: var(--color-border);
  }

  [data-theme="dark"] .nav-links .dropdown-menu li a:hover {
    background-color: transparent;
    color: var(--color-primary);
  }


  .nav-links .news-item {
    padding-bottom: 16px;
  }

  .nav-links a {
    display: flex;
    width: 100%;
    /* Ensure full click area */
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    min-height: 40px;
    /* Compact padding */
    font-size: 0.95rem;
  }

  /* Add Arrow for Drill-down feel */
  .dropdown>a::after {
    content: "\ea6e";
    /* RemixIcon arrow-right-s-line */
    font-family: 'remixicon';
    font-size: 1.2rem;
    color: var(--color-text-muted);
    transition: transform 0.3s;
  }

  .dropdown.active>a::after {
    transform: rotate(90deg);
    /* Rotate down when open */
  }

  /* Mobile Dropdowns (Submenus) */
  .dropdown:hover .dropdown-menu {
    display: none;
    /* Disable hover on mobile */
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    padding: 0;
    width: 100%;

    /* Animation Style */
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.5s ease;

    background-color: var(--color-white);
  }

  /* Padding for dropdown container itself */
  .nav-links .dropdown {
    padding-bottom: 16px;
  }

  /* Remove padding when open */
  .nav-links .dropdown.active {
    padding-bottom: 0;
  }

  .dropdown-menu a {
    padding-left: 2rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
  }

  /* Show submenu class for click interaction */
  .dropdown.active .dropdown-menu {
    max-height: 600px;
    opacity: 1;
  }

  /* Mobile Join Button at bottom of drawer */
  .mobile-join-item {
    display: block !important;
    margin-top: auto;
    padding: 1.5rem 1rem;
    border: none !important;
    background: var(--color-white);
  }

  [data-theme="dark"] .mobile-join-item {
    background: var(--color-white);
    /* Keep white background for primary button contrast if needed, or follow theme */
  }

  .mobile-join-item .btn {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    background-color: var(--color-accent) !important;
    color: var(--color-white) !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(113, 168, 74, 0.2);
  }

  .mobile-join-item .btn:hover {
    background-color: var(--color-accent-hover) !important;
  }

  /* Layout Stack - Hero */
  .hero h1 {
    font-size: 2rem;
  }

  .hero-content {
    padding: 0 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  /* Features Grid to 1 Column if very small */
  .features-grid {
    grid-template-columns: 1fr;
    /* Force stack on smaller tablets too if needed, but auto-fit handles most */
  }

  /* Footer Stack */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-col1 {
    translate: 0;
    /* Reset desktop translate offset */
  }
}

.section-header h1 {
  font-size: 1.75rem;
}



/* Ensure tables don't break layout */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  min-width: 600px;
  /* Ensure table keeps structure even on scroll */
}

.dropdown-menu a {
  display: block;
  padding: 0.8rem var(--spacing-sm);
  color: var(--color-text-main);
  font-size: 0.95rem;
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

.dropdown:hover .dropdown-menu {
  display: flex;
}

/* Nested Dropdown (Submenu) */
.dropdown-menu .dropdown-submenu {
  position: relative;
  width: max-content;
}

.submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  margin-top: -5px;
  background-color: var(--color-white);
  min-width: 200px;
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: var(--spacing-xs) 0;
  z-index: 200;
  flex-direction: column;
}

.submenu li {
  width: 100%;
}

.submenu a {
  display: block;
  padding: 0.8rem var(--spacing-sm);
  color: var(--color-text-main);
  font-size: 0.95rem;
  white-space: nowrap;
}

.submenu a:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

.dropdown-submenu:hover .submenu {
  display: flex;
}

/* Page Content */
.page-content {
  padding: var(--spacing-lg) 0;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
}

.article-content h1 {
  margin-bottom: var(--spacing-md);
  color: var(--color-primary);
}

.article-content h2 {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-main);
  border-bottom: 2px solid var(--color-bg-light);
  padding-bottom: var(--spacing-xs);
}

.article-content h3 {
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-xs);
  color: var(--color-primary-dark);
}

.article-content p {
  margin-bottom: var(--spacing-sm);
  line-height: 1.7;
}

.article-content ul,
.article-content ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-md);
}

.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

.article-content hr {
  margin: var(--spacing-lg) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .article-content h1 {
    font-size: 1.75rem;
  }

  .article-content h2 {
    font-size: 1.4rem;
  }
}

/* Download Section */
.download-section {
  background-color: var(--color-bg-light);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-lg);
  text-align: center;
}

.download-section h3 {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
}

.download-buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.download-buttons .btn {
  min-width: 250px;
}

/* Industries Page Styles */
.section-header {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.stats-text {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

@media (max-width: 550px) {
  .stats-text-break {
    display: block;
    margin-top: 5px;
  }
}

/* Filter Container */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  background-color: var(--color-white);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--spacing-lg);
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.filter-select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  background-color: var(--color-white);
  color: var(--color-text-main);
}

select.filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='%23666666'%3E%3Cpath d='M12 16L6 10H18L12 16Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

[data-theme="dark"] select.filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='%23a0a0a0'%3E%3Cpath d='M12 16L6 10H18L12 16Z'/%3E%3C/svg%3E");
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.filter-actions {
  display: flex;
  align-items: center;
}

/* Industries Table */
.table-responsive {
  overflow-x: auto;
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  background: var(--color-white);
  border: 1px solid var(--color-border);
}

.industries-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  table-layout: fixed;
  /* Fix column widths */
}

/* Define fixed column widths */
.industries-table th:nth-child(1) {
  width: 60px;
}

/* No. */
.industries-table th:nth-child(2) {
  width: 30%;
}

/* Name */
.industries-table th:nth-child(3) {
  width: 15%;
}

/* City */
.industries-table th:nth-child(4) {
  width: 15%;
}

/* Province */
.industries-table th:nth-child(5) {
  width: 15%;
}

/* Affiliation */
.industries-table th:nth-child(6) {
  width: 120px;
}

/* Status - Fixed pixel width for pills */
/* Remaining space distributed or implicit, but explicit is better.
   Total so far: 60px + 30% + 15% + 15% + 15% + 120px. 
   Approximation: 180px + 75%. Ideally use all % or all px or mixed carefully.
   Let's use percentages for main content and px for small fixed cols.
*/
.industries-table th:nth-child(1) {
  width: 5%;
}

.industries-table th:nth-child(2) {
  width: 45%;
}

.industries-table th:nth-child(3) {
  width: 10%;
}

.industries-table th:nth-child(4) {
  width: 10%;
}

.industries-table th:nth-child(5) {
  width: 20%;
}

.industries-table th:nth-child(6) {
  width: 10%;
}

.industries-table th,
.industries-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.industries-table th {
  background-color: var(--color-bg-light);
  font-weight: 600;
  color: var(--color-text-main);
  white-space: nowrap;
}

.industries-table tr:hover {
  background-color: var(--color-bg-light);
}

.industries-table tr:last-child td {
  border-bottom: none;
}

.industries-table th:nth-child(1),
.industries-table td:nth-child(1) {
  text-align: center;
}

.firm-name {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.firm-address {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Industries Grid */
.industries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  min-height: 200px;
  /* Min height for loading state */
}

/* Industry Card */
.industry-card {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--spacing-md);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--color-border);
}

.industry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.industry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-sm);
  gap: var(--spacing-sm);
}

.industry-header h3 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin: 0;
  word-break: break-word;
  /* Prevent overflow of long names */
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  text-align: center;
}

.status-badge.active {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.status-badge.inactive {
  background-color: #ffebee;
  color: #c62828;
}

.status-badge.blue {
  background-color: #e3f2fd;
  color: #0d47a1;
}

.status-wrapper {
  display: flex;
  gap: 4px;
  justify-content: center;
  /* Center by default (Desktop) */
  flex-wrap: wrap;
}

.industry-details p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.industry-details i {
  color: var(--color-primary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

#page-info {
  font-weight: 600;
  color: var(--color-text-muted);
}

.loading-spinner,
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

/* Collapsible Filter Panel Transition */
.filter-panel {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: 0.5s;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid transparent;
}

.filter-panel.active {
  max-height: 500px;
  opacity: 1;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}




/* Desktop Filter Buttons - Global Styles (Mobile overrides these) */
#filter-toggle-btn,
#reset-filters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* Space between icon and text */
}

/* Mobile Dropdowns (Submenus) */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--spacing-lg);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-white);
  color: var(--color-text-main);
  border-radius: 4px;
  /* Square with slight radius */
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  font-family: var(--font-family);
}

.page-btn:hover:not(:disabled):not(.dots) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background-color: var(--color-bg-light);
}

.page-btn.active {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--color-bg-light);
}

.page-btn.dots {
  border: none;
  background: transparent;
  cursor: default;
  color: var(--color-text-muted);
  min-width: auto;
  /* Allow it to shrink */
  padding: 0 0.1rem;
  /* Reduce padding significantly */
  margin: 0 -0.2rem;
  /* Optional: Pull neighbors closer if gap is still too big */
}

/* Books Page Styles */
.books-section {
  margin-top: var(--spacing-lg);
}

.book-category-group {
  margin-bottom: var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-white);
}

.category-header {
  padding: 1rem 1.5rem;
  background-color: var(--color-bg-light);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.category-header:hover {
  background-color: #e9ecef;
  /* Slightly darker than light */
}

.category-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.category-header .toggle-icon {
  font-size: 1.2rem;
  color: var(--color-primary);
}

.category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: var(--color-white);
}

.book-list {
  padding: 0;
}

.book-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.book-item:last-child {
  border-bottom: none;
}

.book-sr {
  width: 40px;
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
}

.book-info {
  flex: 1;
  padding-right: 1rem;
}

.book-title {
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 0.2rem;
}

.book-author {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.book-action {
  flex-shrink: 0;
}

.btn-outline-sm {
  padding: 0.4rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  /* Square with slight radius */
  color: var(--color-primary);
  transition: all 0.2s;
}

.btn-outline-sm:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.empty-msg,
.error-msg {
  padding: 1rem;
  text-align: center;
  color: var(--color-text-muted);
}

.subcategory-header {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  padding: 0.75rem 1.5rem;
  background-color: var(--color-white);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-bg-light);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.subcategory-header:hover {
  background-color: #f8f9fa;
}

.subcategory-header .toggle-icon {
  font-size: 1rem;
  color: var(--color-text-muted);
}

.subcategory-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #fafafa;
  /* Slightly different bg for nested content */
  padding-left: 0.5rem;
  /* Indent content slightly */
}

/* Sortable Headers */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

th.sortable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.sort-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-left: 5px;
}

/* Mobile Search Animation */
.search-anim-wrapper {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-height: 80px;
  display: none;
  justify-content: center;
  align-items: flex-start;
  /* Align top to come from "behind/below" */
  z-index: 998;
  pointer-events: none;
  padding-top: 10px;
}

.search-anim-wrapper.animating {
  display: flex;
}

.anim-container {
  display: flex;
  align-items: center;
  position: relative;
  height: 40px;
  /* Shadow applied here to move with the shape */
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));

  /* Initial State: Hidden/Behind */
  transform: translateY(-50px) scale(0.5);
  opacity: 0;
  animation: morph-appear 0.4s forwards;
}

.half-circle {
  width: 20px;
  /* Half of 40px */
  height: 40px;
  background-color: var(--color-white);
  flex-shrink: 0;
}

.half-circle.left {
  border-radius: 20px 0 0 20px;
}

.half-circle.right {
  border-radius: 0 20px 20px 0;
}

.anim-bar-body {
  height: 40px;
  width: 0;
  background-color: var(--color-white);
  transition: width 0.4s ease-out;
  /* Smooth expansion */
}

[data-theme="dark"] .half-circle,
[data-theme="dark"] .anim-bar-body {
  background-color: var(--color-white);
  /* using the theme variable */
}

.vertical-line {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 20px;
  /* Vertical line */
  background-color: var(--color-text-main);
  transition: opacity 0.2s;
  z-index: 2;
}


.search-anim-wrapper.spreading .vertical-line {
  opacity: 0;
  /* Vanish line */
}

.search-anim-wrapper.spreading .anim-bar-body {
  width: calc(100vw - 80px);
  /* 100vw total - 40px circles - 40px padding/margins (approx) to be safe */
  /* 100% total - 40px for circles (20px each side) */
  max-width: 300px;
  /* Cap it (340px total - 40px) */
  transition: width 0.4s ease-out;
}

@keyframes morph-appear {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.no-transition {
  transition: none !important;
}

/* Mobile Accordion Logic for Tables */
@media (max-width: 768px) {

  /* Use almost full width on mobile for container/table */
  /* Use almost full width on mobile for container/table */
  .container {
    padding: 0 10px;
    /* Slight padding for breathing room */
  }

  /* Icon-only buttons on mobile */
  #filter-toggle-btn .btn-text,
  #reset-filters .btn-text {
    display: none;
  }

  #filter-toggle-btn,
  #reset-filters {
    padding: 0;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #filter-toggle-btn i,
  #reset-filters i {
    transform: none;
    margin: 0;
    font-size: 1.2rem;
  }

  /* Remove outer wrapper styles since rows are cards now */
  .table-responsive {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin-bottom: 0;
  }

  .industries-table tbody tr {
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
    /* Full width feel or square corners? User said "adjust container width". Let's keep rounded but ensure it fits. */
    border-radius: var(--radius-md);
  }

  .industries-table {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .industries-table thead {
    display: none;
  }

  .industries-table tbody {
    display: block;
    width: 100%;
  }

  .industries-table tbody tr {
    display: block;
    margin-bottom: 0.5rem;
    /* Reduce gap */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    cursor: pointer;
    position: relative;
  }

  .industries-table tbody td {
    display: none;
    /* Hide all by default */
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-bg-light);
    text-align: right;
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  /* Show Name Column always (it's the 2nd column in both tables) */
  .industries-table tbody td:nth-child(2) {
    display: block;
    text-align: left;
    /* Remove font-weight and color to let inner elements control it */
    /* font-weight: 600; */
    /* color: var(--color-primary); */
    background-color: transparent;
    /* Seamless with row */
    border-bottom: none;
    /* No border if collapsed, effectively. But if expanded, we might want one. Let's keep one if expanded? For now remove to look like "info". */
    border-bottom: 1px solid transparent;
    padding-right: 2.5rem;
    /* Space for chevron */
    position: relative;
    white-space: normal;
    /* Allow wrapping */
    word-break: break-word;
    /* Break long words if necessary */
    overflow-wrap: break-word;
    /* Standard property */
    height: auto;
    /* Let it grow */
  }

  /* Add Chevron to Name */
  .industries-table tbody td:nth-child(2)::after {
    content: "\ea4e";
    /* ri-arrow-down-s-line */
    font-family: 'remixicon';
    position: absolute;
    right: 1rem;
    top: 1rem;
    /* Align top for multi-line text */
    transform: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    transition: transform 0.3s;
  }

  /* Rotate chevron when expanded */
  .industries-table tbody tr.expanded td:nth-child(2)::after {
    transform: rotate(180deg);
  }

  /* Show other columns when expanded and add border to name cell */
  .industries-table tbody tr.expanded td:nth-child(2) {
    border-bottom: 1px solid var(--color-border);
    display: block;
    /* Keep block layout inside */
  }

  /* Show other columns when expanded */
  .industries-table tbody tr.expanded td {
    display: flex;
  }

  /* Add Labels via data-attribute */
  .industries-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-right: auto;
    /* Push value to right */
    white-space: nowrap;
    /* Keep label on one line */
  }

  /* Remove label for Name column on mobile */
  .industries-table tbody td:nth-child(2)::before {
    content: none !important;
  }

  /* Adjust first column (ID/No) styling if needed */
  .industries-table tbody td:first-child {
    display: none !important;
    /* Hide standalone ID column on mobile */
  }

  .industries-table tbody td:last-child {
    border-bottom: none;
  }

  /* Mobile Only ID Styles */
  .mobile-only-id {
    display: inline;
    font-weight: 700;
    color: var(--color-text-main);
    /* Force black/dark grey */
    margin-right: 0.25rem;
  }

  .status-wrapper {
    justify-content: flex-end;
    /* Align right on mobile */
  }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 769px) {

  .mobile-only-id,
  .mobile-only {
    display: none;
  }
}

/* Books Store Layout */
.store-layout {
  display: flex;
  gap: 2rem;
  margin-top: 0;
}

.store-filters {
  flex: 0 0 250px;
  background: var(--color-white);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  height: fit-content;
  position: sticky;
  top: 90px;
}

.store-filters h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-bg-light);
  padding-bottom: 0.5rem;
}

.store-filters .filter-group {
  margin-bottom: 1.2rem;
}

.store-filters .filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  background-color: var(--color-white);
  color: var(--color-text-main);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
}

.store-books {
  flex: 1;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* Book Card */
.book-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  height: 100%;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}

.book-details {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title-card {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author-card {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  flex: 1;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.book-tag {
  background: var(--color-bg-light);
  color: var(--color-primary);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.btn-book-action {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
  margin-top: auto;
}

/* Single Book View */
.single-book-container {
  display: flex;
  gap: 2rem;
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.single-book-cover {
  flex: 0 0 300px;
}

.single-book-cover img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.single-book-info {
  flex: 1;
}

.single-book-info h1 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.single-book-author {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.single-book-meta {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.meta-value {
  font-size: 1rem;
  color: var(--color-text-main);
  font-weight: 600;
}

.single-book-desc {
  line-height: 1.6;
  color: var(--color-text-main);
  margin-bottom: 2rem;
}

.single-book-desc p {
  white-space: pre-wrap;
}

.volumes-container {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.volumes-container h3 {
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
  color: var(--color-text-main);
}

.volumes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.volume-download-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-radius: 6px;
  height: auto;
  min-height: 54px;
}

.volume-download-btn i {
  font-size: 1.4rem;
  opacity: 0.9;
}

.vol-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.vol-action {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  font-weight: 500;
}

.vol-name {
  font-size: 0.9rem;
  font-weight: 700;
}

@media (max-width: 480px) {
  .volumes-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Ad Modal Timer */
.timer-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.timer-svg {
  transform: rotate(-90deg);
  width: 100px;
  height: 100px;
}

.timer-bg {
  fill: none;
  stroke: var(--color-bg-light);
  stroke-width: 8;
}

.timer-progress {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 8;
  stroke-dasharray: 283;
  /* 2 * pi * 45 */
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.ad-modal {
  max-width: 400px;
  padding: 2rem;
}

/* Responsive Books Grid */
@media (max-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .store-layout {
    flex-direction: column;
  }

  .store-filters {
    flex: none;
    width: 100%;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .single-book-container {
    flex-direction: column;
  }

  .single-book-cover {
    flex: none;
    max-width: 250px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns on mobile */
  }
}

/* Modal Base Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--color-white);
  padding: 2.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: modalPop 0.3s ease-out forwards;
}

@keyframes modalPop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.text-center {
  text-align: center;
}

/* --- Books Page Specific Styles --- */

/* Desktop Margins */
@media (min-width: 769px) {

  #books-main-view .container,
  #single-book-view .container {
    max-width: 100% !important;
    padding-left: 5% !important;
    padding-right: 5% !important;
  }

  #single-book-view .container {
    padding-left: 10% !important;
    padding-right: 10% !important;
  }
}

/* Add a very little padding for books page */
#books-main-view.page-content,
#single-book-view.page-content {
  padding-top: 1rem !important;
  padding-bottom: 2rem !important;
}

#books-main-view .article-content,
#single-book-view .article-content {
  max-width: 100% !important;
  margin: 0 !important;
}

/* Mobile Search & Filter UI */
.mobile-search-filter {
  display: none;
  /* Hidden by default, shown on mobile */
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  gap: 10px;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

#mobile-search-filter {
  padding-left: 40px;
  height: 45px;
  border-radius: 8px;
}



@media (max-width: 768px) {
  .mobile-search-filter {
    display: flex;
  }

  .mobile-hidden {
    display: none;
  }

  .store-filters {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: var(--color-white);
    padding: 2rem;
    overflow-y: auto;
  }

  .store-filters.active {
    display: block;
    animation: slideInUp 0.3s ease-out;
  }

  @keyframes slideInUp {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  .close-filters-btn {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: var(--color-text-muted);
    cursor: pointer;
  }
}

@media (min-width: 769px) {
  .close-filters-btn {
    display: none;
  }
}

/* Single Book Layout with Ads */
.single-book-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.single-book-container {
  flex: 1;
}

.single-book-ads {
  flex: 0 0 240px;
  position: sticky;
  top: 90px;
}

.ad-sidebar-box {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.ad-content-placeholder {
  background: var(--color-bg-light);
  border: 2px dashed var(--color-border);
  height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  border-radius: 4px;
}

.ad-content-placeholder i {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 1100px) {
  .single-book-ads {
    display: none;
    /* Hide ad sidebar on smaller screens to keep content readable */
  }
}