:root { --sidebar-w: 350px; }
/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #c41e3a, #8b0000);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
  width: 145px;
  display: flex;
  align-items: center;
  gap: 1rem; /* space between the two logos */
}

.logo p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.wrv-logo {
  height: 40px;
  width: auto;
  margin-left: auto; /* pushes it to the far right */
}

/* Tablet and small laptops */
@media (max-width: 768px) {
  .header {
    padding: 0.5rem 0;  /* slightly shorter header on smaller screens */
  }
.logo h1 {
  width= 85px;
  width: auto;
  align-items: center;
  gap: 1rem; /* space between the two logos */
}

.logo p {
    font-size: 0.8rem;
    opacity: 0.9;
}

.wrv-logo {
  height: 25px;
  width: auto;
  margin-left: auto; /* pushes it to the far right */
}
}


/* Very small phones */
@media (max-width: 480px) {
.logo h1 {
  width= 65px;
  width: auto;
  align-items: center;
  gap: 1rem; /* space between the two logos */
}

.logo p {
    font-size: 0.7rem;
    opacity: 0.7;
}

.wrv-logo {
  height: 20px;
  width: auto;
  margin-left: auto; /* pushes it to the far right */
}

}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e0e0e0;
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.sidebar-content {
    padding: 1rem;
    
}

.sidebar h3 {
    color: #c41e3a;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.toc-list {
    list-style: none;
}

.toc-list > li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: #333;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    display: block;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.toc-list a:hover {
    background-color: #f0f0f0;
    color: #c41e3a;
    transform: translateX(5px);
}

.toc-list a.active {
    background-color: #c41e3a;
    color: white;
    
}

.sub-toc {
    list-style: none;
    margin-top: 0.5rem;
    margin-left: 1rem;
}

.sub-toc li {
    margin-bottom: 0.25rem;
}

.sub-toc a {
    font-size: 0.9rem;
    font-weight: 400;
    padding: 0.25rem 0.5rem;
}

/* Content */
.content {
    flex: 1;
    padding: 1rem;
    background: white;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content h2 {
    color: #c41e3a;
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid #c41e3a;
    padding-bottom: 0.5rem;
}

.content h3 {
    color: #333;
    font-size: 1.4rem;
    margin: 1.5rem 0 1rem 0;
}

.content h4 {
    color: #555;
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem 0;
}

.content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.content ul {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content li {
    margin-bottom: 0.5rem;
}

/* Collapsible sections */
.collapsible-section {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-header {
    width: 100%;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: none;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

.collapsible-header.active {
    background: linear-gradient(135deg, #c41e3a, #8b0000);
    color: white;
}

.toggle-icon {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.collapsible-header.active .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 1.5rem;
    background: white;
    display: none;
    animation: slideDown 0.3s ease;
}

.collapsible-content.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

/* Safety warnings */
.safety-DANGER {
    color: #dc3545;
    background: #f8d7da;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
}

.safety-WARNING {
    color: #856404;
    background: #fff3cd;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
}

.safety-CAUTION {
    color: #0c5460;
    background: #d1ecf1;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
}

/* Images */
.manual-image {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-caption {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.image-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-gallery img:hover {
    transform: scale(1.05);
}

/* Quick links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.quick-link-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #c41e3a;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quick-link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.quick-link-card h3 {
    color: #c41e3a;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.quick-link-card p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.quick-link-card a {
    color: #c41e3a;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 2px solid #c41e3a;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.3s ease;
}

.quick-link-card a:hover {
    background-color: #c41e3a;
    color: white;
}

/* Safety notice */
.safety-notice {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.safety-notice h3 {
    color: #856404;
    margin-bottom: 1rem;
}

.safety-notice p {
    color: #856404;
    margin-bottom: 1rem;
}

.safety-notice ul {
    color: #856404;
}

.safety-notice li {
    margin-bottom: 0.5rem;
}

/* Section content */
.section-content {
    margin-top: 1.5rem;
}

/* Footer */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    font-size: small;
    padding: 0.1rem;
    margin-top: auto;
}

/* Search functionality */
.search-container {
    margin-bottom: 0.6rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #e0e0e0;
}

.search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: #c41e3a;
}

.search-results { padding: 0.25rem 0 0; max-height: 40vh; overflow: auto; }

.search-result {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.search-result:hover {
    background: #e9ecef;
}

.no-results {
    padding: 0.5rem;
    color: #666;
    font-style: italic;
    font-size: 0.9rem;
}

.print-button {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.print-button:hover {
    background: rgba(255,255,255,0.3);
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(196, 30, 58, 0.2);
    z-index: 1000;
}

.progress-fill {
    height: 100%;
    background: #c41e3a;
    width: 0%;
    transition: width 0.1s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        display: none;
    }
    
    .sidebar.active {
        display: block;
    }
    
    .content {
        margin: 0;
        border-radius: 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .quick-links {
        grid-template-columns: 1fr;
    }
    
    .content h2 {
        font-size: 1.5rem;
    }
    
    .print-button {
        display: none;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar-content {
        padding: 1rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1rem;
        width: 75px;
    }
    
    .logo p {
        font-size: 0.7rem;
    }
    
    .collapsible-header {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .collapsible-content {
        padding: 1rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Print styles */
@media print {
    .header, .sidebar, .footer {
        display: none;
    }
    
    .content {
        margin: 0;
        box-shadow: none;
        padding: 0;
    }
    
    .content-section {
        display: block !important;
        page-break-before: always;
    }
    
    .content-section:first-child {
        page-break-before: auto;
    }
    
    .collapsible-content {
        display: block !important;
    }
    
    .collapsible-header {
        display: none;
    }
}

/* MENU SETUP */
.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-header span {
  font-size: 1.2rem;
  font-weight: bold;
}

.menu-home {
  color: inherit;
  text-decoration: none;
  font-size: 1.2rem;
}

.menu-home:hover {
  color: #c41e3a; /* Honda red highlight on hover */
}

/* Search UI */
.search-container { 
    margin-bottom: 0.6rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #e0e0e0;
}

.search-input { 
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-results { padding: 0.25rem 0 0; max-height: 40vh; overflow: auto; }
.search-result { padding: 6px 4px; cursor: pointer; border-radius: 4px; }
.search-result:hover { background: #f5f5f5; }
.search-result-title { color: #b80000; }
.search-result-snippet { font-size: .9em; color: #555; }
.no-results { color: #777; padding: 8px 0; }



/* Ensure search visible even if sidebar not found */
.search-fallback-fixed {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 9999;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
  border-radius: 8px;
  padding: 8px;
}


/* ===== Desktop viewport-fit sizing (no page scrollbar) ===== */
@media (min-width: 769px) {
  html, body { height: 100%; }
  body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;            /* hide page scroll; scroll happens inside columns */
  }
  .main-content {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    min-height: 0;
    overflow: hidden;            /* contain inner scrolling */
  }
  #sidebar, .sidebar {
    flex: 0 0 var(--sidebar-w) !important;
    width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
    min-width: 240px;
    position: sticky;
    top: var(--header-h, 0px);
    height: calc(100dvh - var(--header-h, 0px) - var(--footer-h, 0px));
    overflow: auto;
    box-sizing: border-box;
  }
  .content {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;            /* the iframe wrapper will scroll if needed */
    margin: 0;
  }
  .iframe-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    height: calc(100dvh - var(--header-h, 0px) - var(--footer-h, 0px));
    overflow: hidden;
  }
  .main-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
  }
}

/* ===== Mobile stays stacked; page can scroll normally ===== */
@media (max-width: 768px) {
  body { overflow: auto; }
}


/* ===== Desktop viewport-fit sizing (no page scrollbar, no footer push) ===== */
@media (min-width: 769px) {
  html, body { height: 100%; }
  body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;            /* prevent outer scrollbar */
  }

  .main-content {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    min-height: 0;
    height: calc(100dvh - var(--header-h, 0px) - var(--footer-h, 0px));
    overflow: hidden;            /* contain scroll inside columns */
  }

  #sidebar, .sidebar {
    flex: 0 0 var(--sidebar-w) !important;
    width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
    min-width: 240px;
    position: sticky;
    top: var(--header-h, 0px);
    height: calc(100dvh - var(--header-h, 0px) - var(--footer-h, 0px));
    overflow: auto;
    box-sizing: border-box;
  }

  .content {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;            /* the iframe wrapper will scroll */
    margin: 0;
  }

  .iframe-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;                /* let flex size it */
    max-height: none;
    overflow: hidden;            /* iframe scrolls internally */
  }

  .main-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
  }
}

/* ===== Mobile: allow outer scroll and JS height sizing ===== */
@media (max-width: 768px) {
  body { overflow: auto; }
}

/* === Mobile stack + stable content height (no tiny box) === */
@media (max-width: 768px) {
  /* Stack layout on mobile */
  .main-content { display: block; height: auto; overflow: visible; }
  #sidebar, .sidebar {
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    overflow: visible;
  }

  /* The content column should NOT constrain the iframe wrapper */
  .content {
    display: block;
    height: auto;
    min-height: 0;
    margin: 0;
    overflow: visible;
  }

    /* Base fallback: use classic vh */
  .iframe-wrapper {
    position: relative;
    height: calc(100vh - var(--header-h, 0px) - var(--footer-h, 0px) - var(--content-header-h, 0px));
    max-height: none;
    overflow: hidden;
  }

  /* Use small viewport height when supported (older behaviour) */
  @supports (height: 100svh) {
    .iframe-wrapper {
      height: calc(100svh - var(--header-h, 0px) - var(--footer-h, 0px) - var(--content-header-h, 0px));
    }
  }

  /* Prefer modern dynamic viewport (accounts for URL bar show/hide) */
  @supports (height: 100dvh) {
    .iframe-wrapper {
      height: calc(100dvh - var(--header-h, 0px) - var(--footer-h, 0px) - var(--content-header-h, 0px));
    }
  }

  /* Iframe fills wrapper */
  .main-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    position: static;
  }

  .main-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    position: static;
  }
}


#version-badge { display: none !important;  }
/* === Search spacing override (forced) === */
.sidebar .search-container,
#sidebar .search-container,
.search-container {
  margin-bottom: 0.6rem !important;
  padding-bottom: 0.2rem !important;
  border-bottom: 1px solid #e0e0e0;
}
.search-results {
  padding-top: 0.25rem !important;
  padding-bottom: 0 !important;
}



/* === Layout Overrides v3 – 2025-11-24 ===
   Simplify layout, avoid viewport-unit height math on iframe,
   and ensure content fills space between header and footer on all screens.
*/

html, body {
/* Fallback for older browsers */
  height: 100%; 
  /* Modern fix: stretches to fill screen when URL bar hides */
  min-height: 100dvh; 
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevents horizontal scroll if widths are off */
}

body {
  display: flex;
  flex-direction: column;
}

/* Full-page container */
.container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* Ensure container also grows with the dynamic viewport */
  min-height: 100dvh; 
}

/* Main content area between header and footer */
.main-content {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}

/* Sidebar column (desktop baseline) */
#sidebar,
.sidebar {
  flex: 0 0 var(--sidebar-w) !important;
  width: var(--sidebar-w) !important;
  max-width: var(--sidebar-w) !important;
  min-width: 240px;
  overflow-y: auto;
}

/* Content column hosting iframe */
main.content,
.content {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 1rem;
}

/* Wrapper around iframe */
.iframe-wrapper {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden;
}

/* Iframe itself fills wrapper */
.main-frame {
  display: block;
  width: 100%;
  height: 100% !important;
  border: 0;
}

/* Footer just sits at the bottom of the flex column */
.footer {
  flex-shrink: 0;
}

/* ==== Mobile: stack sidebar above content, still flex-based ==== */
@media (max-width: 768px) {

  .main-content {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 0.75rem 1rem;
  }

 #sidebar,
  .sidebar {
        /* Turn into a full-screen overlay */
        position: fixed !important; 
        top: var(--header-h, 60px); 
        left: 0;
        bottom: 0; 
        width: 100% !important;
        height: auto !important; 
        
        /* Ensure it sits on top */
        z-index: 1001; 
        background: white;
        
        /* Allow scrolling ONLY inside the menu */
        overflow-y: auto; 
        -webkit-overflow-scrolling: touch; 
        
        /* HIDDEN BY DEFAULT */
        display: none;
        border-right: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    
    /* SHOW WHEN ACTIVE - Added #sidebar.active and !important */
    #sidebar.active,
    .sidebar.active {
        display: block !important;
    }
    
    .sidebar-content {
        padding-bottom: 80px !important; 
    }

  main.content,
  .content {
    margin: 0 !important;
  }

  .iframe-wrapper {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }
}
