/* --- GLOBAL RESET (Add this at the top) --- */
* {
    box-sizing: border-box;
}
/* IMPORTS & VARS (Matches your theme) */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Poppins:wght@300;400;500&display=swap');

:root {
    --primary: #0D261F; /* Deep Green */
    --gold: #C5A059;    /* Copper/Gold */
    --light-bg: #f9f9f9;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-bg);
    height: 100vh; /* Force full height */
}

/* --- MAIN LAYOUT (SPLIT SCREEN) --- */
.profile-container {
    display: flex;
    height: 100vh;
    overflow: hidden; /* Stop page scrolling, let content scroll */
}

/* --- SIDEBAR STYLES --- */
.profile-sidebar {
    width: 280px;
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 40px 20px;
    flex-shrink: 0; /* Don't shrink */
}

/* Header & Avatar */
.sidebar-header {
    text-align: center;
    margin-bottom: 50px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%; /* Makes it circular */
    object-fit: cover;
    border: 3px solid var(--gold);
    margin-bottom: 15px;
    background: #fff; /* Fallback color if image fails */
}

.welcome-text { font-size: 0.9rem; opacity: 0.8; margin: 0; }
.user-name { font-family: 'Playfair Display', serif; margin: 5px 0 0 0; color: var(--gold); }

/* Navigation Links */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1; /* Pushes footer down */
}

.nav-item {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 15px 20px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    font-family: 'Poppins', sans-serif;
}

.nav-item i { margin-right: 15px; width: 20px; }
.nav-item:hover { color: white; background: rgba(255,255,255,0.1); }
/* The active tab style */
.nav-item.active {
    background: var(--gold);
    color: var(--primary);
    font-weight: 600;
}

/* Footer */
.logout-btn {
    background: rgba(0,0,0,0.2);
    color: #ff6b6b;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    display: flex; align-items: center;
}
.logout-btn i { margin-right: 15px; }

/* --- MAIN CONTENT AREA STYLES --- */
.profile-content {
    flex-grow: 1; /* Take remaining space */
    padding: 50px 60px;
    overflow-y: auto; /* Allow scrolling inside this area */
}

.section-title {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 40px;
}

/* Hide all sections by default */
.content-section { display: none; animation: fadeIn 0.4s ease; }
/* Only show the active one */
.content-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- DASHBOARD WIDGETS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.stat-card {
    background: white; padding: 30px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.stat-card h3 { font-size: 2.5rem; color: var(--gold); margin: 0; font-family: 'Playfair Display'; }
.stat-card p { margin: 5px 0 0; color: #888; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }

.gold-link { color: var(--gold); text-decoration: none; font-weight: 600; }

/* Placeholder Styles for other sections */
.empty-state { text-align: center; padding: 50px; color: #999; }
.empty-icon { font-size: 3rem; margin-bottom: 20px; opacity: 0.5; }
.wishlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.wishlist-item { background: white; padding: 20px; border-radius: 12px; }
.add-to-cart-btn { width: 100%; padding: 10px; background: var(--primary); color: white; border: none; cursor: pointer; }
.address-card { background: white; padding: 30px; border-radius: 12px; max-width: 400px; }
.settings-form input { width: 100%; padding: 12px; margin: 10px 0 20px; border: 1px solid #eee; background: #f5f5f5; }


/* --- SETTINGS FORM STYLES --- */
.settings-form .input-group {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary);
}

.settings-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    transition: border 0.3s;
}

.settings-form input:focus {
    outline: none;
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1);
}

.save-btn {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.3s;
    margin-top: 10px;
}

.save-btn:hover {
    background-color: var(--gold);
}

/* --- MOBILE RESPONSIVE (The Stacked Deck) --- */
@media (max-width: 900px) {
    .profile-container {
        flex-direction: column; /* Stack vertically */
        height: auto;
        min-height: 100vh;
    }

    .profile-sidebar {
        width: 100%;
        padding: 20px;
        flex-direction: row; /* Horizontal header */
        align-items: center;
        justify-content: space-between;
        background: var(--primary);
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        text-align: left;
        margin: 0;
    }
    .profile-avatar { width: 50px; height: 50px; margin: 0 15px 0 0; border-width: 2px; }
    .welcome-text { display: none; } /* Hide "Good afternoon" on mobile to save space */
    .user-name { font-size: 1.2rem; }

    /* THE HORIZONTAL SCROLL NAV */
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto; /* Allow horizontal scrolling */
        white-space: nowrap; /* Keep on one line */
        position: absolute;
        top: 80px; /* Place below header */
        left: 0;
        width: 100%;
        background: #091c17; /* Slightly darker green */
        padding: 10px;
    }

    .nav-item {
        padding: 10px 15px;
        font-size: 0.9rem;
        margin-right: 10px;
    }
    .nav-item i { margin-right: 8px; }

    .sidebar-footer { display: none; } /* Hide Logout button on mobile nav bar (add it to settings later) */

    .profile-content {
        padding: 140px 20px 40px; /* Extra padding top for the double header */
    }
}

/* ========================================= */
/* --- ADDRESS MODAL STYLES --- */
/* ========================================= */

/* The Dark Background Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); /* Semi-transparent black */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show it when active */
.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* The White Box */
.modal-content {
    background: #fff;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.modal-header h3 { margin: 0; color: #333; }

.close-modal {
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer; color: #777;
}

/* Form Styles */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem; }
.form-group input {
    width: 100%; padding: 10px;
    border: 1px solid #ccc; border-radius: 4px;
}

/* Address Card Grid (For the list) */
.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.address-card {
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    background: #fff;
}
.address-label {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #555;
}
.delete-addr-btn {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    color: #999; cursor: pointer;
}
.delete-addr-btn:hover { color: #d93025; }

/* ========================================= */
/* --- MOBILE FIXES FOR MODAL --- */
/* ========================================= */

@media (max-width: 768px) {
    
    /* 1. Make the white box wider on phones */
    .modal-content {
        width: 95%;
        padding: 20px; /* Reduce padding from 30px */
        margin: 0 10px; /* Small safety margin */
    }

    /* 2. Stack City and Zip Code vertically */
    /* 2. Stack City and Zip Code vertically */
    .form-row {
        flex-direction: column !important; /* Added !important */
        gap: 0 !important;                 /* Added !important */
    }
    .form-row .form-group {
        width: 100%; /* Full width */
        margin-bottom: 15px;
    }

    /* 3. Force the Save Button to look like a Button */
    /* OLD: #addAddressForm button[type="submit"] */
    
    /* NEW: Target any button inside the form */
    #addAddressForm button { 
        background-color: #000 !important;
        color: #fff !important;
        border: none !important;
        padding: 15px !important;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 4px;
        width: 100%;
        display: block;
        margin-top: 15px; /* Increased margin for spacing */
        cursor: pointer;
    }

    /* 4. Make inputs easier to tap */
    .form-group input {
        padding: 12px;
        font-size: 16px;
        box-sizing: border-box; /* Adds this to prevent width issues */
        width: 100%;
    }
}