/* --- General Styles & Variables --- */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #ecf0f1;
    --text-color: #34495e;
    --header-height: 80px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- Header & Navigation (Rebuilt) --- */

/* This is the main header bar, fixed to the top */
.main-header {
    display: flex;
    justify-content: space-between; /* Mobile: Logo left, Hamburger right */
    align-items: center;
    padding: 0 2rem;
    height: var(--header-height);
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0; left: 0; width: 100%;
    z-index: 1000;
    box-sizing: border-box;
}

.logo a {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
    white-space: nowrap;
}

/* This is the container for all nav items, toggled on mobile */
.header-nav-group {
    /* Mobile: A hidden, full-width, vertical menu */
    display: none;
    flex-direction: column;
    align-items: center;

    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    padding: 1.5rem 0;
    background-color: #fff;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

/* Vertical spacing for stacked mobile menu items */
.header-nav-group > *:not(:last-child) {
    margin-bottom: 1.5rem;
}

/* This class is toggled by JS to show the mobile menu */
.header-nav-group.active {
    display: flex;
}

/* The main navigation list */
.main-nav ul {
    display: flex;
    flex-direction: column; /* Mobile: stacked vertically */
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Vertical spacing for mobile nav links */
.main-nav ul > li:not(:last-child) {
    margin-bottom: 1rem;
}

/* A single, unified style for all navigation links */
.main-nav a,
.owner-actions a {
    display: block;
    padding: 0 1rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover,
.owner-actions a:hover {
    color: var(--secondary-color);
}

/* Specific style for the underlined login link */
.owner-actions a.owner-login-link {
    text-decoration: underline;
}
.owner-actions a.owner-login-link:hover {
    text-decoration: underline; /* Keep underline on hover */
}

/* The search form and its components */
.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    border: 1px solid #ccc;
    padding: 0.5rem 2.5rem 0.5rem 0.8rem; /* Right padding for icon */
    border-radius: 5px;
    height: 38px;
    box-sizing: border-box;
    min-width: 200px;
}

.search-btn {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    padding: 0;
    color: var(--text-color);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}
.search-btn:hover {
    opacity: 1;
}

/* Container for Login/Dashboard/Logout links */
.owner-actions {
    display: flex;
    flex-direction: column; /* Mobile: stacked vertically */
    align-items: center;
}

/* Vertical spacing for mobile owner action links */
.owner-actions > a:not(:last-child) {
    margin-bottom: 1rem;
}

/* --- Hamburger Menu --- */
.mobile-nav-toggle {
    display: block; /* Visible on mobile */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px; /* Enlarge tap area */
    margin: -10px; /* Counteract padding to not affect layout */
    z-index: 1001; /* Ensure it's above the nav group */
}

.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 4px;
    position: absolute;
    transition: transform 0.2s ease-in-out;
}

.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px; /* Vertically center the middle bar */
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
}
.hamburger-inner::before {
    top: -10px;
}
.hamburger-inner::after {
    bottom: -10px;
}

/* Animate hamburger to an 'X' when the menu is open */
.mobile-nav-toggle[aria-expanded="true"] .hamburger-inner {
    background-color: transparent; /* Middle bar disappears */
}
.mobile-nav-toggle[aria-expanded="true"] .hamburger-inner::before {
    transform: translateY(10px) rotate(45deg); /* Top bar rotates down */
}
.mobile-nav-toggle[aria-expanded="true"] .hamburger-inner::after {
    transform: translateY(-10px) rotate(-45deg); /* Bottom bar rotates up */
}

/* --- Main Content & Footer --- */
.flash-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 5px;
    border: 1px solid transparent;
    text-align: center;
}

.flash-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.flash-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.content-wrapper {
    padding: calc(var(--header-height) + 2rem) 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.main-footer {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--primary-color);
    color: #fff;
}

/* --- Homepage Slideshow --- */
.slideshow-container {
    position: relative;
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.slide {
    display: none;
}

.slide img {
    width: 100%;
    height: auto;
    vertical-align: middle;
}

/* --- Page Specifics --- */
.page-title {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

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

.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- Forms --- */
.contact-form { max-width: 700px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}
.btn {
    background-color: var(--secondary-color);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}
.btn:hover { background-color: #2980b9; }

/* --- Desktop Layout (min-width) --- */
@media (min-width: 769px) {
    /* 1. Hide the hamburger button */
    .mobile-nav-toggle {
        display: none;
    }

    /* 2. Let the header children determine spacing */
    .main-header {
        justify-content: flex-start;
    }

    /* 3. Make the nav group visible and have it fill all available space */
    .header-nav-group {
        display: flex;
        flex-direction: row; /* Align items horizontally */
        flex-grow: 1;
        align-items: center;

        /* Reset all mobile positioning and styling */
        position: static;
        width: auto;
        background-color: transparent;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    /* 4. Reset ALL vertical margins from the mobile layout */
    .header-nav-group > *:not(:last-child),
    .main-nav ul > li:not(:last-child),
    .owner-actions > a:not(:last-child) {
        margin-bottom: 0;
    }

    /* 5. Ensure all inner lists are also horizontal */
    .main-nav ul,
    .owner-actions {
        flex-direction: row;
        gap: 1.5rem; /* Add horizontal space between links */
    }

    /* 6. The Centering Logic */
    .main-nav { margin-left: auto; } /* Push nav/search away from logo */
    .search-form { margin-left: 1.5rem; margin-right: auto; } /* Space from nav, and push away from login */
}

/* --- Pagination --- */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}
.pagination-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
}
.pagination-link {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    background: #fff;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    transition: all 0.3s ease;
}
.pagination-link:hover, .pagination-link.is-current {
    background: var(--secondary-color);
    color: #fff;
}

mark {
    background-color: #fcf8e3; /* A pleasant yellow highlight */
    padding: 0.1em 0.2em;
    border-radius: 3px;
}