/* Enhanced Modern CSS for Nursery Pages - Mobile & SEO Optimized */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Georgia', serif !important;
    line-height: 1.6 !important;
    color: #2d3748 !important;
    background: url('../images/image_side4.jpg') repeat !important;
    background-attachment: fixed !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Site wrapper */
.site-wrapper {
    max-width: 1400px !important;
    margin: 0 auto !important;
    background: linear-gradient(135deg, rgba(247, 250, 252, 0.95) 0%, rgba(237, 242, 247, 0.95) 100%) !important;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2) !important;
    min-height: 100vh;
}

/* DESKTOP SITE WRAPPER EFFECT - Only on screens wider than 1400px */
@media (min-width: 1401px) {
    /* Target the main outer table to act as site wrapper - Completely transparent */
    table[cellspacing="0"][cellpadding="4"][bgcolor="#003300"] {
        max-width: 1400px !important;
        margin: 0 auto !important;
        background: transparent !important; /* Completely transparent - no layer */
        box-shadow: none !important; /* No shadow */
        min-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }
    
    /* Body background - Natural background image */
    body {
        background: url('http://www.bulbmeister.com/images/image_side4.jpg') repeat !important;
        background-attachment: fixed !important;
    }
    
    /* Keep header table full width above wrapper */
    table:first-of-type {
        max-width: none !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border: none !important;
        background: white !important;
    }
    
    /* Ensure content inside wrapper has proper spacing */
    table[cellspacing="0"][cellpadding="4"][bgcolor="#003300"] td {
        background: transparent !important;
    }
}

/* HAMBURGER MENU STYLES */
.hamburger-menu {
    display: none;
    background: rgba(45, 80, 22, 0.95);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.6rem;
    z-index: 1001;
    position: fixed;
    top: 12px;
    right: 12px;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

.hamburger-menu:hover {
    background: rgba(106, 168, 79, 1);
    transform: scale(1.05);
}

/* Mobile Sidebar Menu */
.mobile-menu {
    position: fixed !important;
    top: 0 !important;
    left: -300px !important;
    width: 300px !important;
    height: 100vh !important;
    background: linear-gradient(135deg, #2d5016 0%, #4a7c29 100%) !important;
    z-index: 1000 !important;
    transition: left 0.3s ease !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
}

.mobile-menu.open {
    left: 0 !important;
}

.mobile-menu-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-logo {
    color: white !important;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.close-menu:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.mobile-nav-links {
    padding: 1rem 0;
}

.mobile-nav-links a {
    display: block;
    color: white !important;
    text-decoration: none;
    padding: 1.2rem 1.5rem;
    transition: background 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    font-weight: 500;
}

.mobile-nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-links a.active {
    background: rgba(255, 255, 255, 0.2);
    border-left: 4px solid white;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Header styling */
table[bgcolor="#FFFFFF"] {
    background: white !important;
    color: #2d3748 !important;
}

td[height="48"] {
    background: white !important;
    padding: 1rem !important;
    position: relative;
}

/* Form styling */
select, input[type="submit"] {
    padding: 0.8rem 1rem !important;
    border: 2px solid #e8f5e8 !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    margin: 0.25rem !important;
    transition: all 0.3s ease !important;
}

select:focus {
    border-color: #4a7c29 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(74, 124, 41, 0.2) !important;
}

input[type="submit"] {
    background: linear-gradient(135deg, #4a7c29 0%, #2d5016 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.8rem 1.5rem !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    font-weight: bold !important;
    transition: all 0.3s ease !important;
}

input[type="submit"]:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(74, 124, 41, 0.3) !important;
}

input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Legacy table styling preservation */
table[bgcolor="#003300"] {
    background: transparent !important;
}

table[bgcolor="#ffffff"] {
    background: white !important;
    border-radius: 15px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    margin: 1rem !important;
}

/* Title styling */
h2 {
    color: #2d5016 !important;
    font-size: 2.5rem !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 1.5rem !important;
}

h3 {
    color: #2d5016 !important;
    font-size: 1.8rem !important;
    margin: 1.5rem 0 1rem 0 !important;
}

/* Paragraph styling */
p {
    font-size: 1.1rem !important;
    margin-bottom: 1rem !important;
    text-align: justify !important;
}

/* Link styling */
a {
    color: #4a7c29 !important;
    text-decoration: none !important;
    font-weight: bold !important;
    transition: color 0.3s ease !important;
}

a:hover {
    color: #2d5016 !important;
    text-decoration: underline !important;
}

/* HR styling */
hr {
    border: none !important;
    height: 2px !important;
    background: linear-gradient(135deg, #4a7c29 0%, #2d5016 100%) !important;
    margin: 2rem 0 !important;
    border-radius: 2px !important;
}

/* Credit card images */
img[src*="cc_small_new.gif"] {
    border-radius: 5px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

/* Special text styling */
font[color="#990033"] {
    color: #cc0099 !important;
    font-style: italic !important;
}

font[color="red"] {
    color: #d63384 !important;
    font-weight: bold !important;
}

/* Preserve genus header styling */
table[border="1"][bordercolor="#006600"] td[bgcolor="#006600"] {
    background: linear-gradient(135deg, #006600, #008800) !important;
    color: #FFFF00 !important;
}

table[border="1"][bordercolor="#006600"] td[bgcolor="#CCFFCC"] {
    background: #CCFFCC !important;
    color: #003300 !important;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
button:focus,
input:focus,
select:focus,
a:focus {
    outline: 3px solid #4a7c29;
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* MOBILE FIXES - ONLY WIDTH AND SCALING */
@media (max-width: 768px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden !important;
    }
    
    /* Fix viewport height issues on mobile */
    html, body {
        min-height: 100vh !important;
        height: auto !important;
        overflow-y: auto !important;
    }
    
    /* Force content to not extend beyond viewport */
    html {
        height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
    
    /* Ensure page ends properly at footer */
    body::after {
        content: "";
        display: block;
        height: 1px;
        clear: both;
    }
    
    /* Constrain the overall page height */
    .site-wrapper {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    /* Hide featured products row when you add the ID */
    #featured-products-row {
        display: none !important;
    }
    
    /* Alternative if you use class instead */
    .featured-products {
        display: none !important;
    }
    
    /* Alternative if you use data attribute */
    tr[data-section="featured-products"] {
        display: none !important;
    }
    
    /* Fix header address alignment - override the align=right attribute */
    td[bgcolor="#2d5016"][align="right"] {
        text-align: left !important;
        padding-left: 15px !important;
    }
    
    /* Also target any font elements inside */
    td[bgcolor="#2d5016"] font {
        text-align: left !important;
    }
    
    /* Show hamburger menu with lighter green - adjusted for header scaling */
    .hamburger-menu {
        display: flex !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
        border-radius: 25px !important;
        background: rgba(106, 168, 79, 0.9) !important; /* Lighter green */
    }
    
    .hamburger-menu:hover {
        background: rgba(106, 168, 79, 1) !important; /* Lighter green on hover */
    }
    
    /* Adjust mobile menu */
    .mobile-menu {
        width: 320px !important;
        left: -320px !important;
    }
    
    .mobile-nav-links a {
        padding: 1.3rem 1.8rem !important;
        font-size: 1.1rem !important;
    }
    
    /* Remove site wrapper constraints */
    .site-wrapper {
        max-width: none !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
    
    /* Scale everything to fit - back to simple approach */
    body {
        transform: scale(0.8);
        transform-origin: top left;
        width: 125%;
    }
}

/* PORTRAIT MODE - Hide image column and smaller navigation text */
@media (max-width: 768px) and (orientation: portrait) {
    /* Hide the search form section in portrait mode */
    #search-form-section {
        display: none !important;
    }
    
    /* Alternative if you use class instead */
    .search-controls {
        display: none !important;
    }
    
    /* Improve footer navigation for portrait mode */
    p[align="Center"] {
        text-align: left !important;
        line-height: 2.5 !important;
        padding: 15px !important;
    }
    
    p[align="Center"] a {
        display: inline-block !important;
        padding: 8px 12px !important;
        margin: 4px 2px !important;
        background: rgba(74, 124, 41, 0.1) !important;
        border-radius: 20px !important;
        text-decoration: none !important;
        font-size: 0.9rem !important;
        border: 1px solid rgba(74, 124, 41, 0.3) !important;
    }
    
    p[align="Center"] a:hover {
        background: rgba(74, 124, 41, 0.2) !important;
        transform: none !important;
    }
    
    /* Hide the pipe separators */
    p[align="Center"] {
        word-spacing: 0 !important;
    }
    
    tr[height="520"] td[width="436"] {
        display: none !important;
    }
    
    tr[height="520"] td[width="363"] {
        width: 100% !important;
    }

    /* Hide large image in portrait */
    #main-image-column {
        display: none !important;
    }
    
    /* Make navigation table text much smaller in portrait */
    table[border="1"][cellpadding="2"] {
        font-size: 0.7rem !important;
    }
    
    table[border="1"][cellpadding="2"] a {
        font-size: 0.8rem !important;
        padding: 4px !important;
        line-height: 1.2 !important;
    }
    
    /* Smaller subtext (genus names) */
    table[border="1"][cellpadding="2"] td {
        font-size: 0.6rem !important;
        padding: 6px !important;
    }
    
    /* Make page number text smaller */
    table[border="1"][cellpadding="2"] font[size="+2"] {
        font-size: 1rem !important;
    }
}

/* LANDSCAPE MODE - AGGRESSIVE SCALING FOR SHORT HEIGHT VIEWPORT */
@media (max-width: 768px) and (orientation: landscape) {
    /* Much smaller scale for the short 313px height */
    body {
        transform: scale(0.6) !important;
        transform-origin: top left !important;
        width: 166.67% !important; /* Compensate for 60% scale */
    }
    
    /* Don't scale the main table since body is handling it */
    table[cellspacing="0"][cellpadding="4"][bgcolor="#003300"] {
        transform: none !important;
        width: 100% !important;
    }
    
    /* Keep header normal size */
    table:first-of-type {
        width: 100% !important;
    }
    
    /* Ensure page ends properly */
    body::after {
        content: "";
        display: block;
        height: 1px;
        clear: both;
    }
    
    .hamburger-menu {
        background: rgba(106, 168, 79, 0.9) !important;
    }
    
    .hamburger-menu:hover {
        background: rgba(106, 168, 79, 1) !important;
    }
}

@media (max-width: 480px) {
    input[type="submit"] {
        width: 100% !important;
        max-width: 250px;
        margin: 0.5rem auto !important;
        display: block !important;
    }
}

/* Modern Footer Styles */
.modern-footer {
    background: linear-gradient(135deg, #2d5016 0%, #4a7c29 100%);
    color: white;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-radius: 15px 15px 0 0;
}

.footer-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white !important;
    text-decoration: none !important;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: #a0d468 !important;
}

.nav-icon {
    font-size: 1.1rem;
}

/* Mobile footer optimization */
@media (max-width: 768px) {
    .footer-nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .footer-nav-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-section {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Print styles */
@media print {
    .hamburger-menu,
    .mobile-menu,
    .menu-overlay,
    .footer-nav,
    .modern-footer {
        display: none !important;
    }
    
    .site-wrapper {
        box-shadow: none !important;
        background: white !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}