/*
 Theme Name:   Algaeo
 Theme URI:    https://algaeo.com
 Description:  Custom theme for Algaeo.com e-commerce.
 Author:       Nicholas Sokol
 Author URI:   https://algaeo.com
 Version:      1.0.1
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         woocommerce, e-commerce, custom
*/

/* --- Algaeo Brand Colors --- */
:root {
    --algaeo-green-dark: #2F6D64; /* Background color from logo */
    --algaeo-green-light: #5BCC4A; /* Algae dot/A from logo */
    --algaeo-white: #FFFFFF;
    --algaeo-text-dark: #333333;
    --algaeo-text-light: #666666;
    --algaeo-accent-blue: #004a99; /* For highlights and links */
    --algaeo-background-light: #f9f9f9;
}

/* --- Base Theme Styles --- */
body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    background: var(--algaeo-background-light);
    color: var(--algaeo-text-dark);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Added horizontal padding */
}

a {
    color: var(--algaeo-accent-blue);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--algaeo-text-dark);
    font-weight: 600;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 15px;
}
h1 { font-size: 2.5em; }
h2 { font-size: 2em; }
h3 { font-size: 1.75em; }

/* Buttons */
.button, .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button {
    background-color: var(--algaeo-green-light);
    color: var(--algaeo-white);
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none; /* Ensure no underline on buttons */
    display: inline-block;
}
.button:hover, .woocommerce #respond input#submit:hover, .woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover {
    background-color: var(--algaeo-green-dark);
    color: var(--algaeo-white);
    text-decoration: none; /* Keep buttons clean on hover */
}

/* --- Header --- */
.site-header {
    background: var(--algaeo-green-dark); /* Dark green header */
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* We make the .container *inside* the header the flexbox, */
.site-header .container {
    display: flex;
    justify-content: space-between; /* Pushes logo left and nav right */
    align-items: center; /* Vertically aligns them */
    flex-wrap: wrap; /* Allows stacking on small screens */
}

.site-branding {
    display: flex;
    align-items: center;
}
.site-title {
    margin: 0; /* Remove default margin */
}
.site-title a {
    color: var(--algaeo-white);
    font-size: 1.8em; /* Adjust based on logo size */
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.custom-logo {
    max-height: 40px; /* Ensure logo fits */
    width: auto;
    margin-right: 15px; /* Space between logo and text, if title is shown */
}
.site-title a span { /* Hide text site title if logo is present and good */
    display: none; 
}


/* Navigation */
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* Makes nav items horizontal */
    flex-wrap: wrap; /* Allows nav items to wrap if needed */
    justify-content: flex-end; /* Aligns nav to the right */
}
.main-navigation li {
    margin-left: 25px; /* Space between nav items (reduced slightly) */
}
.main-navigation a {
    color: var(--algaeo-white);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05em;
    transition: color 0.3s ease;
    padding: 5px 0; /* Make clickable area bigger */
}
.main-navigation a:hover {
    color: var(--algaeo-green-light); /* Light green on hover */
    text-decoration: none;
}

/* Content Area */
.site-content {
    padding-top: 40px;
    padding-bottom: 40px;
}
.site-main {
    background: var(--algaeo-white);
    padding: 40px;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    border-radius: 8px;
}

/* --- Footer --- */
.site-footer {
    background: var(--algaeo-green-dark);
    color: var(--algaeo-white);
    padding: 30px 0;
    text-align: center;
    margin-top: 50px;
    font-size: 0.9em;
}

/* --- Algaeo Trust Badge Style (PhD Formulated) --- */
.algaeo-trust-badge {
    background-color: #e6f7e3; /* A softer, scientific light green */
    border: 1px solid var(--algaeo-green-light);
    color: var(--algaeo-green-dark);
    padding: 12px 18px;
    margin: 15px 0;
    border-radius: 8px; /* Slightly more rounded */
    font-weight: 600;
    font-size: 0.95em;
    display: flex; /* For icon and text alignment */
    align-items: center;
    line-height: 1.4;
}
.algaeo-trust-badge .icon {
    margin-right: 10px;
    font-size: 1.2em; /* Make the icon a bit bigger */
    color: var(--algaeo-green-light);
}

/* --- Homepage Specific Sections --- */

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(47, 109, 100, 0.8), rgba(47, 109, 100, 0.8)), url('path/to/your/algae-background.jpg') no-repeat center center; /* REPLACE THIS PATH */
    background-size: cover;
    color: var(--algaeo-white);
    text-align: center;
    padding: 100px 20px;
    margin-bottom: 50px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.hero-section h2 {
    font-size: 3.5em;
    margin-bottom: 20px;
    color: var(--algaeo-white);
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.hero-section p {
    font-size: 1.3em;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}
.hero-section .button {
    font-size: 1.2em;
    padding: 15px 35px;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
    text-align: center;
}
.feature-item {
    background: var(--algaeo-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.feature-item h3 {
    color: var(--algaeo-green-dark);
    margin-bottom: 15px;
}
.feature-item p {
    color: var(--algaeo-text-light);
}
.feature-item .icon-placeholder { /* For future icons */
    font-size: 3em;
    color: var(--algaeo-green-light);
    margin-bottom: 20px;
}

/* Call to Action Section */
.cta-section {
    background: var(--algaeo-green-light); /* Light green background */
    color: var(--algaeo-white);
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 50px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.cta-section h2 {
    color: var(--algaeo-white);
    margin-bottom: 20px;
}
.cta-section p {
    font-size: 1.2em;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.cta-section .button {
    background-color: var(--algaeo-accent-blue); /* Use blue for contrast */
    padding: 15px 40px;
    font-size: 1.1em;
}
.cta-section .button:hover {
    background-color: darken(var(--algaeo-accent-blue), 10%); /* Darken on hover */
}


/* Blog Section on Homepage */
.blog-section {
    margin-bottom: 50px;
}
.blog-section h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--algaeo-green-dark);
}
.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.blog-post-card {
    background: var(--algaeo-white);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden; /* For images */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.blog-post-card .post-thumbnail {
    height: 200px; /* Fixed height for consistency */
    overflow: hidden;
    position: relative;
}
.blog-post-card .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crop image to fit */
    transition: transform 0.3s ease;
}
.blog-post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}
.blog-post-card .post-content {
    padding: 25px;
    flex-grow: 1; /* Make content area fill available space */
    display: flex;
    flex-direction: column;
}
.blog-post-card h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: var(--algaeo-text-dark);
    flex-grow: 1;
}
.blog-post-card h3 a {
    color: inherit;
    text-decoration: none;
}
.blog-post-card h3 a:hover {
    color: var(--algaeo-green-light);
}
.blog-post-card .entry-meta {
    font-size: 0.85em;
    color: var(--algaeo-text-light);
    margin-bottom: 15px;
}
.blog-post-card .entry-meta a {
    color: var(--algaeo-text-light);
    text-decoration: none;
}
.blog-post-card .entry-meta a:hover {
    color: var(--algaeo-green-light);
}
.blog-post-card .read-more {
    margin-top: auto; /* Push to bottom */
    text-align: right;
    font-weight: 500;
}
.blog-post-card .read-more a {
    color: var(--algaeo-green-light);
    text-decoration: none;
}
.blog-post-card .read-more a:hover {
    text-decoration: underline;
}

/* --- WooCommerce Product Grid: 4-Column Layout --- */

.woocommerce ul.products {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    grid-auto-flow: row;
}

.woocommerce ul.products > li.product {
    width: auto !important;
    margin: 0 !important;
    height: 100%; /* Ensures all boxes use full cell height */
    background: var(--algaeo-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: stretch;
    /* Remove float, if inherited */
    float: none !important;
}

.woocommerce ul.products > li.product img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}


/* Product title and price styling */
.woocommerce ul.products li.product h2 {
    font-size: 1.2em;
    color: var(--algaeo-green-dark);
}
.woocommerce ul.products li.product .price {
    color: var(--algaeo-text-dark);
    font-size: 1.1em;
    font-weight: 600;
}

/* Images */
.woocommerce div.product div.images img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 100%;
    height: auto;
}

/* Remove any leftover padding from summary/review blocks */
.woocommerce #content div.product div.summary,
.woocommerce div.product div.summary,
.woocommerce #content div.product #reviews,
.woocommerce div.product #reviews {
    padding: 0;
}

/* --- Responsive Adjustments for 3/2/1 columns --- */
@media (max-width: 1024px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}
@media (max-width: 500px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
    }
    .main-navigation {
        width: 100%;
        margin-top: 15px;
    }
    .main-navigation ul {
        flex-direction: column;
        width: 100%;
    }
    .main-navigation li {
        margin: 0 0 10px 0;
        width: 100%;
    }
    .main-navigation a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .hero-section h2 {
        font-size: 2.5em;
    }
    .hero-section p {
        font-size: 1em;
    }
    .site-main {
        padding: 20px;
    }
}

/* --- Dropdown Menu Styles --- */

/* 1. Hide the submenu by default */
.main-navigation ul ul.sub-menu {
    display: none;
    position: absolute; /* Take it out of the normal flow */
    top: 100%; /* Position it right below the parent */
    right: 0;
    background: var(--algaeo-green-dark); /* Same as header */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 0 0 5px 5px;
    min-width: 200px; /* Give it some width */
    z-index: 999;
    padding: 10px 0; /* Add padding to top/bottom */
}

/* 2. Position the parent item */
.main-navigation ul li.menu-item-has-children {
    position: relative; /* This is the anchor for the submenu */
}

/* 3. Show the submenu on hover */
.main-navigation ul li.menu-item-has-children:hover > ul.sub-menu {
    display: block;
}

/* 4. Style the submenu list items */
.main-navigation ul ul.sub-menu li {
    margin: 0;
    width: 100%; /* Make items full width of dropdown */
}

/* 5. Style the submenu links */
.main-navigation ul ul.sub-menu li a {
    color: var(--algaeo-white);
    padding: 10px 20px;
    font-size: 0.95em;
    display: block; /* Make the whole area clickable */
    white-space: nowrap; /* Prevent links from wrapping */
}

/* 6. Style the submenu link hover state */
.main-navigation ul ul.sub-menu li a:hover {
    background: var(--algaeo-green-light);
    color: var(--algaeo-white); /* Keep text white, or change to dark */
}

/* 7. Add a small arrow to items that have a submenu */
.main-navigation li.menu-item-has-children > a {
    position: relative;
    padding-right: 15px; /* Make space for the arrow */
}

.main-navigation li.menu-item-has-children > a::after {
    content: '▾'; /* Down arrow character */
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    margin-left: 5px;
}

/* --- FAQ Accordion Styles --- */

.faq-accordion {
    max-width: 800px;
    margin: 40px auto;
}

.faq-item {
    border-bottom: 1px solid #eee;
}

.faq-question {
    background-color: #fff;
    color: var(--algaeo-text-dark);
    cursor: pointer;
    padding: 20px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1.1em;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    transition: background-color 0.3s ease;
    position: relative;
    padding-right: 40px; /* Space for the icon */
}

/* Add a plus/minus icon */
.faq-question::after {
    content: '+';
    font-size: 1.3em;
    color: var(--algaeo-green-light);
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease-in-out;
}

.faq-question.active::after {
    content: "−";
    transform: translateY(-50%) rotate(180deg);
}

.faq-question:hover {
    background-color: var(--algaeo-background-light);
}

.faq-answer {
    padding: 0 20px; /* Padding will be applied on open */
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.2s ease-out;
}

.faq-answer p {
    padding: 20px 0; /* Add padding when panel is open */
    margin: 0;
    line-height: 1.7;
    color: var(--algaeo-text-light);
}

/* --- Mobile Menu Toggle (Hamburger) --- */
.menu-toggle {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: 2px solid var(--algaeo-white);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    margin-left: auto; /* Pushes it to the right */
}
.menu-toggle .icon-bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--algaeo-white);
}
.menu-toggle .icon-bar + .icon-bar {
    margin-top: 4px;
}
.menu-toggle .screen-reader-text {
    display: none;
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .site-header .container {
        /* Keep logo and button side-by-side */
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center; 
    }

    .site-branding {
        flex: 1 1 auto; /* Let logo take space */
    }

    .menu-toggle {
        display: block; /* Show the hamburger button */
    }

    .main-navigation {
        display: none; /* Hide the menu by default */
        width: 100%;
        order: 3; /* Make it appear below logo/button */
        margin-top: 15px;
    }

    /* This class is added by JS to show the menu */
    .main-navigation.toggled {
        display: block; 
    }

    .main-navigation ul {
        flex-direction: column;
        width: 100%;
    }
    .main-navigation li {
        margin: 0 0 10px 0;
        width: 100%;
    }
    .main-navigation a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Keep all your other mobile styles */
    .hero-section h2 {
        font-size: 2.5em;
    }
    .hero-section p {
        font-size: 1em;
    }
    .site-main {
        padding: 20px;
    }
}

/* --- Blog Card Layout --- */
.blog-posts-grid {
    display: grid;
    /* This creates a 1, 2, or 3-column grid depending on screen size */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.blog-post-card {
    background: var(--algaeo-white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden; /* Keeps the image corners rounded */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.blog-post-card .post-thumbnail {
    height: 220px;
    overflow: hidden;
}
.blog-post-card .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This makes all images the same size */
    transition: transform 0.3s ease;
}
.blog-post-card:hover .post-thumbnail img {
    transform: scale(1.05); /* Nice hover zoom effect */
}

.blog-post-card .post-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Makes all cards the same height */
}

.blog-post-card .entry-meta {
    font-size: 0.85em;
    color: var(--algaeo-text-light);
    margin-bottom: 10px;
    font-weight: 500;
}

.blog-post-card .entry-title {
    font-size: 1.4em;
    margin: 0 0 15px 0;
    line-height: 1.3;
    flex-grow: 1; /* Pushes the 'Read More' to the bottom */
}
.blog-post-card .entry-title a {
    color: var(--algaeo-text-dark);
    text-decoration: none;
}
.blog-post-card .entry-title a:hover {
    color: var(--algaeo-green-light);
}

.blog-post-card .entry-excerpt p {
    margin: 0 0 20px 0;
    color: var(--algaeo-text-light);
    line-height: 1.6;
}

.blog-post-card .read-more {
    margin-top: auto; /* Pushes to the bottom */
    font-weight: 600;
}
.blog-post-card .read-more a {
    color: var(--algaeo-accent-blue);
    text-decoration: none;
}
.blog-post-card .read-more a:hover {
    text-decoration: underline;
}

/* --- Pagination Styles --- */
.pagination {
    margin-top: 40px;
}
.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.pagination .page-numbers {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: var(--algaeo-accent-blue);
}
.pagination .page-numbers.current {
    background: var(--algaeo-accent-blue);
    color: var(--algaeo-white);
    border-color: var(--algaeo-accent-blue);
}


/* --- Section Base Styling --- */
.recommendation-tool {
    background: var(--algaeo-background-light);
    padding: 80px 20px;
    text-align: center;
}

.recommendation-tool h2 {
    color: var(--algaeo-green-dark);
    font-size: 2em;
    margin-bottom: 10px;
}

.recommendation-tool p {
    color: var(--algaeo-text-light);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* --- Form Styling --- */
.recommendation-form {
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
    background: var(--algaeo-white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.recommendation-form .form-group {
    margin-bottom: 20px;
}

.recommendation-form label {
    font-weight: 600;
    color: var(--algaeo-text-dark);
    display: block;
    margin-bottom: 8px;
}

.recommendation-form select,
.recommendation-form input[type="text"] {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: var(--algaeo-background-light);
    color: var(--algaeo-text-dark);
    transition: border 0.3s ease;
}

.recommendation-form select:focus,
.recommendation-form input[type="text"]:focus {
    border-color: var(--algaeo-green-light);
    outline: none;
}

/* --- Buttons --- */
.button {
    display: inline-block;
    background: var(--algaeo-green-dark);
    color: var(--algaeo-white);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.2s ease;
}

.button:hover {
    background: var(--algaeo-green-light);
    color: var(--algaeo-white);
    transform: translateY(-2px);
}

.button.secondary {
    background: var(--algaeo-white);
    color: var(--algaeo-green-dark);
    border: 2px solid var(--algaeo-green-dark);
}

.button.secondary:hover {
    background: var(--algaeo-green-light);
    color: var(--algaeo-white);
}

/* --- Results Display --- */
#recommendation-results {
    margin-top: 40px;
}

.recommendation-card {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    background: var(--algaeo-white);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    text-align: left;
    align-items: flex-start;
}

.recommendation-card img {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--algaeo-green-light);
}

.recommendation-card h4 {
    color: var(--algaeo-green-dark);
    margin-bottom: 10px;
    font-size: 1.4em;
}

.recommendation-card p {
    color: var(--algaeo-text-dark);
    line-height: 1.6;
}

.recommendation-card h5 {
    color: var(--algaeo-accent-blue);
    margin-top: 20px;
    font-size: 1.1em;
}

.recommendation-card ul {
    margin-top: 10px;
    padding-left: 20px;
}

.recommendation-card ul li {
    margin-bottom: 6px;
    color: var(--algaeo-text-light);
}

/* --- Responsive Layout --- */
@media (max-width: 768px) {
    .recommendation-card {
        flex-direction: column;
        text-align: center;
    }

    .recommendation-card img {
        margin: 0 auto;
    }

    .recommendation-form {
        padding: 20px;
    }
}