/* General Body Styles */
body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px; 
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-img {
    height: 45px; 
    width: auto;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    margin-left: 25px;
    font-size: 1em;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #2c5e32;
}

/* Main Page Video Container */
.video-container {
    position: relative;
    width: 100%;
    height: 85vh; /* This is the 85% height you had */
    overflow: hidden;
    background-color: #000;
}

/* *** FIX FOR VIDEO BLACK BARS *** */
#randomVideoFrame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover; /* This scales the video to fill the container */
}


.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.video-overlay h1 {
    font-size: 4em;
    margin: 0;
}

.video-overlay p {
    font-size: 1.5em;
    margin-top: 10px;
}

.video-overlay .button {
    display: inline-block;
    margin-top: 25px;
    padding: 12px 28px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid #ffffff;
    border-radius: 30px;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.video-overlay .button:hover {
    background-color: #ffffff;
    color: #000000;
    transform: scale(1.05);
}

/* Map Container */
.map-container {
    width: 100%;
    height: 450px;
}

/* --- 'W SPRZEDAŻY' PAGE STYLES --- */

.page-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
}

.page-title {
    text-align: center;
    font-size: 2.5em;
    color: #2c5e32;
    margin-bottom: 30px;
}

.search-container {
    text-align: center;
    margin-bottom: 40px;
}

#plantSearch {
    width: 50%;
    max-width: 400px;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 30px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#plantSearch:focus {
    border-color: #2c5e32;
    box-shadow: 0 0 10px rgba(44, 94, 50, 0.2);
}

.plant-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.plant-item-wrapper {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden; /* For the border-radius */
    transition: box-shadow 0.3s ease;
}

.plant-item-wrapper:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.plant-item {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.plant-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    filter: opacity(0.85); /* Tint effect */
    transition: filter 0.3s ease, transform 0.3s ease;
}

.plant-item:hover img {
    filter: opacity(1);
    transform: scale(1.03);
}

.plant-item h3 {
    font-size: 1.25em;
    font-weight: 700;
    color: #333;
    padding: 20px;
    margin: 0;
    background-color: #fff;
    transition: color 0.3s ease;
}

.plant-item:hover h3 {
    color: #2c5e32;
}

.plant-details {
    max-height: 0;
    overflow: hidden;
    background-color: #fafafa;
    transition: max-height 0.4s ease-out;
}

.plant-details p {
    padding: 0 20px 20px 20px;
    margin: 0;
    font-size: 1em;
    line-height: 1.6;
}

/* Active state for accordion */
.plant-item.active + .plant-details {
    /* max-height will be set by JS */
}

.plant-item.active img {
    filter: opacity(1);
}

.plant-item.active h3 {
    color: #2c5e32;
}

/* --- END 'W SPRZEDAŻY' STYLES --- */


/* Styles for Baza Danych page (from before) */
.page-content {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-content h2 {
    color: #2c5e32;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Styles for Kontakt page (from before) */
.contact-info p {
    line-height: 1.8;
    font-size: 1.1em;
}

/* Video Gallery Styles (from before) */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.gallery-.item {
    position: relative;
    padding-top: 56.25%;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-item iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Footer Styles */
.site-footer {
    background-color: #2c2c2c;
    color: #f0f0f0;
    padding: 40px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-contact, .footer-links, .footer-social {
    flex: 1;
    min-width: 250px;
}

.site-footer h3 {
    font-size: 1.2em;
    color: #ffffff;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.site-footer p {
    margin: 5px 0;
    line-height: 1.6;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #f0f0f0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #a5d6a7;
    text-decoration: underline;
}

/* Social Icon Styles */
.social-icons {
    margin-top: 10px;
}

.social-icons a {
    display: inline-block;
    margin-right: 15px;
}

.social-icons img {
    height: 30px;
    width: 30px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.social-icons a:hover img {
    opacity: 1;
    transform: scale(1.1);
}

/* --- NEW 'TRAWY W PIGUŁCE' STYLES --- */

.trawy-grid-container {
    display: grid;
    /* Updated for 4 columns on desktop, 2 on tablet, 1 on mobile */
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
}

/* Media query for tablet */
@media (min-width: 576px) {
    .trawy-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Media query for desktop (4 columns) */
@media (min-width: 992px) {
    .trawy-grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.trawy-grid-item {
    display: block;
    text-decoration: none;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.trawy-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.trawy-grid-item img {
    width: 100%;
    /* height: 220px; <-- This was removed */
    aspect-ratio: 4 / 3; /* Added for consistent 4:3 ratio */
    object-fit: cover; /* Ensures image fills the 4:3 box */
    display: block;
}

.trawy-grid-item h3 {
    text-align: center;
    font-size: 1.4em;
    color: #333;
    padding: 20px;
    margin: 0;
}

/* Subpage Styles */
.subpage-container {
    /* display: none;  <- THIS IS REMOVED */
    min-height: 100vh;
    padding: 30px;
    background-color: #fff;
    box-sizing: border-box;
}

/* REMOVED:
  .subpage-container:target { ... } 
  :target ~ #page-wrapper { ... }
*/

.subpage-back-button {
    display: inline-block;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c5e32;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.subpage-back-button:hover {
    background-color: #f0f0f0;
}

.subpage-content {
    max-width: 800px;
    margin: 20px auto;
}

.subpage-content h2 {
    font-size: 2.8em;
    color: #2c5e32;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.subpage-list {
    list-style: none;
    padding: 0;
    margin-top: 30px;
}

.subpage-list li {
    margin-bottom: 10px;
}

.subpage-list a {
    text-decoration: none;
    color: #333;
    font-size: 1.2em;
    padding: 10px;
    display: block;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.subpage-list a:hover {
    background-color: #f9f9f9;
    color: #000;
    padding-left: 15px;
}

/* * NOTE: The extra '}' bracket that was here has been DELETED.
 * This was the syntax error breaking the mobile styles.
 */


/* =================================== */
/* MOBILE STYLES (THE REAL FIX)      */
/* =================================== */

@media (max-width: 768px) {

    /* --- Navbar Fix --- */
    .navbar {
        flex-direction: column; /* Stacks the logo and links vertically */
        align-items: center;    /* Centers the logo */
    }

    .nav-links {
        display: flex;
        flex-direction: column; /* Stacks the links on top of each other */
        width: 100%;            /* Makes the container full-width */
        align-items: center;    /* Centers the links horizontally */
        margin-top: 15px;       /* Adds some space below the logo */
    }

    .nav-links a {
        padding: 10px 0;        /* Gives each link more tap-friendly space */
        width: 100%;            /* Makes each link take up the full width */
        text-align: center;     /* THIS is the fix for "uncentered" text */
        margin-left: 0;         /* Resets the desktop margin */
    }

    /* --- Video Text Fix --- */
    .video-container {
        /* You can adjust this mobile height. 
           Your 85vh is quite tall for a phone. */
        height: 60vh; 
    }

    .video-overlay h1 {
        font-size: 2.5rem; /* Make the main title a bit smaller on mobile */
    }

    .video-overlay p {
        font-size: 1rem; /* Make the subtitle a bit smaller */
    }

    /* --- Footer Fix --- */
    .footer-content {
        flex-direction: column; /* Stacks footer sections on mobile */
        align-items: center;
        text-align: center;
    }
}