/* ==========================================================================
   Shared Responsive Components
   Included globally via header.ejs
   Note: Base variables are defined in theme-variables.css
   ========================================================================== */

/* Mobile Nav Variables - extend base theme variables */
:root {
  /* Navigation-specific variables using base theme colors */
  --nav-bg: var(--color-bg-primary);
  --nav-text: var(--color-text-primary);
  --nav-link-color: var(--color-primary);
  --nav-link-size: 18px;
  --nav-link-weight: 400;
  --nav-border-color: var(--color-border-light);
  --nav-hover-bg: var(--color-bg-secondary);
  --nav-header-bg: transparent;
  --nav-header-text: var(--color-text-primary);
}

/* Admin Theme Variables - override for admin pages */
.admin-page {
  --nav-bg: var(--color-accent-green-bg);
  --nav-text: #222;
  --nav-link-color: #222;
  --nav-link-size: 17px;
  --nav-link-weight: 600;
  --nav-border-color: rgba(160, 188, 71, 0.2);
  --nav-hover-bg: rgba(160, 188, 71, 0.15);
  --nav-header-bg: linear-gradient(135deg, var(--color-accent-green) 0%, var(--color-accent-green-dark) 100%);
  --nav-header-text: white;
  --color-primary: var(--color-accent-green-dark);
  --color-primary-hover: var(--color-accent-green);
}

/* Remove fixed width constraints on responsive pages */
html.responsive {
  min-width: 0 !important;
}

/* Reset negative margins that pull content up */
.responsive #backgroundborder {
  margin-top: 0 !important;
}

/* ==========================================================================
   Breadcrumb Navigation
   ========================================================================== */
.responsive .backgroundbox h4:first-of-type {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
}

.responsive .backgroundbox h4:first-of-type * {
  position: static !important;
  margin: 0 !important;
  height: auto !important;
  color: inherit;
  font-weight: normal !important;
  font-size: inherit !important;
}

.responsive .backgroundbox h4:first-of-type a:last-of-type {
  font-weight: bold !important;
}

.responsive .backgroundbox h4:first-of-type a:hover {
  text-decoration: underline;
}

.responsive .backgroundbox h4:first-of-type br,
.responsive .backgroundbox h4:first-of-type [style*="visibility:hidden"],
.responsive .backgroundbox h4:first-of-type [style*="visibility: hidden"] {
  display: none !important;
}

/* Hamburger menu - hidden on desktop */
.hamburger-menu,
.mobile-nav-menu,
.mobile-nav-close,
.nav-overlay {
  display: none;
}

@media (max-width: 900px) {
  html.responsive,
  .responsive body {
    min-width: 0 !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* =====================
     Hamburger Button
     ===================== */
  .responsive .hamburger-menu {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--color-primary);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .responsive .hamburger-menu:active {
    background-color: var(--color-primary-hover);
    color: white;
  }

  /* =====================
     Nav Overlay
     ===================== */
  .responsive .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
  }

  .responsive .nav-overlay.active {
    display: block;
  }

  /* =====================
     Mobile Nav Menu
     ===================== */
  .responsive .mobile-nav-menu {
    display: block !important;
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background-color: var(--nav-bg);
    z-index: 1003;
    overflow-y: auto;
    transition: right 0.3s ease-in-out;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
  }

  .responsive .mobile-nav-menu.open {
    right: 0;
  }

  /* Close button */
  .responsive .mobile-nav-close {
    display: block !important;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 32px;
    cursor: pointer;
    color: var(--color-primary);
  }

  /* Mobile nav header (optional - for themed navs) */
  .responsive .mobile-nav-header {
    padding: var(--space-lg) var(--space-md);
    border-bottom: 2px solid var(--nav-border-color);
    background: var(--nav-header-bg);
  }

  .responsive .mobile-nav-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--nav-header-text);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  }

  /* Mobile nav user info */
  .responsive .mobile-nav-user {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--nav-border-color);
    cursor: pointer;
  }

  .responsive .mobile-nav-user:active {
    background-color: var(--nav-hover-bg);
  }

  .responsive .mobile-nav-userpic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: var(--space-sm);
  }

  .responsive .mobile-nav-username {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: var(--nav-text);
    margin-bottom: var(--space-sm);
  }

  /* Mobile nav links */
  .responsive .mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: var(--space-md) 0;
  }

  .responsive .mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-md);
    color: var(--nav-link-color);
    text-decoration: none;
    font-size: var(--nav-link-size);
    font-weight: var(--nav-link-weight);
    border-bottom: 1px solid var(--nav-border-color);
    min-height: var(--touch-target-min);
    transition: background 0.2s;
  }

  .responsive .mobile-nav-links a:hover,
  .responsive .mobile-nav-links a:active {
    background-color: var(--nav-hover-bg);
  }

  /* Nav icon for links with icons */
  .responsive .mobile-nav-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
  }

  /* Nav divider */
  .responsive .mobile-nav-divider {
    height: 1px;
    background: var(--nav-border-color);
    margin: var(--space-sm) var(--space-md);
  }

  /* =====================
     Navbar (#smalltop) Adjustments
     ===================== */
  .responsive #smalltop {
    min-width: 0 !important;
    padding: 0 var(--space-sm);
    height: 50px;
    display: flex;
    align-items: center;
  }

  .responsive #smalltop #userpic,
  .responsive #smalltop #toptooltip2,
  .responsive #smalltop #toptooltip3,
  .responsive #smalltop .nav,
  .responsive #smalltop .user-hover-box {
    display: none !important;
  }

  .responsive #smalltop .wordcradle_title {
    font-size: 18px;
    margin: 0;
    padding: 0;
    height: auto;
    line-height: 50px;
  }

  /* =====================
     Shared Button Styles
     ===================== */
  .responsive button,
  .responsive input[type="submit"],
  .responsive .button {
    min-height: var(--touch-target-min);
    font-size: 16px;
    padding: var(--space-sm) var(--space-md);
    border-radius: 4px;
    cursor: pointer;
  }

  /* Primary blue buttons */
  .responsive button.button,
  .responsive button.save,
  .responsive button.blog_button,
  .responsive button.my_blog_button,
  .responsive form button,
  .responsive .btn-primary {
    background-color: var(--color-button);
    color: white;
    border: 1px solid var(--color-button);
    min-height: var(--touch-target-min);
    font-size: 16px;
  }

  .responsive button.button:hover,
  .responsive button.save:hover,
  .responsive button.blog_button:hover,
  .responsive button.my_blog_button:hover,
  .responsive form button:hover,
  .responsive .btn-primary:hover {
    background-color: var(--color-button-hover);
    border-color: var(--color-button-hover);
  }

  /* Full-width buttons on mobile */
  .responsive .btn-full-width,
  .responsive form button {
    width: 100%;
    max-width: 100%;
  }

  /* =====================
     Background/Content Containers
     ===================== */
  .responsive #backgroundborder {
    min-width: 0 !important;
  }

  .responsive .backgroundbox {
    width: 100% !important;
    min-width: 0 !important;
    padding: var(--space-md);
    padding-top: var(--space-md);
    box-sizing: border-box;
  }

  /* Hide all br tags on mobile */
  .responsive body > br,
  .responsive .backgroundbox > br,
  .responsive .backgroundbox h4:first-of-type ~ br {
    display: none;
  }

  /* =====================
     Breadcrumb (mobile)
     ===================== */
  .responsive .backgroundbox h4:first-of-type {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    font-size: 13px;
    margin: 0 0 var(--space-sm) 0;
  }

  /* =====================
     Page Titles
     ===================== */
  .responsive .backgroundbox h1.page_title {
    margin-top: var(--space-sm) !important;
    margin-bottom: var(--space-md) !important;
  }

  /* =====================
     Footer
     ===================== */
  .responsive .footer {
    position: relative;
    height: auto;
    padding: var(--space-md);
    text-align: center;
  }
}
