/* ========================================
   Coal City Homes - MAIN WEBSITE STYLING
   ======================================== */

:root {
    --primary-color: white;
    --secondary-color: #013328;
    --accent-color: #d9dfdd;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: clip;
    max-width: 100%;
    scroll-behavior: smooth;
}

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

/* ========================================
   MAIN HEADER / NAVBAR
   ======================================== */
.main-header {
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* ========================================
   LOGO
   ======================================== */
.navbar-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    max-width: 130px;
    height: auto;
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

/* ========================================
   PRIMARY NAVIGATION
   ======================================== */
.navbar-primary {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
}

.navbar-primary a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.25s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    position: relative;
}

.navbar-primary a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.navbar-primary a:hover::after,
.navbar-primary a.active::after {
    width: 100%;
}

.navbar-primary a:hover,
.navbar-primary a.active {
    color: var(--secondary-color);
}

/* ========================================
   SECONDARY NAVIGATION
   ======================================== */
.navbar-secondary {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-block;
    font-size: 0.88rem;
    white-space: nowrap;
}

.btn-login {
    color: var(--secondary-color);
    background-color: transparent;
    border: 2px solid var(--secondary-color);
}

.btn-login:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 51, 40, 0.2);
}

.btn-register {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
}

.btn-register:hover {
    background-color: transparent;
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 51, 40, 0.15);
}

.btn-dashboard {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
}

.btn-dashboard:hover {
    background-color: transparent;
    color: var(--secondary-color);
}

.btn-logout {
    background-color: var(--danger-color);
    color: var(--primary-color);
    border: 2px solid var(--danger-color);
}

.btn-logout:hover {
    background-color: transparent;
    color: var(--danger-color);
}

/* ========================================
   HAMBURGER — hidden on desktop
   ======================================== */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 0.3rem;
    flex-shrink: 0;
    padding: 4px;
}

.hamburger span {
    width: 1.5rem;
    height: 0.2rem;
    background-color: var(--secondary-color);
    border-radius: 0.1rem;
    transition: all 0.3s ease;
    display: block;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========================================
   RESPONSIVE — 980px
   ======================================== */
@media (max-width: 980px) {
    .navbar {
        padding: 1rem 1.5rem;
        gap: 1rem;
    }

    .hamburger {
        display: flex;
        order: 2;
    }

    /* Nav links dropdown */
    .navbar-primary {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        gap: 0;
        background-color: var(--primary-color);
        border-top: 2px solid var(--secondary-color);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    }

    .navbar-primary.active {
        max-height: 450px;
    }

    .navbar-primary li {
        width: 100%;
        border-bottom: 1px solid var(--accent-color);
        transform: translateX(-10px);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .navbar-primary.active li {
        transform: translateX(0);
        opacity: 1;
    }

    /* Stagger each link */
    .navbar-primary.active li:nth-child(1) {
        transition-delay: 0.05s;
    }

    .navbar-primary.active li:nth-child(2) {
        transition-delay: 0.1s;
    }

    .navbar-primary.active li:nth-child(3) {
        transition-delay: 0.15s;
    }

    .navbar-primary.active li:nth-child(4) {
        transition-delay: 0.2s;
    }

    .navbar-primary.active li:nth-child(5) {
        transition-delay: 0.25s;
    }

    .navbar-primary.active li:nth-child(6) {
        transition-delay: 0.3s;
    }

    .navbar-primary li:last-child {
        border-bottom: none;
    }

    .navbar-primary a {
        display: block;
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
        border-bottom: none;
        color: var(--secondary-color);
        transition: background 0.2s ease, padding-left 0.2s ease;
    }

    .navbar-primary a::after {
        display: none;
    }

    .navbar-primary a:hover,
    .navbar-primary a.active {
        background-color: #f5f7fa;
        padding-left: 2rem;
        border-left: 3px solid var(--secondary-color);
    }

    /* Buttons — compact, side by side */
    .navbar-secondary {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 0.8rem;
        background-color: #f8f9fa;
        padding: 1rem 1.5rem;
        border-top: 1px solid var(--accent-color);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, opacity 0.3s ease;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        visibility: hidden;
        opacity: 0;
    }

    .navbar-secondary.active {
        max-height: 100px;
        visibility: visible;
        opacity: 1;
    }

    /* Buttons natural width — not stretched */
    .btn {
        width: auto;
        padding: 0.55rem 1.2rem;
        font-size: 0.88rem;
    }

    .logo-img {
        max-width: 110px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 1rem;
    }

    .navbar-secondary {
        gap: 0.6rem;
        padding: 0.9rem 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.82rem;
    }

    .user-name {
        display: none;
    }

    .user-menu {
        width: 100%;
        flex-direction: column;
    }

    .logo-img {
        max-width: 90px;
    }
}

/* ========================================
   MOBILE BUTTONS INSIDE NAV
   ======================================== */

/* Hidden on desktop */
.nav-buttons-mobile {
    display: none;
}

@media (max-width: 980px) {

    /* Show buttons inside nav on mobile */
    .nav-buttons-mobile {
        display: flex !important;
        gap: 0.8rem;
        justify-content: center;
        align-items: center;
        padding: 1rem 1.5rem !important;
        border-bottom: none !important;
        border-top: 1px solid var(--accent-color);
        background-color: #f8f9fa;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .nav-buttons-mobile .btn {
        width: auto;
        padding: 0.55rem 1.2rem;
        font-size: 0.88rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    /* Hide desktop buttons on mobile */
    .navbar-secondary {
        display: none !important;
    }

}

.nav-buttons-mobile .btn-register {
    background-color: var(--secondary-color);
    color: white !important;
    border: 2px solid var(--secondary-color);
}

.nav-buttons-mobile .btn-login {
    color: var(--secondary-color) !important;
    background-color: transparent;
    border: 2px solid var(--secondary-color);
}