@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Modern Design System - "Cloud Indigo" */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --bg-main: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.7);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border: rgba(226, 232, 240, 0.8);
    --border-focus: #4f46e5;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1440px; /* Slightly wider for the full Speedtest experience */
    margin: 0 auto;
    padding: 0 15px;
}

/* Site Navigation */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary);
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Layout Restructure - Three Column on Desktop */
.page-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px 0;
    flex: 1;
}

@media (min-width: 1200px) {
    .page-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .sidebar-left, .sidebar-right {
        width: 300px;
        flex-shrink: 0;
        position: sticky;
        top: 80px; /* Clear the navbar */
        min-height: 600px;
        background: rgba(241, 245, 249, 0.5); /* AD Placeholder background like Speedtest */
        border-radius: 12px;
        border: 1px dashed var(--border);
    }
    
    .sidebar-left { order: 1; }
    .main-content { order: 2; flex: 1; min-width: 0; padding: 0 15px; }
    .sidebar-right { order: 3; }
}

/* Hero Section */
.hero-section {
    padding: 10px 0; /* Reduced padding when nested */
    text-align: center;
    margin-bottom: 20px;
}

.main-header {
    margin-bottom: 15px;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Glass Container */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
}

/* Search Box */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
}

.search-input-group {
    display: flex;
    gap: 8px;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    transform: translateY(-1px);
}

.search-btn {
    padding: 0 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

/* Validation Messages */
.validation-message {
    margin-top: 15px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    display: none;
    animation: fadeInDown 0.3s ease-out;
}

.validation-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.validation-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Results Section */
.results-container {
    margin-top: 20px;
}

.pincode-info {
    margin-bottom: 20px;
    text-align: center;
}

/* Ad Banners */
.ad-header-banner {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    margin-bottom: 5px; /* Tighter against the content */
    background: #f1f5f9;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.ad-square-hero {
    width: 100%;
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f1f5f9;
    border: 1px dashed var(--border);
    border-radius: 12px;
    margin-bottom: 15px;
}

.pincode-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
}

.pincode-badge i {
    color: var(--primary);
}

.pincode-badge strong {
    color: var(--primary);
    font-size: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.section-title i {
    color: var(--primary);
}

/* Services Grid - 2 Column Layout */
.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Service Card */
.service-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.service-card-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.service-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

/* New Structured Row Labels (Columns) */
.results-header-labels {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 8px;
}

.service-locations {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.location-row:last-child {
    border-bottom: none;
}

.location-row:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
}

.loc-col-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loc-col-info i {
    color: var(--accent);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.loc-col-pin {
    font-weight: 500;
    font-size: 0.85rem;
}

.loc-col-pin a {
    color: var(--primary);
    text-decoration: none;
}

.loc-col-pin a:hover {
    text-decoration: underline;
}

.loc-col-dist {
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--success);
}

.location-item:hover {
    background: white;
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.location-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 4px;
}

.location-name i {
    color: var(--accent);
    font-size: 0.9rem;
}

.available-tag {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
}

.location-pincode {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.location-distance {
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 4px;
}

/* Ad Card (In-Feed) */
.ad-card-infeed {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 20px;
    position: relative;
}

.ad-label {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
}

/* Expand Button */
.expand-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.expand-btn:hover {
    background: white;
    border-color: var(--primary);
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-weight: 600;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.no-results i {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.no-results p {
    color: var(--text-muted);
}

/* Ad Containers */
.ad-container {
    margin: 30px auto;
    text-align: center;
    clear: both;
}

.ad-sticky-sidebar {
    width: 300px;
    min-height: 600px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.ad-header-banner {
    max-width: 970px;
    min-height: 90px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 40px;
}

.ad-footer-banner {
    max-width: 970px;
    min-height: 250px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-top: 40px;
}

/* Footer */
.footer {
    background: white;
    padding: 40px 0;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.25rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
        padding: 16px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-left, .sidebar-right {
        display: none; /* Hide sidebars on mobile */
    }
    
    .ad-header-banner, .ad-footer-banner {
        max-width: 320px;
        min-height: 100px;
    }

    .glass-card {
        border-radius: 16px;
    }
    
    .search-wrapper {
        padding: 20px;
    }
}

/* Login Page Specific (Preserved but modernized) */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

.login-box h1 {
    color: var(--primary);
    font-weight: 700;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    width: 100%;
    border: none;
    cursor: pointer;
}
