/* ===== CSS Variables ===== */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --bg: #F9FAFB;
    --surface: #FFFFFF;
    --text: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --secondary: #34D399;
    --bg: #111827;
    --surface: #1F2937;
    --text: #F9FAFB;
    --text-secondary: #D1D5DB;
    --border: #374151;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}

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

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

.theme-toggle {
    background: var(--bg);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 1.2rem;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 2rem;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.feature-item i {
    font-size: 1.5rem;
}

/* ===== Loading Screen ===== */
.loading-screen {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

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

.loading-screen h2 {
    color: var(--text);
    margin-bottom: 1rem;
}

.loading-screen p {
    color: var(--text-secondary);
}

/* ===== Main Section ===== */
.main-section {
    padding: 3rem 0;
    min-height: 60vh;
}

.main-content {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== View Toggle ===== */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
    font-size: 1rem;
}

.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===== Browse & Search Views ===== */
.browse-view, .search-view {
    display: none;
}

.browse-view.active, .search-view.active {
    display: block;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-secondary);
}

/* ===== Search Box ===== */
.search-box-mini {
    margin-bottom: 1.5rem;
}

.search-box-mini input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
}

.search-box-mini input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== States Grid ===== */
.states-view h2, .districts-view h2, .post-offices-view h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.state-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

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

.state-card h3 {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.state-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Districts Grid ===== */
.districts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.district-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

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

.district-card h3 {
    color: var(--text);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.district-card p {
    color: var(--text-secondary);
}

.district-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.district-stat strong {
    color: var(--primary);
    font-size: 1.5rem;
    display: block;
}

.district-stat span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== Post Offices Grid ===== */
.post-office-controls {
    margin-bottom: 1.5rem;
}

.post-office-controls input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.post-office-controls input:focus {
    outline: none;
    border-color: var(--primary);
}

.results-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.post-offices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.post-office-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.post-office-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.pincode {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.post-office-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.post-office-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.info-item i {
    color: var(--primary);
    width: 20px;
}

/* ===== Search View ===== */
.search-container {
    max-width: 800px;
    margin: 0 auto 2rem;
}

.search-box-main {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50px;
    padding: 15px 25px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.search-box-main i {
    color: var(--text-secondary);
    font-size: 1.3rem;
    margin-right: 15px;
}

.search-box-main input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    display: none;
}

.clear-btn.active {
    display: block;
}

.search-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-info {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ===== Footer ===== */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.footer p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.social-links a:hover {
    background: var(--primary);
    color: white;
}

.footer h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.footer ul li a:hover {
    color: var(--primary);
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .states-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .districts-grid, .post-offices-grid, .search-results {
        grid-template-columns: 1fr;
    }
    
    .view-toggle {
        flex-direction: column;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        flex-direction: column;
        background: var(--surface);
        padding: 2rem;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s;
    }
    
    .nav-menu.active {
        left: 0;
    }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}
