:root {
    --color-primary: #826894;
    --color-accent: #333333;
    --color-white: #fff;
    --color-black: #000;
    --color-default: #777777;
    --color-text-dark: #191919;
    --color-text-light: #333333;
    --color-border-color: #ececec;
    --color-card: #fff; /* Changed to pure white */
    --font-family-base: 'Ubuntu', sans-serif;
}

html, body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #FFFFFF; /* Clean white background to match the logo */
    color: #333; /* Dark text for readability on a light background */
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    padding-top: 60px; /* Offset for the fixed header */
    min-height: 100vh; /* Ensure body takes full viewport height */
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-base);
    color: var(--color-text-dark);
    text-transform: uppercase;
    margin-top: 0;
    margin-bottom: 0.5em;
    font-weight: 500;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: 0.3s ease;
}

a:hover {
    color: var(--color-accent);
}

/* ==========================================================================
   Header and Navigation - CORRECTED
   ========================================================================== */

/* --- Main Header Bar --- */
.header {
    background: linear-gradient(to right, var(--color-primary), #191919);
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999; /* raised so header is always on top */
    height: 60px;
    box-sizing: border-box;
    pointer-events: auto; /* ensure it can receive clicks */
}

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

/* --- Logos --- */
.logo-link {
    flex-shrink: 0;
}

.logo {
    height: 40px;
    width: auto;
}

/* --- Desktop Navigation --- */
.nav-container {
    display: flex;
    align-items: center;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* Display as a row on desktop */
    align-items: center;
}

.nav-menu li {
    margin: 0 1rem;
}

.nav-menu a {
    color: var(--color-white);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 0;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* --- Mobile Hamburger Button --- */
.menu-button {
    display: none; /* HIDDEN on desktop by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 100000; /* highest priority for clickable area */
    position: relative; /* ensure z-index is applied correctly */
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto; /* ensure clicks reach the button */
}

.menu-text {
    color: var(--color-white);
    font-size: 1rem;
    font-weight: 500;
}

.ss-logo {
    width: 40px;
    height: auto;
    border-radius: 50%;
}

/* ==========================================================================
   Responsive Styles for Mobile - CORRECTED
   ========================================================================== */
@media (max-width: 900px) {
    /* 1. Show the hamburger button on the left */
    .menu-button {
        display: flex;
    }

    /* 2. Hide the main site logo (the one in the top-left on desktop) */
    .logo-link {
        display: none;
    }

    /* 3. Hide the desktop navigation links by default */
    .nav-menu {
        display: none;
        position: fixed;
        top: 60px; /* Position it below the header */
        left: 0;
        right: 0;
        background-color: var(--color-primary); /* purple background to match header */
        flex-direction: column;
        padding: 1rem 0;
        text-align: center;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        z-index: 99998; /* below header but high enough to be on top of content */
        pointer-events: auto;
    }

    /* 4. When the menu is active, show it */
    .nav-menu.active {
        display: flex;
    }

    /* 5. Style the links inside the mobile menu for readability */
    .nav-menu.active a {
        color: var(--color-white) !important; /* white text for contrast */
        display: block;
        padding: 0.75rem 1rem;
    }

    .nav-menu.active a:hover {
        background-color: rgba(255, 255, 255, 0.08); /* subtle hover */
    }

    .nav-menu.active li {
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    /* Ensure header and hamburger are on top of page content */
    .header {
        z-index: 1100 !important;
        position: fixed; /* should already be fixed, keep explicit */
        pointer-events: auto;
    }

    .menu-button {
        z-index: 1101 !important;
        position: relative;
        pointer-events: auto;
    }

    /* Mobile nav: purple background, white links, high z-index */
    .nav-menu {
        display: none; /* default hidden */
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--color-primary) !important; /* purple */
        color: var(--color-white);
        flex-direction: column;
        padding: 1rem 0;
        text-align: center;
        box-shadow: 0 3px 10px rgba(0,0,0,0.12);
        z-index: 1099 !important; /* below header but above content */
        pointer-events: auto;
    }

    .nav-menu.active {
        display: flex !important;
    }

    .nav-menu a,
    .nav-menu a:visited {
        color: var(--color-white) !important;
        display: block;
        padding: 0.75rem 1rem;
    }

    .nav-menu a:hover,
    .nav-menu a:focus {
        background-color: rgba(255,255,255,0.06);
        color: var(--color-white) !important;
    }

    /* ensure clickable area for the button */
    .menu-button,
    .menu-button .ss-logo,
    .menu-button .menu-text {
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevent main content from covering header */
    main {
        position: relative;
        z-index: 0;
    }
}

/* Main Content and Cards */
main {
    padding: 2rem 0;
    flex: 1;
    position: relative;
    z-index: 0; /* keep main behind header */
}

.card {
    background-color: #FFFFFF; /* White card background */
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0; /* Add a subtle border to distinguish the card */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Softer shadow for light theme */
    margin-bottom: 1.5rem;
}

.card-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.card:hover {
    transform: translateY(-5px);
}

/* Blackout Buddy Specific Styles */
.instructions {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #fdfdfd;
    border-left: 4px solid var(--color-primary);
    border-radius: 4px;
}

.instructions ol {
    padding-left: 20px;
    margin: 0;
}

.appliance-grid {
    display: grid;
    gap: 1rem;
}

.appliance-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    align-items: center;
}

.appliance-row.grid-header {
    font-weight: bold;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border-color);
}

.appliance-row input,
.appliance-row select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border-color);
    border-radius: 4px;
}

.daily-kwh {
    font-weight: 500;
    text-align: center;
}

.results {
    margin-top: 2rem;
    padding: 1.5rem;
}

.recommendation-section ul {
    list-style: none;
    padding: 0;
}

.recommendation-section li {
    margin-bottom: 0.5rem;
}

.shop-link {
    color: #a9d4ff;
    font-weight: bold;
}

/* Style for the logo on the about page */
.about-page-logo {
    display: block;
    margin: 2rem auto;
    max-width: 320px;
    width: 100%;
    height: auto;
}

/* Footer */
footer {
    background-color: #1a1a1a;
    color: #a0a0a0;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    font-size: 0.85rem;
}

/* --- Main Content Styles --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card h3 {
    margin-bottom: 20px;
}

.card p {
    margin-top: 0;
    line-height: 1.4;
}

/* Forms and Inputs */
.field {
    margin-bottom: 1.5rem;
}

.label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text-dark);
}

input[type="text"],
input[type="number"],
input[type="email"],
select {
    width: 100%;
    padding: 13px 18px;
    border: 1px solid var(--color-border-color);
    border-radius: 2px;
    font-size: 1rem;
    box-sizing: border-box;
}

.button {
    display: inline-block;
    padding: 10px 28px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: 2px solid var(--color-primary);
    border-radius: 2px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s ease;
}

.button:hover {
    background-color: #826894;
}

/* Container for the section title and reset button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    margin: 0; /* Prevents the title from adding extra space */
}

/* Grid for Power Planner */
.months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* This creates the 3-column grid */
    gap: 1.5rem;
}

.month-input {
    display: flex;
    flex-direction: column;
}

.month-input label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.month-input input {
    width: 100%;
}

.results-bar {
    background: linear-gradient(135deg, #2d2d2d, #826894);
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.results-bar div {
    flex: 1;
    text-align: center;
    min-width: 200px;
}

.results-bar strong {
    display: block;
    font-size: 0.9rem;
    color: #ddd;
}

.results-bar span {
    font-size: 1.2rem;
    font-weight: bold;
}

/* --- Recommendation Section Compression --- */

/* New container for the 2-column layout */
.recommendations-container {
    display: grid;
    grid-template-columns: 1fr; /* Default to a single column (mobile-first) */
    gap: 1.5rem; /* Space between items when they are in columns/rows */
}

/* On screens wider than 992px, switch to a two-column layout */
@media (min-width: 992px) {
    .recommendations-container {
        grid-template-columns: 1fr 1fr; /* Two equal-width columns */
    }
}

/* Remove the top margin from the individual sets, as the grid 'gap' now handles spacing */
.recommendation-set {
    margin-top: 0 !important;
    padding: 12px;
}

/* Reduce header size and spacing */
.recommendation-set h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
}

/* Reduce description font size */
.recommendation-desc {
    font-size: 0.9em;
    line-height: 1.4;
}

/* Reduce font size and line height for the list of products */
.product-links {
    font-size: 0.9em;
    line-height: 1.4;
    padding-left: 18px; /* Slightly reduce indent */
}

/* Reduce spacing between list items */
.product-links li {
    margin-bottom: 6px;
}

/* Reduce the indent of the detailed product line */
.product-links li[style*="margin-left"] {
    margin-left: 15px !important;
}

/* Reduce font size of the "provides X hours" text */
.product-links li b + span {
    font-size: 0.95em;
}

/* Responsive Styles for Mobile */
@media (max-width: 900px) {
    /* On mobile, show the hamburger menu button */
    .menu-button {
        display: flex;
    }

    /* On mobile, hide the standard desktop navigation menu and the main logo */
    .nav-menu,
    .logo-link {
        display: none;
    }

    /* When the mobile menu is active, display it as a block */
    .nav-menu.active {
        display: block;
        position: fixed;
        top: 60px; /* Position below the header */
        left: 0;
        right: 0;
        background-color: var(--color-white); /* Set a solid white background */
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        padding: 1rem 0;
        text-align: center;
        z-index: 999;
    }

    /* Style the links inside the active mobile menu */
    .nav-menu.active a {
        color: var(--color-text-dark); /* Use dark text for readability on the white background */
        display: block;
        padding: 0.75rem 1rem;
    }

    /* Adjust spacing for list items in the mobile menu */
    .nav-menu.active li {
        margin: 0;
    }

    /* --- Responsive Grid Adjustments --- */
    .months-grid {
        grid-template-columns: 1fr; /* Stack month inputs in a single column */
    }

    .results-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .appliance-row,
    .appliance-row.grid-header {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        border-bottom: 1px solid #eee;
        padding-bottom: 1rem;
    }

    .appliance-row.grid-header {
        display: none;
    }
}

