/* CSS Reset and Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Light Mode HSL Variables */
    --bg-primary: 0 0% 100%;        /* #ffffff - Clean White */
    --bg-secondary: 33 100% 97%;    /* #FFF8F0 - Light Cream */
    --bg-tertiary: 33 100% 94%;     /* Deeper cream for hover states */
    
    --text-primary: 240 29% 15%;    /* #1A1A2E - Dark Navy */
    --text-secondary: 217 17% 35%;  /* #4A5568 - Muted Slate */
    --text-muted: 215 15% 52%;      /* #718096 - Grey Placeholder */
    
    --primary: 16 100% 60%;         /* #FF6B35 - Saffron/Deep Orange */
    --primary-hover: 16 100% 52%;
    --primary-light: 16 100% 95%;
    
    --secondary: 194 100% 20%;      /* #004E64 - Indian Teal */
    --secondary-light: 194 100% 95%;

    --accent: 48 89% 60%;           /* #F4D03F - Golden Yellow */
    
    --border: 33 30% 90%;           /* Soft cream border */
    --ring: 16 100% 60%;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius: 0.75rem;
    --radius-lg: 1.25rem;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode HSL Variables */
        --bg-primary: 222.2 84% 4.9%;   /* #020617 - Slate 950 */
        --bg-secondary: 222.2 47.4% 11.2%; /* #0f172a - Slate 900 */
        --bg-tertiary: 217.2 32.6% 17.5%; /* #1e293b - Slate 800 */
        
        --text-primary: 210 40% 98%;     /* #f8fafc */
        --text-secondary: 215 20.2% 65.1%; /* #94a3b8 */
        --text-muted: 217.2 16.3% 46.9%;   /* #64748b */
        
        --primary: 16 100% 60%;         /* #FF6B35 - Saffron/Deep Orange */
        --primary-hover: 16 100% 70%;
        --primary-light: 16 100% 15%;
        
        --secondary: 194 100% 20%;      /* #004E64 - Indian Teal */
        --secondary-light: 194 100% 15%;
        
        --border: 217.2 32.6% 17.5%;     /* Slate 800 */
        --ring: 16 100% 60%;
        
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
        --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    }
}

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

body {
    font-family: var(--font-body);
    background-color: hsl(var(--bg-primary));
    color: hsl(var(--text-primary));
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header & Navigation */
.site-header {
    background-color: hsl(var(--bg-secondary) / 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--border));
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: hsl(var(--primary));
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    -webkit-text-fill-color: white;
}

/* Hamburger button default (desktop hidden) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 1.5rem;
    height: 1.15rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.hamburger-btn span {
    width: 100%;
    height: 2px;
    background-color: hsl(var(--text-primary));
    border-radius: 2px;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: hsl(var(--text-secondary));
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
    color: hsl(var(--primary));
    background-color: hsl(var(--bg-tertiary));
}

/* Hero Section */
.hero {
    padding: 4.5rem 2rem 3.5rem;
    text-align: center;
    position: relative;
    overflow: visible;
    background: linear-gradient(135deg, #FF6B35 0%, #F4D03F 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(circle, hsl(var(--primary) / 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.hero-subtitle {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 1.5rem auto 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Search Box & Suggestions */
.search-wrapper {
    position: relative;
    max-width: 650px;
    margin: 0 auto;
    z-index: 10;
}

.search-bar-container {
    display: flex;
    align-items: center;
    background-color: hsl(var(--bg-secondary));
    border: 2px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.25rem 0.25rem 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.search-bar-container:focus-within {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15);
}

.search-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: hsl(var(--text-secondary));
    margin-right: 0.75rem;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.15rem;
    color: hsl(var(--text-primary));
    font-family: var(--font-body);
    padding: 0.75rem 0;
    outline: none;
}

.search-input::placeholder {
    color: hsl(var(--text-muted));
}

.search-button {
    background-color: hsl(var(--primary));
    color: white;
    border: none;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.85rem 1.75rem;
    border-radius: calc(var(--radius-lg) - 0.25rem);
    cursor: pointer;
    transition: var(--transition);
}

.search-button:hover {
    background-color: hsl(var(--primary-hover));
}

/* Auto Suggestions list */
.suggestions-list {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 350px;
    overflow-y: auto;
    list-style: none;
    display: none;
    text-align: left;
}

.suggestion-item {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.selected {
    background-color: hsl(var(--bg-tertiary));
}

.suggestion-name {
    font-weight: 600;
    color: hsl(var(--text-primary));
}

.suggestion-details {
    font-size: 0.85rem;
    color: hsl(var(--text-secondary));
}

.suggestion-pincode {
    font-family: var(--font-heading);
    font-weight: 700;
    color: hsl(var(--primary));
    background-color: hsl(var(--primary-light));
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Directory Section */
.directory-section {
    padding: 3rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 1rem;
}

.section-title {
    font-size: 1.75rem;
    color: hsl(var(--text-primary));
}

.section-subtitle {
    color: hsl(var(--text-secondary));
    font-size: 0.95rem;
}

/* Grid Layouts */
.grid-states {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.state-card {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.state-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: hsl(var(--primary) / 0.5);
}

.state-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.state-count {
    font-size: 0.8rem;
    font-weight: 700;
    background-color: hsl(var(--bg-tertiary));
    color: hsl(var(--text-secondary));
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
}

/* Breadcrumb Navigation */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: hsl(var(--text-secondary));
    margin: 1.5rem 0 2rem;
    list-style: none;
}

.breadcrumb-item::after {
    content: "/";
    margin-left: 0.5rem;
    color: hsl(var(--text-muted));
}

.breadcrumb-item:last-child::after {
    content: "";
}

.breadcrumb-item a:hover {
    color: hsl(var(--primary));
}

.breadcrumb-item.active {
    color: hsl(var(--text-primary));
    font-weight: 500;
}

/* Details Page Card Grid */
.detail-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-title-group h1 {
    font-size: 2.25rem;
    margin-bottom: 0.25rem;
}

.info-title-group p {
    color: hsl(var(--text-secondary));
}

.pincode-badge {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: hsl(var(--primary));
    background-color: hsl(var(--primary-light));
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--text-muted));
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 550;
    color: hsl(var(--text-primary));
}

/* Leaflet Map Card */
.map-card {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 400px;
}

.map-card h3 {
    margin-bottom: 1rem;
}

.map-container {
    flex: 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--bg-tertiary));
}

/* Post Offices Table & List */
.po-table-card {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
    overflow-x: auto;
}

.po-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.po-table th {
    background-color: hsl(var(--bg-tertiary));
    color: hsl(var(--text-secondary));
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
}

.po-table td {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.95rem;
}

.po-table tr:last-child td {
    border-bottom: none;
}

.po-table tr:hover td {
    background-color: hsl(var(--bg-tertiary) / 0.5);
}

.badge-delivery {
    background-color: hsl(var(--secondary-light));
    color: hsl(var(--secondary));
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-non-delivery {
    background-color: hsl(var(--bg-tertiary));
    color: hsl(var(--text-secondary));
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

/* Quick Select Dropdowns Tool */
.locator-tool {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 4rem;
}

.locator-tool-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.locator-selects {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .locator-selects {
        grid-template-columns: 1fr;
    }
}

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

.select-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--text-secondary));
}

.select-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--bg-tertiary));
    color: hsl(var(--text-primary));
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
}

.select-control:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* API Docs Styling */
.api-card {
    background-color: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.api-method {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: hsl(var(--primary-light));
    color: hsl(var(--primary));
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

.api-route {
    font-family: monospace;
    font-size: 1.05rem;
    background-color: hsl(var(--bg-tertiary));
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    border-left: 4px solid hsl(var(--primary));
    word-break: break-all;
}

.api-response-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--text-secondary));
}

.api-code {
    display: block;
    background-color: #1e293b;
    color: #f8fafc;
    padding: 1.25rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
}

/* Footer */
.site-footer {
    background-color: hsl(var(--bg-secondary));
    border-top: 1px solid hsl(var(--border));
    padding: 3rem 0;
    margin-top: 5rem;
    text-align: center;
    color: hsl(var(--text-secondary));
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

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

.copyright {
    color: hsl(var(--text-muted));
}

/* Promo Box Styling */
.promo-box {
    margin: 1.5rem 0;
    text-align: center;
    width: 100%;
}

.promo-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: hsl(var(--text-muted));
    margin-bottom: 0.35rem;
    letter-spacing: 0.05em;
    text-align: center;
}

.promo-banner-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    font-size: 0.95rem;
    line-height: 1.4;
    transition: var(--transition);
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    box-shadow: var(--shadow-sm);
}

.promo-banner-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.promo-wide .promo-banner-card {
    min-height: 80px;
}

@media (max-width: 768px) {
    .promo-banner-card {
        font-size: 0.85rem;
        padding: 1rem;
    }
    
    /* Show Hamburger button on mobile */
    .hamburger-btn {
        display: flex;
    }

    /* Animate Hamburger button to X on active state */
    .hamburger-btn.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger-btn.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
    
    /* Responsive Header Container */
    .header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 4.5rem;
        position: relative;
    }

    /* Responsive Navigation Menu Overlay Dropdown */
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: hsl(var(--bg-secondary) / 0.98);
        border-top: 1px solid hsl(var(--border));
        padding: 1rem 1.5rem;
        gap: 0.5rem;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: var(--shadow-lg);
        z-index: 99;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-link {
        display: block;
        width: 100%;
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
        border-radius: var(--radius);
    }

    /* Responsive Footer Links */
    .footer-links {
        gap: 1rem 1.5rem;
        padding: 0 1rem;
    }
}

/* OR Divider Styling */
.search-or-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem auto;
    max-width: 650px;
    color: hsl(var(--text-muted));
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.15em;
    font-family: var(--font-heading);
}

.search-or-divider::before,
.search-or-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed hsl(var(--border));
}

.search-or-divider::before {
    margin-right: 2rem;
}

.search-or-divider::after {
    margin-left: 2rem;
}
