/* ==========================================================================
   1. GLOBAL SYSTEM VARIABLES & CORE RESET
   ========================================================================== */
:root { 
    --primary: #2563eb; 
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --text: #1f2937; 
    --text-muted: #6b7280;
    --bg: #f8fafc; 
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --footer-bg: #0f172a;
}

body { 
    font-family: system-ui, -apple-system, sans-serif; 
    margin: 0; 
    padding: 0; 
    color: var(--text); 
    background: var(--bg); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

/* ==========================================================================
   2. SITE HEADERS & SEARCH BAR STRIP
   ========================================================================== */
header { 
    background: white; 
    border-bottom: 1px solid var(--border); 
    padding: 1rem 2rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.02); 
}
header strong { font-size: 1.25rem; color: var(--primary); }
nav a { margin-left: 1.5rem; text-decoration: none; color: var(--text-muted); font-weight: 500; }
nav a.active { color: var(--primary); }

.search-strip { background: white; padding: 1rem 2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: center; }
.search-box { position: relative; width: 100%; max-width: 600px; }
.search-box input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 8px; outline: none; box-sizing: border-box; }
.search-box::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }

/* ==========================================================================
   3. LAYOUT MAIN GRID & ASIDE PANEL
   ========================================================================== */
.split-wrapper { display: flex; flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; box-sizing: border-box; }

.left-sidebar { 
    width: 320px; 
    background: #f1f5f9; 
    border-right: 1px solid var(--border); 
    position: sticky; 
    top: 135px; 
    height: calc(100vh - 135px); 
    overflow-y: auto; 
    padding: 1rem; 
    box-sizing: border-box; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}
.sidebar-title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; color: #64748b; padding: 0 0.5rem 0.25rem 0.5rem; letter-spacing: 0.05em; }

/* Category Side Nav Navigation Cards */
.cat-nav-item { 
    width: 100%; 
    border: 1px solid var(--border); 
    background: var(--card-bg); 
    text-align: left; 
    padding: 0.85rem 1rem; 
    font-size: 0.9rem; 
    font-weight: 500; 
    color: #374151; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    transition: all 0.2s ease; 
    border-radius: 8px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.03); 
    box-sizing: border-box; 
}
.cat-nav-item:hover { background: #f8fafc; border-color: #cbd5e1; transform: translateX(2px); }
.cat-nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; border-color: #93c5fd; box-shadow: 0 2px 4px rgba(37,99,235,0.08); }

.cat-nav-item .material-icons { font-size: 1.3rem; color: #64748b; background: #f1f5f9; padding: 6px; border-radius: 6px; transition: all 0.2s; }
.cat-nav-item:hover .material-icons { color: var(--primary); background: #e2e8f0; }
.cat-nav-item.active .material-icons { color: white; background: var(--primary); }

/* ==========================================================================
   4. CONTENT LAYOUT, MAIN CARDS, & FOOTER
   ========================================================================== */
.right-content { flex: 1; padding: 2rem; overflow-y: auto; box-sizing: border-box; }
.page-headline { margin-top: 0; margin-bottom: 1.5rem; font-size: 1.75rem; letter-spacing: -0.02em; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

.listing-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(0,0,0,0.02); transition: transform 0.2s, box-shadow 0.2s; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); }

.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.cat-badge { background: #f1f5f9; color: #475569; font-size: 0.7rem; font-weight: 700; padding: 0.3rem 0.6rem; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); }
.cat-badge .material-icons { font-size: 0.85rem; }
.status-dot { font-size: 0.75rem; color: #10b981; font-weight: 600; }

.listing-card h3 { margin: 0 0 0.25rem 0; font-size: 1.1rem; color: #111827; }
.card-location { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.card-description { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; flex-grow: 1; }

.contact-action-box { border-top: 1px solid #f1f5f9; padding-top: 0.75rem; display: flex; justify-content: space-between; align-items: center; }
.btn-call { background: #10b981; color: white; text-decoration: none; padding: 0.45rem 0.85rem; border-radius: 6px; font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.btn-call .material-icons { font-size: 0.9rem; }
.view-link { font-size: 0.8rem; color: var(--primary); text-decoration: none; font-weight: 600; }

.no-results { grid-column: 1 / -1; text-align: center; padding: 4rem 2rem; background: white; border-radius: 12px; display: none; border: 1px dashed var(--border); color: var(--text-muted); }
.site-footer { background: var(--footer-bg); color: #94a3b8; padding: 1.5rem 2rem; text-align: center; font-size: 0.85rem; border-top: 1px solid #1e293b; }

/* ==========================================================================
   5. PREMIUM SCROLL TO TOP MODULE (Root Desktop Level Layout)
   ========================================================================== */
.premium-scroll-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    width: 52px;
    height: 52px;
    background: rgba(37, 99, 235, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    cursor: pointer;
    
    /* Display configuration fixes */
    display: none; 
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4),
                0 8px 16px -6px rgba(37, 99, 235, 0.2);
    transition: background 0.3s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

.btn-glow-pulse {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 15px;
    border: 2px solid var(--primary);
    opacity: 0;
    z-index: -1;
}

/* Hover Engine Settings */
.premium-scroll-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 30px -8px rgba(29, 78, 216, 0.5),
                0 12px 20px -8px rgba(29, 78, 216, 0.3);
}
.premium-scroll-btn:hover .btn-glow-pulse {
    animation: scrollBtnPulse 2s infinite;
}
.premium-scroll-btn:hover .scroll-arrow-icon {
    animation: arrowMicroBounce 0.6s infinite alternate ease-in-out;
}
.premium-scroll-btn:active {
    transform: translateY(-2px) scale(0.98);
}
.premium-scroll-btn .scroll-arrow-icon {
    font-size: 24px;
    font-weight: bold;
    display: inline-block;
}

/* Smooth State Activator via JS Mutation Hooks */
.premium-scroll-btn.is-visible {
    display: flex;
    animation: smoothFadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Keyframes Studio Engine */
@keyframes smoothFadeInUp {
    from { opacity: 0; transform: translateY(15px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scrollBtnPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}
@keyframes arrowMicroBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

/* ==========================================================================
   6. RESPONSIVE HOOK MODULE (MOBILE PORTING)
   ========================================================================== */
@media (max-width: 900px) {
    header { flex-direction: column; gap: 0.75rem; text-align: center; padding: 1rem; }
    nav a { margin: 0 0.5rem; }
    .search-strip { padding: 0.75rem; }
    
    .split-wrapper { flex-direction: column; }
    
    .left-sidebar { 
        width: 100%; 
        height: auto; 
        position: static; 
        display: flex; 
        flex-direction: row; 
        overflow-x: auto; 
        overflow-y: hidden; 
        padding: 0.75rem; 
        background: #f1f5f9; 
        white-space: nowrap; 
        border-bottom: 1px solid var(--border); 
        border-right: none; 
        gap: 8px; 
    }
    
    .sidebar-title { display: none; }
    
    .cat-nav-item { width: auto; display: inline-flex; padding: 0.5rem 1rem; border-radius: 12px; transform: none !important; }
    .cat-nav-item.active { background: var(--primary); color: white; border-color: var(--primary); }
    .cat-nav-item.active .material-icons { color: var(--primary); background: white; }
    
    .right-content { padding: 1rem; }
    .page-headline { font-size: 1.4rem; margin-bottom: 1rem; }
    .market-grid { grid-template-columns: 1fr; }
    
    /* Responsive overrides for the Action Button to clean up touch zones */
    .premium-scroll-btn {
        bottom: 20px;
        right: 20px;
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }
    .premium-scroll-btn .scroll-arrow-icon {
        font-size: 20px;
    }
}