/* ============================================================
   PRINCE HOMES — MAIN STYLESHEET
   Structure:
   1.  Global Reset & Base
   2.  Typography
   3.  Layout Utilities
   4.  Header & Navigation
   5.  Hero Section
   6.  About Section
   7.  Properties Section
   8.  Filter / Search Bar
   9.  Contact Form
   10. Alert Messages
   11. Pre-Footer & Footer
   12. Dark Mode Overrides
   13. Tablet Responsive  (≤ 992px)
   14. Tablet Responsive  (≤ 768px)
   15. Mobile Responsive  (≤ 480px)
============================================================ */


/* ============================================================
   1. GLOBAL RESET & BASE
   Removes default browser margin/padding, enforces border-box
   sizing so padding never causes overflow, and sets the base
   body font, colour, and background.
============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding-top: 60px;            /* offset for the fixed header height */
    font-family: 'Unbounded', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
    transition: background 0.3s, color 0.3s; /* smooth dark-mode switch */
}


/* ============================================================
   2. TYPOGRAPHY
   Global heading and text defaults used across all sections.
============================================================ */
h2 {
    text-align: center;
    margin-bottom: 30px;
    font-family: 'Unbounded', sans-serif;
}

h3 {
    font-family: 'Unbounded', sans-serif;
}


/* ============================================================
   3. LAYOUT UTILITIES
   .container centres content and applies consistent side padding.
   .btn is the shared CTA button style used in hero and elsewhere.
============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    background: #ffa600;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 20px;
    font-family: 'Unbounded', sans-serif;
    transition: background 0.3s;
    display: inline-block;       /* keeps it from stretching full-width */
}


/* ============================================================
   4. HEADER & NAVIGATION
   Fixed header that stays at the top as the user scrolls.
   Logo is locked to a fixed height so it never pushes the nav.
   Hamburger button is hidden on desktop and shown on mobile.
============================================================ */
header {
    background: #333;
    color: #fff;
    padding: 10px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: background 0.3s;
    font-family: 'Unbounded', sans-serif;
}

/* Flex row: logo on the left, nav on the right */
.header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;           /* keep logo and nav on one line */
}

/* Fixed-height logo container so text or image logos align the same */
.logo {
    height: 50px;
    display: flex;
    align-items: center;
    flex-shrink: 0;              /* never shrink the logo */
}

/* Text-only logo (used when no image is uploaded) */
.logo .text-logo {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    line-height: 1;
    display: block;
    white-space: nowrap;
}

/* Nav is pushed to the right automatically */
nav {
    margin-left: auto;
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav li {
    margin-left: 20px;
}

nav a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

nav a:hover {
    color: #ffa600;
}

/* Dark mode toggle button inside the nav */
#dark-mode-toggle {
    background: #ffa600;
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}

/* Hamburger icon — hidden on desktop, shown on mobile via media query */
.hamburger {
    display: none;
    font-size: 26px;
    cursor: pointer;
    color: #fff;
    background: none;
    border: none;
    padding: 4px 8px;
    line-height: 1;
}


/* ============================================================
   5. HERO SECTION
   Full-viewport hero that supports either a background image
   (.hero-bg) or a looping video (.hero-video).
   An overlay div darkens the media so text is always readable.
   The .hero-content sits on top via z-index stacking.
============================================================ */
.hero {
    position: relative;
    height: 100vh;
    min-height: 650px;
    overflow: hidden;
    text-align: center;
    color: #fff;
}

/* Static image background fallback */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* Looping video background */
.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;          /* fill the frame without distortion */
    z-index: 1;
    display: block;
}

/* Semi-transparent dark overlay so text pops over busy media */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2;
}

/* All copy and CTA sit above the overlay */
.hero-content {
    position: relative;
    z-index: 3;
    padding-top: 150px;          /* push content down from top of viewport */
}

.hero-content h1 {
    font-size: clamp(24px, 5vw, 40px); /* scales fluidly between screen sizes */
    margin-bottom: 10px;
    font-family: 'Unbounded', sans-serif;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.hero-content p {
    font-size: clamp(14px, 2.5vw, 20px);
    margin-bottom: 20px;
    font-family: 'Unbounded', sans-serif;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}


/* ============================================================
   6. ABOUT SECTION
   Two-column grid: image on the left, text on the right.
   Collapses to single-column on tablet and below.
============================================================ */
#about {
    padding: 100px 0;
    background: #f8f9fa;
    transition: background 0.3s;
}

/* Two equal columns with generous gap */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 70px;
    align-items: start;
}

/* Image container — rounded corners with a soft shadow */
.about-image {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

/* Subtle zoom-in on hover */
.about-image:hover img {
    transform: scale(1.04);
}

.about-content h2 {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 30px;
    color: #1a1a1a;
    text-align: left;            /* override global h2 centre-align */
}

.about-text {
    font-size: 0.9rem;
    line-height: 1.85;
    color: #444;
}

.about-text p {
    margin-bottom: 20px;
}


/* ============================================================
   7. PROPERTIES SECTION
   Auto-fitting grid of property cards.
   Cards scale up slightly on hover for a tactile feel.
   Images are fixed height so all cards align neatly.
============================================================ */
#properties {
    padding: 50px 0;
    background: #f4f4f4;
    transition: background 0.3s;
}

/* Responsive grid: at least 300px per column, wraps automatically */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.property-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Lift effect on hover */
.property-card:hover {
    transform: scale(1.05);
}

/* Fixed image height keeps cards uniform regardless of source image ratio */
.property-card img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    display: block;
    padding: auto;
}

.property-card h3 {
    margin: 10px 0;
}

/* ---- Search active state ---- */
/* When search is running, visible cards shrink slightly to signal filtering */
.search-active .property-card {
    transform: scale(0.88);
    opacity: 0.95;
    width: 55%;
    margin: 0 auto;
}

/* Cards that don't match the search query are hidden */
.property-card[style*="display: none"] {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Force single-column when search is active on any screen */
.search-active .property-grid {
    grid-template-columns: 1fr !important;
}

/* Status badges on cards */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    margin: 6px 0 10px;
    font-family: 'Unbounded', sans-serif;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}


/* ============================================================
   8. FILTER / SEARCH BAR
   The pill-shaped yellow bar above the property grid.
   Inline styles in the PHP handle most of the initial look;
   these rules handle responsive wrapping and focus states.
============================================================ */

/* Allow pills and input to wrap on small screens */
.filter-bar {
    flex-wrap: wrap;
}

/* Fix: input text colour was white, making it invisible when unfocused */
#propertySearch {
    color: #333 !important;
}


/* ============================================================
   9. CONTACT FORM
   Centred, single-column form. Inputs are full-width and
   touch-friendly (min 44px tap target via padding).
============================================================ */
#contact {
    padding: 50px 0;
    background: #f4f4f4;
    transition: background 0.3s;
}

form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

input,
textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 16px;          /* larger than default for touch comfort */
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Unbounded', sans-serif;
    font-size: 14px;
    transition: border 0.3s;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Generic button base — specific buttons (dark-mode, submit) override below */
button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 5px;
    font-family: 'Unbounded', sans-serif;
    transition: background 0.3s;
}


/* ============================================================
   10. ALERT MESSAGES
   Shown after form submission (success / error).
   Centred on the page with coloured backgrounds.
============================================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px auto;           /* auto left/right centres the box */
    font-family: 'Unbounded', sans-serif;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
}

.alert.success {
    background-color: #28a745;  /* green — message sent OK */
    color: white;
}

.alert.error {
    background-color: #dc3545;  /* red — something went wrong */
    color: white;
}


/* ============================================================
   11. PRE-FOOTER & FOOTER
   Pre-footer: full-width banner with background image and
   two columns — trust badges on the left, nav links on the right.
   Footer: simple centred copyright bar.
============================================================ */
.pre-footer {
    width: 100%;
    min-height: 200px;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
                url('images/house\ 10.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 60px;
    box-sizing: border-box;
    position: relative;
    flex-wrap: wrap;             /* allows columns to stack on small screens */
    gap: 24px;
}

/* Extra overlay on top of the background image */
.pre-footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1;
}

/* Both columns sit above the overlay */
.pre-footer-trust,
.pre-footer-nav {
    position: relative;
    z-index: 2;
    color: white;
}

.pre-footer-trust {
    text-align: left;
    font-family: 'Unbounded', sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

.pre-footer-trust p {
    margin: 6px 0;
    font-weight: 400;
}

.pre-footer-nav {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: right;
}

.pre-footer-nav a {
    color: white;
    text-decoration: none;
    font-family: 'Unbounded', sans-serif;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.pre-footer-nav a:hover {
    color: #fee500;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    transition: background 0.3s;
}


/* ============================================================
   12. DARK MODE OVERRIDES
   Triggered by adding .dark-mode to <body> via JS.
   Covers every major section and interactive element.
============================================================ */
body.dark-mode {
    background: #222;
    color: #ddd;
}

body.dark-mode header {
    background: #111;
}

body.dark-mode nav {
    background: #111;            /* dropdown menu matches header */
}

body.dark-mode nav a {
    color: #ddd;
}

body.dark-mode .btn {
    background: #ffae00;
}

body.dark-mode #about,
body.dark-mode #properties,
body.dark-mode #contact {
    background: #333;
}

body.dark-mode .property-card {
    background: #444;
    border-color: #555;
}

body.dark-mode .about-content h2 {
    color: #eee;
}

body.dark-mode .about-text {
    color: #bbb;
}

body.dark-mode input,
body.dark-mode textarea {
    background: #333;
    color: #ddd;
    border-color: #555;
}

body.dark-mode button {
    background: #0056b3;
}

body.dark-mode #dark-mode-toggle {
    background: #ffa600;
}

body.dark-mode footer {
    background: #111;
}


/* ============================================================
   13. TABLET RESPONSIVE — max-width: 992px
   Collapses the about section to a single column and
   slightly reduces about heading size.
============================================================ */
@media (max-width: 992px) {
    .about-grid {
        grid-template-columns: 1fr; /* stack image above text */
        gap: 40px;
    }

    .about-content h2 {
        font-size: 2rem;
        text-align: center;
    }
}


/* ============================================================
   14. TABLET RESPONSIVE — max-width: 768px
   Shows the hamburger, hides the inline nav, collapses the
   filter bar so pills don't overflow, and stacks the pre-footer.
============================================================ */
@media (max-width: 768px) {

    /* Shrink header padding to gain a few pixels of height */
    header {
        padding: 6px 0;
    }

    /* Smaller logo text on narrow screens */
    .logo {
        height: 40px;
        font-size: 16px;
    }

    /* Reveal the hamburger icon */
    .hamburger {
        display: block;
    }

    /* Hide the nav by default; JS toggles .active to show it */
    nav {
        display: none;
        width: 100%;
        background: #333;
        position: absolute;
        top: 52px;               /* just below the header */
        left: 0;
        z-index: 999;
    }

    nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;  /* stack links vertically */
        align-items: center;
        padding: 10px 0;
    }

    nav li {
        margin: 10px 0;
    }

    /* Full-width toggle button in mobile nav */
    #dark-mode-toggle {
        width: 100%;
        margin-top: 10px;
    }

    /* About section less top/bottom padding on tablet */
    #about {
        padding: 60px 0;
    }

    /* Filter bar: keep pills on one line, allow shrink */
    .filter-bar {
        border-radius: 24px !important;
        padding: 10px 12px !important;
        gap: 10px !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    .filter-bar .status-pill {
        padding: 8px 10px !important;  /* less horizontal padding = narrower pills */
        font-size: 10px !important;    /* smaller text so pill labels take less room */
        white-space: nowrap !important;
        flex-shrink: 0 !important;     /* pills stay their natural size, input takes the rest */
    }

    /* Let the search input flex-shrink to fit the bar */
    .filter-bar div[style*="flex: 1"] {
        min-width: 0 !important;
        flex: 1 !important;
    }

    .filter-bar input {
        font-size: 12px !important;
        padding: 10px 12px 10px 38px !important;
    }

    #searchBtn {
        padding: 10px 18px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* Pre-footer stacks trust text above nav links */
    .pre-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 30px 24px;
    }

    .pre-footer-nav {
        text-align: left;
        flex-direction: row;     /* nav links sit side-by-side when stacked */
        flex-wrap: wrap;
        gap: 12px;
    }
}


/* ============================================================
   15. MOBILE RESPONSIVE — max-width: 480px
   Fine-tunes everything for small phone screens:
   — Hero height reduced so CTA is always in view
   — Property grid goes single-column
   — Filter bar stacks vertically
   — Form inputs stay comfortably tap-sized
   — Footer text centred and slightly smaller
============================================================ */
@media (max-width: 480px) {

    /* Reduce body top padding to match shorter mobile header */
    body {
        padding-top: 52px;
    }

    /* --- Hero --- */
    /* Reduce height so the CTA button is visible without scrolling */
    .hero {
        height: 75vh !important;
        min-height: 480px !important;
    }

    .hero-content {
        padding: 80px 16px 40px;
        text-align: center;
    }

    /* --- About --- */
    #about {
        padding: 48px 0 !important;
    }

    .about-image {
        margin-bottom: 16px;
    }

    .about-content h2 {
        font-size: 1.4rem;
        text-align: center;
    }

    /* --- Properties grid: 1 column on phones --- */
    .property-grid {
        grid-template-columns: 1fr !important;
    }

    /* Slightly shorter card images on narrow screens */
    .property-card img {
        height: 280px;
    }

    /* --- Filter bar: stack all controls vertically --- */
    .filter-bar {
        flex-direction: column !important;
        border-radius: 16px !important;
        padding: 14px !important;
        gap: 10px !important;
        flex-wrap: wrap !important;
    }

    /* Pills and search button stretch full-width when stacked */
    .filter-bar .status-pill,
    #searchBtn {
        width: 100% !important;
        text-align: center !important;
    }

    /* Search input wrapper also goes full-width */
    .filter-bar > div {
        min-width: unset !important;
        width: 100% !important;
    }

    /* --- Contact form --- */
    #contact {
        padding: 40px 0;
    }

    #contact h2 {
        font-size: 20px;
    }

    /* Ensure form doesn't overflow its container on very small screens */
    form {
        padding: 0 4px;
    }

    /* --- Pre-footer --- */
    /* Tighter padding so text isn't crammed against screen edges */
    .pre-footer {
        padding: 20px 14px;
        min-height: auto;
        gap: 16px;
    }

    /* Smaller trust badge lines so they fit on one line each */
    .pre-footer-trust {
        font-size: 10px;
        line-height: 1.7;
    }

    .pre-footer-trust p {
        margin: 3px 0;
    }

    /* Smaller nav links to match trust text scale */
    .pre-footer-nav a {
        font-size: 11px;
    }

    /* Nav links wrap into a tighter row */
    .pre-footer-nav {
        gap: 8px;
    }

    /* --- Footer --- */
    footer .container {
        text-align: center;
        font-size: 13px;
        padding: 0 16px;
    }
}

/* Login page alert override */
.login-form .alert.error {
    background-color: #dc3545;
    color: white;
    border: 2px solid #fff;
    font-size: 15px;
    margin-bottom: 20px;
}

/* ====================== CONTACT SECTION ====================== */
.contact-section {
    transition: background 0.4s ease;
}

/* Light Mode */
.contact-section {
    background: #f8f9fa;
}

.glass-form {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 45px 40px;
    transition: all 0.4s ease;
}

.contact-input {
    font-family: 'Unbounded', sans-serif;
    font-size: 15px;
    width: 100%;
    padding: 16px 18px;
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    color: #222;
}

.contact-input::placeholder {
    color: #888;
}

/* Dark Mode */
body.dark-mode .contact-section {
    background: #111;
}

body.dark-mode .glass-form {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

body.dark-mode .contact-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #eee;
}

body.dark-mode .contact-input::placeholder {
    color: #aaa;
}

.contact-btn {
    font-family: 'Unbounded', sans-serif;
    font-size: 16px;
    font-weight: 600;
    background: #0066ff;
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
}

.contact-btn:hover {
    background: #0055dd;
}

.contact-link {
    color: #555;
    text-decoration: none;
    font-size: 1.02rem;
    transition: color 0.3s;
}

body.dark-mode .contact-link {
    color: #ccc;
}

body.dark-mode .contact-link:hover {
    color: #ffa600;
}

/* Make headings adapt to mode */
body.dark-mode h3 {
    color: #fff !important;
}

/* ====================== ABOUT SECTION ====================== */
.about-section {
    padding: 100px 0;
    background: #f8f9fa;
    transition: background 0.4s ease;
}

.about-content h2 {
    color: #1a1a1a;
}

.about-text {
    color: #444;
}

/* Dark Mode */
body.dark-mode .about-section {
    background: #111 !important;
}

body.dark-mode .about-content h2 {
    color: #eee !important;
}

body.dark-mode .about-text {
    color: #bbb !important;
}

/* Make images look good in dark mode */
body.dark-mode .about-image img {
    filter: brightness(0.95);
}