/* 
 * Indiamapia Modern Design
 * Clean, Fast, Professional
 * System fonts for zero load time
 */

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Colors */
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-subtle: #f3f4f6;
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Borders */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 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);
    
    /* Container */
    --container-max: 1280px;
    --container-narrow: 1100px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Layout Container */
.im-container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.im-container-narrow {
    max-width: var(--container-narrow);
}

/* Header */
.im-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.im-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.im-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 2px;
}

.im-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.im-logo-india {
    color: var(--primary);
}

.im-logo-mapia {
    color: var(--success);
}

/* Search Box */
.im-search {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
}

.im-header-search {
    flex: 1;
    max-width: 280px;
    min-width: 180px;
}

.im-search-form {
    display: flex;
    gap: var(--space-sm);
}

/* Filter Grid (State > District > City dropdowns) */
.im-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .im-filter-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.im-filter-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.im-filter-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.im-filter-right {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.im-filter-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

/* PIN Code Page Layout with Sidebar */
.im-pincode-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

@media (min-width: 1024px) {
    .im-pincode-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .im-pincode-main {
        flex: 1;
        min-width: 0;
    }
    
    .im-pincode-sidebar {
        width: 350px;
        flex-shrink: 0;
        align-self: flex-start;
    }
}

@media (min-width: 1200px) {
    .im-pincode-sidebar {
        width: 380px;
    }
}

/* Sidebar card styling */
.im-sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.im-sidebar-card .im-section-header {
    font-size: 0.95rem;
    padding: var(--space-sm) var(--space-md);
}

.im-sidebar-card .im-card-body {
    padding: var(--space-sm) var(--space-md);
}

.im-sidebar-card .im-select {
    font-size: 0.9rem;
    padding: var(--space-xs) var(--space-sm);
}

.im-sidebar-card .im-search-input {
    font-size: 0.95rem;
}

.im-sidebar-card .im-btn {
    font-size: 0.85rem;
    padding: 8px var(--space-md);
}

.im-sidebar-card .im-filter-label {
    font-size: 0.8rem;
    margin-bottom: 4px;
}

/* Sidebar Ad */
.im-sidebar-ad {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.im-sidebar-ad-top {
    margin-bottom: var(--space-lg);
}

/* Mobile Only Ad - shown after first pincode card on mobile */
.im-ad-mobile-only {
    display: none;
    text-align: center;
    margin: var(--space-md) 0;
}

/* Full Width Ad - for place and district info pages */
.im-ad-fullwidth {
    margin: var(--space-lg) 0;
    text-align: center;
}

@media (max-width: 1023px) {
    .im-ad-mobile-only {
        display: block;
    }
    .im-sidebar-ad-top {
        display: none;
    }
}

/* Post Office Result Display */
.im-po-result {
    margin-top: 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid var(--success);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

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

.im-po-result-header {
    background: var(--success);
    color: white;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.im-po-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.im-po-result-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.im-po-result-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.im-po-result-pin {
    background: white;
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #d1fae5;
}

.im-po-result-pin-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.im-po-result-pin-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 2px;
}

.im-po-result-details {
    padding: 8px 12px;
    background: white;
}

.im-po-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f3f4f6;
}

.im-po-result-row:last-child {
    border-bottom: none;
}

.im-po-result-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.im-po-result-label svg {
    width: 14px;
    height: 14px;
}

.im-po-result-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.im-po-result-actions {
    padding: 8px;
    background: #f0fdf4;
    border-top: 1px solid #d1fae5;
}

.im-po-result-actions .im-btn {
    margin-bottom: 0;
    font-size: 0.8rem;
    padding: 8px 12px;
}

.im-po-other-link {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: var(--success);
    text-decoration: none;
}

.im-po-other-link:hover {
    text-decoration: underline;
}

.im-po-result .im-btn {
    width: 100%;
}

.im-mt-sm {
    margin-top: var(--space-sm);
}

/* Select dropdown */
.im-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.im-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.im-select:disabled {
    background-color: var(--bg-subtle);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Better Styled Select Wrapper */
.im-select-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.im-select-styled {
    width: 100%;
    padding: 9px 36px 9px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    cursor: pointer;
    appearance: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.im-select-styled:hover:not(:disabled) {
    border-color: var(--primary);
    background-color: #fafbff;
}

.im-select-styled:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.im-select-styled:disabled {
    background-color: var(--bg-subtle);
    border-color: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Styled Search Input */
.im-search-input-styled {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.im-search-input-styled:hover {
    border-color: var(--primary);
    background-color: #fafbff;
}

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

.im-search-input-styled::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Filter Divider */
.im-filter-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-medium), transparent);
    margin: 14px 0;
}

/* Or Browse text */
.im-filter-or {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Extra spacing between dropdowns to prevent accidental taps */
.im-select-spaced {
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .im-select-spaced {
        margin-bottom: 20px;
    }
    .im-select-styled {
        padding: 12px 36px 12px 12px;
        font-size: 1rem;
    }
}

/* Vertical search form */
.im-search-form-vertical {
    flex-direction: column;
}

/* Large search input */
.im-search-input-lg {
    font-size: 1.1rem;
    padding: var(--space-md);
}

.im-btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
}

.im-btn-full {
    width: 100%;
}

/* Subtle Ad placement */
.im-ad-subtle {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    text-align: center;
}

.im-search-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.im-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.im-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-lg);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.im-btn-primary {
    background: var(--primary);
    color: white;
}

.im-btn-primary:hover {
    background: var(--primary-dark);
}

/* Breadcrumb */
.im-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

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

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

.im-breadcrumb-separator {
    color: var(--border-medium);
}

.im-breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Main Content */
.im-main {
    padding: var(--space-lg) 0 var(--space-2xl);
}

/* Page Title */
.im-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.3;
}

@media (min-width: 640px) {
    .im-page-title {
        font-size: 2rem;
    }
}

.im-page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

/* Cards */
.im-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.im-card-header {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.im-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.im-card-header-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.im-card-header-link .im-card-title {
    transition: color 0.2s ease;
}

.im-card-header-link:hover .im-card-title {
    color: var(--primary);
}

.im-card-header-hint {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.im-card-header-link:hover .im-card-header-hint {
    opacity: 1;
}

.im-card-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.im-card-body {
    padding: var(--space-lg);
}

/* Section Headers */
.im-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
}

.im-section-header-success {
    background: var(--success);
}

.im-section-header-warning {
    background: var(--warning);
}

/* Tables */
.im-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.im-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.im-table th,
.im-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.im-table th {
    background: var(--bg-subtle);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.im-table tr:hover td {
    background: var(--bg-light);
}

.im-table-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 140px;
}

.im-table-value {
    color: var(--text-primary);
}

/* Info Table (key-value pairs) */
.im-info-table {
    width: 100%;
}

.im-info-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

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

.im-info-table .im-label {
    width: 40%;
    color: var(--text-secondary);
    font-weight: 500;
    background: var(--bg-light);
}

.im-info-table .im-value {
    width: 60%;
    color: var(--text-primary);
}

.im-info-table .im-value a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1.5px dashed rgba(59, 130, 246, 0.3);
    padding-bottom: 1px;
    transition: all 0.2s ease;
}

.im-info-table .im-value a::after {
    content: '→';
    font-size: 0.75em;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
}

.im-info-table .im-value a:hover {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
    border-bottom-style: solid;
}

.im-info-table .im-value a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Highlight/Mark */
.im-highlight {
    background: var(--warning-light);
    padding: 0.125em 0.375em;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.im-pincode {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.125em 0.5em;
    border-radius: var(--radius-sm);
}

/* Grid Layouts */
.im-grid {
    display: grid;
    gap: var(--space-lg);
}

.im-grid-2 {
    grid-template-columns: 1fr;
}

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

.im-grid-3 {
    grid-template-columns: 1fr;
}

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

@media (min-width: 1024px) {
    .im-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Links List */
.im-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-md);
}

.im-links-list a {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.im-links-list a:hover {
    background: var(--primary-light);
    text-decoration: none;
}

/* Post Office Card */
.im-post-office {
    margin-bottom: var(--space-lg);
}

.im-post-office-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.im-post-office-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.im-post-office-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Census Stats */
.im-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

@media (min-width: 640px) {
    .im-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .im-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.im-stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}

.im-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.im-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Places Grid */
.im-places-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
}

@media (min-width: 640px) {
    .im-places-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .im-places-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.im-places-grid a {
    padding: var(--space-sm);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    text-align: center;
    transition: background 0.15s ease;
}

.im-places-grid a:hover {
    background: var(--primary-light);
    text-decoration: none;
}

/* Footer */
.im-footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

.im-footer-content {
    text-align: center;
}

.im-footer-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto var(--space-md);
    line-height: 1.6;
}

.im-footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    font-size: 0.875rem;
}

/* Ad Container */
.im-ad {
    background: var(--bg-subtle);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-lg) 0;
    text-align: center;
    min-height: 100px;
}

/* Utility Classes */
.im-text-center {
    text-align: center;
}

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

.im-text-small {
    font-size: 0.875rem;
}

.im-mt-md {
    margin-top: var(--space-md);
}

.im-mt-lg {
    margin-top: var(--space-lg);
}

.im-mb-md {
    margin-bottom: var(--space-md);
}

.im-mb-lg {
    margin-bottom: var(--space-lg);
}

/* Responsive adjustments */
@media (max-width: 639px) {
    .im-header-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .im-logo {
        justify-content: center;
    }
    
    .im-search {
        max-width: none;
    }
    
    .im-info-table .im-label,
    .im-info-table .im-value {
        display: block;
        width: 100%;
    }
    
    .im-info-table .im-label {
        padding-bottom: 0;
        border-bottom: none;
    }
    
    .im-info-table .im-value {
        padding-top: var(--space-xs);
    }
    
    .im-card-body {
        padding: var(--space-md);
    }
    
    .im-stat-value {
        font-size: 1.25rem;
    }
}

/* Print styles */
@media print {
    .im-header,
    .im-ad,
    .im-search {
        display: none;
    }
    
    .im-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading state for dynamic content */
.im-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================
   DISTRICT PAGE - 3 Column Layout
   ========================================== */

.im-district-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 1024px) {
    .im-district-grid {
        grid-template-columns: 300px 1fr 280px;
    }
}

.im-district-census {
    order: 2;
}

.im-district-content {
    order: 1;
}

.im-district-pincodes {
    order: 3;
}

@media (min-width: 1024px) {
    .im-district-census { order: 1; }
    .im-district-content { order: 2; }
    .im-district-pincodes { order: 3; }
}

/* Content sections */
.im-content-section {
    margin-bottom: var(--space-xl);
}

.im-content-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--primary-light);
}

.im-content-section p {
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

/* PIN Code List in sidebar */
.im-pincode-list {
    max-height: 600px;
    overflow-y: auto;
}

.im-pincode-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

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

.im-pincode-item a {
    flex: 1;
    font-size: 0.9rem;
}

.im-pincode-small {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ==========================================
   PLACE PAGE - 3 Column Layout
   ========================================== */

.im-place-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .im-place-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1200px) {
    .im-place-grid {
        grid-template-columns: 320px 1fr 250px;
    }
}

.im-place-info {
    order: 1;
}

.im-place-map {
    order: 2;
}

.im-place-sidebar {
    order: 3;
}

@media (max-width: 767px) {
    .im-place-info { order: 1; }
    .im-place-map { order: 2; }
    .im-place-sidebar { order: 3; }
}

/* Large PIN code display */
.im-pincode-label {
    background: #fef3c7 !important;
}

.im-pincode-value {
    background: #fef3c7 !important;
}

.im-pincode-large {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--success);
    text-decoration: none;
}

.im-pincode-large:hover {
    color: var(--primary);
}

/* Map container */
.im-map-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: var(--space-lg) 0;
}

.im-map-container iframe {
    display: block;
}

/* Simple list */
.im-simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.im-simple-list li {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.im-simple-list li:last-child {
    border-bottom: none;
}

/* Comment styles */
.im-comment {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.im-comment:last-child {
    border-bottom: none;
}

.im-comment p {
    margin: var(--space-sm) 0;
}

/* Button styles */
.im-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-lg);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.im-btn-primary {
    background: var(--primary);
    color: white;
}

.im-btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
    color: white;
}

/* Code/monospace styling */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ==========================================
   SVG Icons
   ========================================== */

.im-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.im-icon-sm {
    width: 16px;
    height: 16px;
}

.im-icon-lg {
    width: 24px;
    height: 24px;
}

.im-icon-xl {
    width: 32px;
    height: 32px;
}

/* Icon colors */
.im-icon-primary { color: var(--primary); }
.im-icon-success { color: var(--success); }
.im-icon-warning { color: var(--warning); }
.im-icon-muted { color: var(--text-muted); }
.im-icon-white { color: white; }

/* Icon in section header */
.im-section-header .im-icon {
    margin-right: var(--space-sm);
}

/* Icon with text inline */
.im-icon-text {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Stats card with icon */
.im-stat-card-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.im-stat-card-icon .im-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
    opacity: 0.8;
}

/* Info table with icons */
.im-info-table .im-icon {
    margin-right: var(--space-xs);
    vertical-align: -3px;
}
