/* =========================================
   1. VARIABLES
   ========================================= */
:root {
    /* Colors */
    --primary-color: #00796b;
    --primary-blue: #00796b;
    --primary-hover: #004d40;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-500: #6b7280;
    --neutral-900: #111827;
    --white: #ffffff;
    
    /* Dimensions */
    --header-height-desktop: 80px;
    --header-height-mobile: 60px; /* Default Base Height */
    
    --radius-md: 8px;
    --radius-pill: 50px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --gradient-hero: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --gradient-primary: linear-gradient(135deg, #00796b 0%, #009688 100%);
}

@font-face { font-family: 'EpicPro'; src: url('epicpro.ttf') format('truetype'); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--neutral-100); 
    color: var(--neutral-900); 
    line-height: 1.6; 
    padding-top: var(--header-height-desktop); 
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* =========================================
   2. HEADER STYLES (DESKTOP - UNCHANGED)
   ========================================= */
.header {
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--neutral-300);
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    height: var(--header-height-desktop);
    display: flex; align-items: center;
    box-shadow: var(--shadow-sm);
    transition: height 0.3s ease;
}

.header .container {
    display: flex; align-items: center; justify-content: space-between; 
    width: 100%; gap: 20px;
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo img { height: 40px; }
.logo span { font-family: 'EpicPro', sans-serif; color: var(--primary-blue); font-size: 1.6rem; font-weight: 700; }

.search-city-group {
    display: flex; align-items: center; gap: 15px; flex-grow: 1; max-width: 650px;
}

/* Desktop Input Heights */
.city-selector-btn {
    display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px;
    background: var(--white); border: 1px solid var(--neutral-300); border-radius: var(--radius-md);
    color: var(--neutral-900); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.city-selector-btn svg { width: 18px; fill: var(--neutral-500); }
.clear-city-icon { display: none; margin-left: 5px; }
.city-selector-btn.has-city .clear-city-icon { display: inline; }

.header .search-form {
    flex-grow: 1; height: 44px; display: flex; align-items: center;
    background: var(--neutral-100); border: 1px solid transparent; border-radius: var(--radius-pill);
    overflow: hidden; width: 100%;
}
.header .search-input { flex: 1; height: 100%; border: none; background: transparent; padding: 0 16px; outline: none; font-size: 14px; }
.header .search-button { height: 100%; padding: 0 20px; background: var(--primary-blue); border: none; color: white; font-weight: 600; cursor: pointer; }
.search-button-icon { display: none; }
.search-button-text { display: block; }

.main-nav { display: flex; align-items: center; gap: 15px; margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 15px; }
.nav-link { text-decoration: none; color: var(--neutral-500); font-weight: 500; font-size: 14px; padding: 6px 10px; }
.nav-link:hover { color: var(--primary-blue); }

.auth-actions { display: flex; align-items: center; gap: 10px; }
.auth-button { padding: 8px 16px; background: var(--primary-blue); color: white; border-radius: var(--radius-pill); text-decoration: none; font-size: 13px; }
.profile-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--neutral-300); overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; background: #eee; }
.profile-picture-img { width: 100%; height: 100%; object-fit: cover; }

.mobile-header-button { display: none; }
.mobile-search-input-trigger { display: none; }

.settings-button { background: none; border: none; cursor: pointer; }
.settings-icon { width: 24px; fill: var(--neutral-500); }
.settings-menu { display: none; position: absolute; top: 60px; right: 20px; background: white; padding: 10px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border: 1px solid #eee; flex-direction: column; gap: 5px; z-index: 1100; }
.settings-menu.active { display: flex; }
.settings-menu-button { padding: 8px; text-decoration: none; color: #333; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.settings-menu-button svg { width: 16px; }

/* =========================================
   3. MOBILE OPTIMIZATION (DYNAMIC LAYOUT)
   ========================================= */
@media (max-width: 992px) {
    
    /* --- COMMON MOBILE RESET --- */
    .main-nav, .auth-actions { display: none; }
    .logo img { height: 28px; }
    
    /* --- STATE A: LOGGED OUT (2 Rows) --- */
    body.logged-out { padding-top: 100px; }
    body.logged-out .header { height: 100px; padding: 8px 0; align-items: flex-start; }
    body.logged-out .header .container {
        flex-direction: row; flex-wrap: wrap;
        justify-content: space-between; align-items: center;
        gap: 5px 0; padding: 0 16px;
    }
    
    /* Row 1 */
    body.logged-out .logo { order: 1; margin-bottom: 5px; }
    body.logged-out .logo span { display: block; font-size: 0.9rem; } /* Show Brand Name */
    body.logged-out .mobile-header-button {
        order: 2;
        display: flex !important; position: static;
        padding: 0 10px; font-size: 11px; height: 26px;
        background: var(--primary-blue); color: white;
        border-radius: var(--radius-pill); text-decoration: none;
        align-items: center; justify-content: center; font-weight: 600;
    }
    
    /* Row 2 */
    body.logged-out .search-city-group {
        order: 3; width: 100%; display: flex; margin-top: 2px;
    }
    body.logged-out .city-selector-btn { display: none !important; } /* Hide City */
    body.logged-out .header .search-form {
        width: 100%; flex-grow: 1; height: 34px;
        border: 1px solid var(--neutral-300); border-radius: 6px;
    }
    body.logged-out .header .search-input { font-size: 12px; padding: 0 10px; }
    body.logged-out .header .search-button { padding: 0 12px; }
    body.logged-out .search-button-text { display: none; }
    body.logged-out .search-button-icon { display: block; width: 14px; height: 14px; fill: white; }


    /* --- STATE B: LOGGED IN (1 Row - Compact) --- */
    body.logged-in { padding-top: 60px; }
    body.logged-in .header { height: 60px; padding: 0; align-items: center; }
    body.logged-in .header .container {
        flex-direction: row; flex-wrap: nowrap;
        justify-content: space-between; align-items: center;
        gap: 6px; padding: 0 8px;
    }
    
    /* Row 1 (All Inline) */
    body.logged-in .logo { order: 1; margin-right: 0; }
    body.logged-in .logo span { display: none; } /* Hide Brand Name */
    
    body.logged-in .search-city-group { order: 2; display: flex; flex: 1; max-width: none; gap: 5px; }
    
    body.logged-in .city-selector-btn {
        display: flex !important; width: auto; flex-shrink: 0;
        height: 30px; padding: 0 6px; font-size: 10px;
        background: var(--neutral-100); max-width: 75px;
        overflow: hidden; text-overflow: ellipsis; border-radius: 6px;
    }
    body.logged-in .city-selector-btn svg { width: 12px; height: 12px; }
    body.logged-in .city-selector-btn .dropdown-icon { display: none; }
    
    body.logged-in .header .search-form {
        flex-grow: 1; height: 30px; border: 1px solid var(--neutral-300); border-radius: 6px;
    }
    body.logged-in .header .search-input { font-size: 11px; padding: 0 8px; }
    body.logged-in .header .search-button { padding: 0 8px; }
    body.logged-in .search-button-text { display: none; }
    body.logged-in .search-button-icon { display: block; width: 14px; height: 14px; fill: white; }
    
    body.logged-in .profile-icon-btn.mobile-header-profile {
        order: 3; display: flex !important; position: static;
        width: 28px; height: 28px; border: 1px solid var(--neutral-300); background: #eee;
        flex-shrink: 0;
    }
    body.logged-in .mobile-header-button { display: none !important; }
}

/* =========================================
   4. PAGE CONTENT
   ========================================= */
.hero { padding: 40px 0; background: var(--gradient-hero); text-align: center; }
.hero h1 { margin-bottom: 10px; color: var(--neutral-900); font-weight: 800; font-size: 2.5rem; font-family: 'Poppins', sans-serif; }
.hero-subtitle { color: var(--neutral-500); max-width: 600px; margin: 0 auto; font-size: 1.1rem; }

@media (max-width: 768px) {
    .hero h1 { font-size: 1.45rem; line-height: 1.25; padding: 0 10px; margin-bottom: 8px; }
    .hero-subtitle { font-size: 0.85rem; padding: 0 20px; line-height: 1.4; }
}

.categories-section { padding: 30px 0 50px; background: white; }
.categories-header { display: flex; justify-content: center; gap: 10px; margin-bottom: 25px; }
.categories-heading { font-family: 'Poppins', sans-serif; color: var(--neutral-900); font-size: 1.8rem; }
#category-toggle-btn { border: none; background: none; }
#category-toggle-btn svg { width: 24px; fill: var(--neutral-500); transition: 0.3s; }
#category-toggle-btn.expanded svg { transform: rotate(180deg); }

/* Desktop Grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 15px; justify-items: center; }
.category-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--neutral-500); font-weight: 500; }

/* Desktop Icon */
.category-item .icon-wrapper { width: 54px; height: 54px; background: white; border: 1px solid var(--neutral-200); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; box-shadow: var(--shadow-sm); transition: 0.2s; }
.category-item svg { width: 24px; height: 24px; }
.category-item span { font-size: 12px; }
.category-item.hidden { display: none; }

/* Mobile Grid */
@media (max-width: 768px) {
    .categories-heading { font-size: 1.3rem; }
    .category-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .category-item .icon-wrapper { width: 44px; height: 44px; border-radius: 10px; }
    .category-item svg { width: 20px; height: 20px; }
    .category-item span { font-size: 9px; text-align: center; line-height: 1.2; }
}

/* Category Colors */
a[href*="category=restaurants"] svg { fill: #f26622; }
a[href*="category=hospitals"] svg { fill: #00796b; }
a[href*="category=beauty"] svg { fill: #e54b8b; }
a[href*="category=shopping"] svg { fill: #8a4a9f; }
a[href*="category=home"] svg { fill: #f7941d; }
a[href*="category=education"] svg { fill: #00a89d; }
a[href*="category=real"] svg { fill: #39b54a; }
a[href*="category=auto"] svg { fill: #00796b; }
a[href*="category=gym"] svg { fill: #ef4d42; }
a[href*="category=doctor"] svg { fill: #00796b; }
a[href*="category=travel"] svg { fill: #00796b; }
a[href*="category=packer"] svg { fill: #662d91; }
a[href*="category=hotel"] svg { fill: #fdb913; }
a[href*="category=rental"] svg { fill: #8dc63f; }
a[href*="category=event"] svg { fill: #be1e2d; }
a[href*="category=caterer"] svg { fill: #92278f; }
a[href*="category=interior"] svg { fill: #f7931e; }
a[href*="category=contractor"] svg { fill: #00a651; }
a[href*="category=pest"] svg { fill: #d4145a; }
a[href*="category=courier"] svg { fill: #009688; }
a[href*="category=pet"] svg { fill: #f15a24; }
a[href*="category=consultant"] svg { fill: #00a99d; }
a[href*="category=insurance"] svg { fill: #00796b; }
a[href*="category=photo"] svg { fill: #603813; }
a[href*="category=music"] svg { fill: #9e1f63; }
a[href*="category=sport"] svg { fill: #f36523; }
a[href*="category=electronic"] svg { fill: #414042; }
a[href*="category=furniture"] svg { fill: #8b5e3c; }
a[href*="category=lawyer"] svg { fill: #a47d52; }
a[href*="category=salon"] svg { fill: #ec008c; }

.ad-placeholder-section { padding: 30px 0; background: #e9ecef; }
.ad-placeholder { border: 2px dashed var(--neutral-500); border-radius: 12px; padding: 30px; text-align: center; background: white; }

/* FAQ */
.faq-section { padding: 40px 0; background: white; border-top: 1px solid var(--neutral-200); }
.section-title { text-align: center; margin-bottom: 20px; font-family: 'Poppins', sans-serif; color: var(--neutral-900); font-size: 1.8rem; }
.faq-item { border: 1px solid var(--neutral-200); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.faq-question { padding: 15px; font-weight: 600; display: flex; justify-content: space-between; cursor: pointer; align-items: center; }
.faq-answer { max-height: 0; overflow: hidden; padding: 0 15px; transition: 0.3s; color: var(--neutral-500); }
.faq-item.active .faq-answer { max-height: 200px; padding-bottom: 15px; }
.faq-question::after { content: '+'; font-size: 1.5rem; color: var(--primary-blue); transition: transform 0.3s ease; }
.faq-item.active .faq-question::after { transform: rotate(45deg); }

@media (max-width: 768px) {
    .faq-question { font-size: 13.5px; padding: 12px; }
    .faq-answer { font-size: 13px; }
    .section-title { font-size: 1.3rem; }
}

/* Footer */
.footer { background: #1E293B; color: #94A3B8; padding: 40px 0 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; padding-bottom: 30px; text-align: left; }
.footer-column h4 { color: white; margin-bottom: 16px; font-family: 'Poppins', sans-serif; }
.footer-links { list-style: none; }
.footer-links a { color: #94A3B8; text-decoration: none; display: block; margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid #334155; padding-top: 20px; display: flex; justify-content: space-between; font-size: 13px; align-items: center; }

.social-links { display: flex; gap: 15px; }
.social-links svg { width: 24px; height: 24px; transition: 0.3s; }
a[aria-label="Facebook"] svg { fill: #1877F2; }
a[aria-label="X"] svg { fill: #ffffff; }
a[aria-label="Instagram"] svg { fill: #E4405F; }

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .footer-bottom { flex-direction: column; gap: 15px; text-align: center; }
    .footer-about-text { font-size: 12px; }
}

/* Modals */
.city-modal-overlay, .mobile-search-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.city-modal-overlay.active { opacity: 1; pointer-events: auto; }
.city-modal { background: white; width: 90%; max-width: 400px; max-height: 70vh; border-radius: 16px; display: flex; flex-direction: column; }
.city-modal-header { padding: 15px; border-bottom: 1px solid var(--neutral-300); display: flex; justify-content: space-between; }
.city-modal-search { padding: 15px; background: var(--neutral-100); }
#city-search-input { width: 100%; padding: 10px; border: 1px solid var(--neutral-300); border-radius: 8px; }
.city-list-container { padding: 10px; overflow-y: auto; display: grid; grid-template-columns: 1fr; gap: 5px; }
.city-item { padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 14px; }

#login-signup-popup, #login-signup-popup-backdrop { display: none !important; }