/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables for theme switching */
:root {
    /* Light theme colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #1d4ed8;
    --accent-light: #dbeafe;
    --border-color: #e2e8f0;
    --shadow: 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);
    --success-bg: #dcfce7;
    --success-text: #166534;
    --success-border: #bbf7d0;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --error-border: #fecaca;
    --table-hover: #f8fafc;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-light: #1e3a8a;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --success-bg: #14532d;
    --success-text: #4ade80;
    --success-border: #166534;
    --error-bg: #7f1d1d;
    --error-text: #f87171;
    --error-border: #dc2626;
    --table-hover: #374151;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header with Navigation */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: none;
    width: 100%;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    flex: 1;
}

.logo {
    height: 40px;
    max-width: 180px;
    padding-left: 0.3em;
    width: auto;
    display: block;
    transition: opacity 0.3s ease;
    vertical-align: middle;
}

/* Light theme - show light logo, hide dark logo */
[data-theme="light"] .logo-light {
    display: block;
}

[data-theme="light"] .logo-dark {
    display: none;
}

/* Dark theme - hide light logo, show dark logo with inversion */
[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
    filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

/* Preserve the #3B82F6 blue by rotating hue back */
[data-theme="dark"] .logo-dark {
    filter: brightness(0) saturate(100%) invert(98%) sepia(7%) saturate(552%) hue-rotate(186deg) brightness(116%) contrast(96%);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    min-width: 2.5rem;
    height: 2.5rem;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:active .theme-icon {
    transform: rotate(180deg);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* SEO H1 Heading - Hidden from display but visible to search engines */
.page-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Card Styles */
.card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* USP Cards */
.usp-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 0;
}

.usp-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: default;
}

.usp-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.usp-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.usp-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.usp-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.search-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.search-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 200px) 1fr minmax(120px, 140px) auto;
    gap: 1rem;
    align-items: end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Specific width controls */
.input-country {
    grid-column: 1;
}

.input-pincode {
    grid-column: 2;
}

.input-radius {
    grid-column: 3;
}

.search-btn-compact {
    grid-column: 4;
    white-space: nowrap;
    padding: 0.75rem 1.5rem;
}

.input-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Country select wrapper with flag */
.country-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.country-flag {
    position: absolute;
    left: 0.75rem;
    width: 1.25rem;
    height: auto;
    pointer-events: none;
    z-index: 1;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-select-wrapper select {
    padding-left: 2.5rem !important;
    width: 100%;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.search-btn {
    padding: 0.75rem 2rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
    font-family: inherit;
}

.search-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

/* Loading Card */
.loading-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.loading-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.loading-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

.loading-stats span {
    font-weight: 500;
}

#progressText {
    font-size: 0.875rem;
    text-align: center;
    color: var(--text-tertiary);
    margin: 0;
}

#loadingText {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    text-align: center;
}

/* Error Card */
.error-card {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    font-weight: 500;
    border-left: 4px solid var(--error-text);
}

/* Results Card */
.results-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.results-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.results-header p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.results-count {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--success-border);
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

.results-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-results-input {
    flex: 1;
    min-width: 200px;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
}

.search-results-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.download-csv-btn {
    padding: 0.625rem 1.25rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.download-csv-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

/* Table */
.table-container {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.results-table thead {
    background: var(--bg-tertiary);
}

.results-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.results-table tbody tr:hover {
    background: var(--table-hover);
    cursor: pointer;
}

.results-table .pincode {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-primary);
}

.results-table .distance {
    font-weight: 500;
    color: var(--text-primary);
}

.results-table .country {
    font-weight: 500;
}

/* Map Card */
.map-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: 500px;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.map {
    height: 500px;
    background: var(--bg-tertiary);
}

.leaflet-container {
    background: var(--bg-tertiary) !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--accent-primary) !important;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    margin: 2rem;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Quick Action Banners - Mobile Responsive */
@media (max-width: 768px) {
    .main-content > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        margin-bottom: 0 !important;
        gap: 1rem !important;
    }
    
    /* Override inline styles for Quick Action cards */
    .main-content > div[style*="grid-template-columns"] .search-card[style*="linear-gradient"] {
        padding: 0.875rem !important;
    }
    
    .main-content > div[style*="grid-template-columns"] .search-card[style*="linear-gradient"] h2 {
        font-size: 0.8125rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .main-content > div[style*="grid-template-columns"] .search-card[style*="linear-gradient"] p {
        font-size: 0.6875rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .main-content > div[style*="grid-template-columns"] .search-card[style*="linear-gradient"] .search-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.75rem !important;
    }
}

/* Responsive Design - Mobile Optimized (Clean & Compact) */
@media (max-width: 768px) {
    /* Header - Compact */
    .header {
        padding: 0.75rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        margin-bottom: 0;
    }
    
    .logo-container {
        flex: 1;
    }
    
    .logo {
        height: 50px;
    }
    
    /* Main Content - Compact Spacing */
    .main-content {
        padding: 0.75rem;
        padding-top: 0.5rem;
        gap: 1rem;
    }
    
    /* Search Card - Compact */
    .search-card {
        padding: 0.875rem;
        border-radius: 0.5rem;
    }
    
    .search-card h2 {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
    }
    
    .search-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .input-country,
    .input-pincode,
    .input-radius,
    .search-btn-compact {
        grid-column: 1;
    }
    
    .input-group {
        min-width: auto;
        gap: 0.375rem;
    }
    
    .input-group label {
        font-size: 0.75rem;
        font-weight: 500;
    }
    
    .input-group input,
    .input-group select {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 0.375rem;
    }
    
    .country-flag {
        left: 0.625rem;
        width: 1rem;
    }
    
    .country-select-wrapper select {
        padding-left: 2.25rem !important;
    }
    
    .search-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
        font-weight: 500;
    }
    
    /* USP Cards - Compact Horizontal Carousel */
    .usp-cards {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 0.75rem;
        padding: 0 0 0.75rem 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        margin-bottom: 1rem;
    }
    
    .usp-cards::-webkit-scrollbar {
        height: 3px;
    }
    
    .usp-cards::-webkit-scrollbar-track {
        background: var(--bg-tertiary);
        border-radius: 2px;
    }
    
    .usp-cards::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .usp-card {
        min-width: calc(75% - 0.5rem);
        max-width: calc(75% - 0.5rem);
        padding: 1rem;
        scroll-snap-align: start;
        flex-shrink: 0;
        border-radius: 0.5rem;
    }
    
    .usp-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .usp-card h3 {
        font-size: 0.75rem !important;
        margin-bottom: 0.3rem;
        line-height: 1.4 !important;
        font-weight: 600 !important;
    }
    
    .usp-card p {
        font-size: 0.6875rem !important;
        line-height: 1.5 !important;
        font-weight: 400 !important;
    }
    
    /* Help Section - Ultra Compact */
    .help-section {
        padding: 0.75rem !important;
        border-radius: 0.5rem;
        margin-bottom: 0.875rem;
    }
    
    .help-section h2 {
        font-size: 0.8125rem !important;
        font-weight: 600;
        margin-bottom: 0.625rem;
    }
    
    .help-cards {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .help-card {
        width: 100%;
        padding: 0.625rem !important;
        border-left: 2px solid var(--accent-primary);
        border-radius: 0.25rem;
    }
    
    .help-card h3 {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.3rem !important;
        line-height: 1.4 !important;
    }
    
    .help-card p {
        font-size: 0.6875rem !important;
        line-height: 1.5 !important;
        font-weight: 400 !important;
    }
    
    /* FAQ Section - Maximum Compact */
    .faq-section {
        padding: 0.75rem !important;
        border-radius: 0.5rem;
        margin-bottom: 0.875rem;
    }
    
    .faq-section h2 {
        font-size: 0.8125rem !important;
        font-weight: 600;
        margin-bottom: 0.625rem;
    }
    
    .faq-container {
        gap: 0.4rem !important;
    }
    
    .faq-item {
        padding: 0.5rem 0.625rem !important;
        border-radius: 0.3rem;
    }
    
    .faq-item summary {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        line-height: 1.4 !important;
        padding-right: 1.5rem;
        position: relative;
    }
    
    .faq-item summary::after {
        font-size: 0.875rem;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .faq-item[open] summary::after {
        transform: translateY(-50%) rotate(180deg);
    }
    
    .faq-item p {
        margin-top: 0.4rem !important;
        font-size: 0.6875rem !important;
        line-height: 1.5 !important;
        padding-right: 0;
        font-weight: 400 !important;
    }
    
    /* Results - Compact */
    .results-header {
        padding: 0.875rem;
    }
    
    .results-header h2 {
        font-size: 0.9375rem;
        margin-bottom: 0.375rem;
    }
    
    .results-header p {
        font-size: 0.75rem;
        margin-bottom: 0.625rem;
    }
    
    .results-count {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 0.25rem;
    }
    
    .results-actions {
        gap: 0.625rem;
        margin-top: 0.75rem;
    }
    
    .search-results-input {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
        min-width: 150px;
    }
    
    .download-csv-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
    }
    
    /* Table - Compact */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table {
        min-width: 550px;
        font-size: 0.75rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .results-table th {
        font-size: 0.6875rem;
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }
    
    /* Map - Compact */
    .map-card {
        height: 350px;
        border-radius: 0.5rem;
    }
    
    .map {
        height: 100%;
    }
    
    /* Loading - Compact */
    .loading-card {
        padding: 2rem 1rem;
    }
    
    .spinner {
        width: 2rem;
        height: 2rem;
        margin-bottom: 1.5rem;
    }
    
    #loadingText {
        font-size: 0.9375rem;
    }
    
    #progressText {
        font-size: 0.75rem;
    }
    
    /* Error Card - Compact */
    .error-card {
        padding: 0.875rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
    }
    
    /* Pagination - Compact */
    .pagination-controls {
        padding: 0.875rem;
    }
    
    .pagination-info p {
        font-size: 0.75rem;
    }
    
    .load-more-btn, .show-all-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
    }
    
    /* Override ALL inline styles for distance results and location cards */
    #distanceResults div[style*="font-size: 3rem"],
    #distanceResults div[style*="font-size: 1.25rem"],
    #distanceResults div[style*="font-size: 1.125rem"] {
        font-size: 1.5rem !important;
    }
    
    #distanceResults div[style*="font-size: 0.875rem"] {
        font-size: 0.6875rem !important;
    }
    
    #distanceResults div[style*="font-size: 0.75rem"] {
        font-size: 0.6875rem !important;
    }
    
    #distanceResults div[style*="padding: 2rem"] {
        padding: 0.875rem !important;
    }
    
    #distanceResults div[style*="padding: 1.5rem"] {
        padding: 0.625rem !important;
    }
    
    #distanceResults div[style*="padding: 1rem"] {
        padding: 0.5rem !important;
    }
    
    #distanceResults label[style*="font-size: 0.875rem"] {
        font-size: 0.6875rem !important;
    }
    
    #distanceResults input[style*="font-size: 1rem"] {
        font-size: 0.875rem !important;
        padding: 0.625rem 0.75rem !important;
    }
    
    #distanceResults button[style*="font-size: 1.1rem"] {
        font-size: 0.8125rem !important;
        padding: 0.625rem 1.25rem !important;
    }
    
    /* Override inline styles for location results cards */
    #locationResults div[style*="font-size: 2rem"],
    #locationResults div[style*="font-size: 1.25rem"],
    #locationResults div[style*="font-size: 1.5rem"] {
        font-size: 1rem !important;
    }
    
    #locationResults div[style*="font-size: 0.9rem"],
    #locationResults div[style*="font-size: 0.875rem"] {
        font-size: 0.6875rem !important;
    }
    
    #locationResults div[style*="padding: 2rem"],
    #locationResults div[style*="padding: 1.5rem"] {
        padding: 0.75rem !important;
    }
    
    #locationResults div[style*="padding: 1rem"] {
        padding: 0.5rem !important;
    }
    
    /* Distance results specific - make distance number smaller */
    #resultDistance {
        font-size: 1.75rem !important;
    }
    
    #resultDistanceMiles {
        font-size: 0.875rem !important;
    }
    
    #fromLocationName,
    #toLocationName,
    #resultCity,
    #resultState,
    #resultCountry {
        font-size: 0.8125rem !important;
    }
    
    #resultPincode {
        font-size: 1.25rem !important;
    }
    
    #fromLocationCoords,
    #toLocationCoords,
    #resultCoords {
        font-size: 0.625rem !important;
    }
    
    /* More aggressive overrides for button and result cards */
    .search-card button[style*="font-size"],
    .search-card a[style*="font-size"],
    #distanceResults .search-btn,
    #locationResults .search-btn {
        font-size: 0.75rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    /* Override gradient result card fonts */
    #distanceResults > div[style*="padding"] > div[style*="linear-gradient"] * {
        font-size: inherit !important;
    }
    
    #distanceResults > div[style*="padding"] > div[style*="linear-gradient"] div[style*="font-size: 3rem"] {
        font-size: 1.5rem !important;
    }
    
    #distanceResults > div[style*="padding"] > div[style*="linear-gradient"] div[style*="font-size: 1.25rem"] {
        font-size: 0.875rem !important;
    }
    
    #distanceResults > div[style*="padding"] > div[style*="linear-gradient"] div[style*="font-size: 0.875rem"] {
        font-size: 0.625rem !important;
    }
    
    /* Override location details cards */
    #locationResults > div[style*="padding"] > div[style*="display: grid"] div[style*="font-size"] {
        font-size: 0.6875rem !important;
    }
    
    #locationResults > div[style*="padding"] > div[style*="padding: 1rem"] div[style*="font-size: 2rem"],
    #locationResults > div[style*="padding"] > div[style*="padding: 1rem"] div[style*="font-size: 1.25rem"] {
        font-size: 1.125rem !important;
    }
    
    /* Force all buttons inside result cards to be small */
    #distanceResults button,
    #distanceResults a.search-btn,
    #locationResults button,
    #locationResults a.search-btn {
        font-size: 0.75rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    /* Ultra-specific overrides for distance results page */
    #distanceResults div[style*="padding: 1.5rem"] div {
        font-size: 0.75rem !important;
    }
    
    /* Override postal code text in FROM/TO cards */
    #fromLocationName,
    #toLocationName {
        font-size: 0.75rem !important;
    }
    
    /* Override all text inside grid layout cards */
    #distanceResults div[style*="display: grid"][style*="grid-template-columns: 1fr auto 1fr"] > div {
        padding: 0.75rem !important;
    }
    
    #distanceResults div[style*="display: grid"][style*="grid-template-columns: 1fr auto 1fr"] div[style*="font-size"] {
        font-size: 0.625rem !important;
    }
    
    /* Distance number itself - make more reasonable for mobile */
    #distanceResults div[style*="text-align: center"] div[style*="font-size: 3rem"] {
        font-size: 1.25rem !important;
    }
    
    /* Miles text */
    #distanceResults div[style*="text-align: center"] div[style*="font-size: 1.25rem"] {
        font-size: 0.75rem !important;
    }
    
    /* All divs inside result sections */
    #distanceResults > div > div > div > div {
        font-size: 0.75rem !important;
    }
    
    /* Ultra-specific overrides for location results page (my-location-pincode) */
    #locationResults div[style*="display: grid"] > div {
        padding: 0.625rem !important;
    }
    
    #locationResults div[style*="display: grid"] > div > div:first-child {
        font-size: 0.625rem !important;  /* Labels like "YOUR PINCODE", "CITY", etc */
    }
    
    #locationResults div[style*="display: grid"] > div > div:last-child {
        font-size: 0.75rem !important;   /* Values like "Mumbai", "India" */
    }
    
    /* All text content in location results */
    #locationResults div[style*="padding"] div[style*="font-size"],
    #locationResults div[style*="padding"] div {
        font-size: 0.75rem !important;
    }
    
    /* Specific targeting for section headers in location results */
    #locationResults div[style*="text-transform: uppercase"],
    #locationResults div[style*="CITY"],
    #locationResults div[style*="STATE"],
    #locationResults div[style*="COUNTRY"],
    #locationResults div[style*="COORDINATES"] {
        font-size: 0.625rem !important;
    }
    
    /* Direct ID targeting for location results elements */
    #locationResults h2 {
        font-size: 0.875rem !important;
    }
    
    /* Make pincode output MUCH larger and prominent */
    #locationResults #resultPincode,
    #locationResults div[id="resultPincode"] {
        font-size: 2rem !important;  /* 32px - very prominent */
        font-weight: 700 !important;
        line-height: 1.2 !important;
    }
    
    #resultCity,
    #resultState,
    #resultCountry {
        font-size: 0.75rem !important;
    }
    
    /* Keep City/State side-by-side and fix gap to match other cards */
    #locationResults > div > div > div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] {
        gap: 0.75rem !important;  /* Match overall spacing */
        margin: 0 !important;      /* Remove any margin */
        padding: 0 !important;     /* Remove container padding */
    }
    
    #locationResults > div > div > div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] > div {
        padding: 0.625rem !important;  /* Match other cards */
    }
    
    #resultCoords {
        font-size: 0.625rem !important;
    }
    
    /* All strong tags in location results (labels) */
    #locationResults strong {
        font-size: 0.625rem !important;
    }
    
    /* Target all divs with specific background styles */
    #locationResults div[style*="background: var(--bg-tertiary)"] {
        padding: 0.625rem !important;
    }
    
    #locationResults div[style*="background: var(--bg-tertiary)"] > div {
        font-size: 0.75rem !important;
    }
}

/* Extra Small Mobile - Further Optimization */
@media (max-width: 480px) {
    .header {
        padding: 0.625rem 0.75rem;
    }
    
    .logo {
        height: 50px;
    }
    
    .main-content {
        padding: 0.625rem;
        gap: 0.875rem;
    }
    
    .search-card {
        padding: 0.75rem;
    }
    
    .search-card h2 {
        font-size: 0.8125rem;
    }
    
    .input-group label {
        font-size: 0.6875rem;
    }
    
    .input-group input,
    .input-group select {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .usp-card {
        min-width: calc(85% - 0.5rem);
        max-width: calc(85% - 0.5rem);
        padding: 0.875rem;
    }
    
    .usp-icon {
        font-size: 1.75rem;
    }
    
    .usp-card h3 {
        font-size: 0.75rem;
    }
    
    .usp-card p {
        font-size: 0.6875rem;
    }
    
    .help-section h2,
    .faq-section h2 {
        font-size: 0.8125rem;
    }
    
    .help-card h3,
    .faq-item summary {
        font-size: 0.75rem;
    }
    
    .help-card p,
    .faq-item p {
        font-size: 0.6875rem;
    }
    
    .results-table {
        min-width: 500px;
        font-size: 0.6875rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem 0.5rem;
        font-size: 0.6875rem;
    }
    
    .map-card {
        height: 300px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Selection */
::selection {
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb-list a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.breadcrumb-list a:hover {
    background: var(--bg-tertiary);
    color: var(--accent-secondary);
}

.breadcrumb-separator {
    color: var(--text-tertiary);
    user-select: none;
    margin: 0 0.25rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

@media (max-width: 768px) {
    .breadcrumb-nav {
        padding: 0.625rem 0.75rem;
        margin-bottom: 1rem;
        border-radius: 0.375rem;
    }
    
    .breadcrumb-list {
        gap: 0.375rem;
    }
    
    .breadcrumb-list li {
        font-size: 0.8125rem;
    }
    
    .breadcrumb-list a,
    .breadcrumb-current {
        padding: 0.1875rem 0.375rem;
    }
    
    .breadcrumb-separator {
        margin: 0 0.125rem;
    }
}

/* Help Section */
.help-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 0;
}

.help-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.help-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .help-cards {
        display: flex !important;
        grid-template-columns: none !important;
    }
}

.help-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.help-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.help-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* FAQ Section */
.faq-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 0;
}

.faq-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--accent-primary);
}

.faq-item summary {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent-primary);
    font-weight: 300;
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    content: '−';
    transform: rotate(180deg);
}

.faq-item p {
    margin-top: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9375rem;
}

/* Pagination Controls */
.pagination-controls {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.pagination-info {
    text-align: center;
    margin-bottom: 1rem;
}

.pagination-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.load-more-btn, .show-all-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.load-more-btn {
    background: var(--accent-primary);
    color: white;
}

.load-more-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.show-all-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.show-all-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

.load-more-btn:active, .show-all-btn:active {
    transform: translateY(0);
}

/* Responsive pagination */
@media (max-width: 480px) {
    .pagination-controls {
        padding: 1rem;
    }
    
    .pagination-buttons {
        flex-direction: column;
    }
    
    .load-more-btn, .show-all-btn {
        width: 100%;
        padding: 1rem;
    }
}

/* Desktop Navigation */
.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--accent-primary);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    background: transparent;
    border: none;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
    border-radius: 2px;
}

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

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

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

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 73px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    display: block;
    max-height: 400px;
}

.mobile-menu a {
    display: block;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.mobile-menu a:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }
}

/* Enhanced Footer */
.footer-enhanced {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}

.footer-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start;
}

/* First column (logo + description) stays on left, other columns align right */
.footer-grid .footer-column:first-child {
    justify-self: start;
    max-width: 350px;
}

.footer-grid .footer-column:not(:first-child) {
    justify-self: end;
}

.footer-column h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.footer-column a:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Footer Logo - Theme Responsive */
.footer-logo-img {
    transition: filter 0.3s ease;
}

/* Light theme - keep logo as is */
[data-theme="light"] .footer-logo-img {
    filter: none;
}

/* Dark theme - invert logo colors to make it light */
[data-theme="dark"] .footer-logo-img {
    filter: brightness(0) saturate(100%) invert(98%) sepia(7%) saturate(552%) hue-rotate(186deg) brightness(116%) contrast(96%);
}

/* Footer Description Text */
.footer-description {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
    margin: 0;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Reset alignment on mobile - all columns left-aligned */
    .footer-grid .footer-column:first-child,
    .footer-grid .footer-column:not(:first-child) {
        justify-self: start;
        max-width: none;
    }
    
    .footer-enhanced {
        padding: 2rem 1rem 1rem;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* Legacy Footer (for backward compatibility) */
.footer {
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}
