/* ==========================================================================
   ABIANA PRO v3.8 / v4.5 - Pure Static CSS (with Dark/Light Mode & Print Support)
   ========================================================================== */

:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --primary-dark: #084298;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-light: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #212529;
    --border-color: #dee2e6;
    --table-hover: #f8fbff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] {
    --bg-light: #121212;
    --card-bg: #1e1e1e;
    --text-main: #f8f9fa;
    --border-color: #333333;
    --table-hover: #262626;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body {
    background-color: var(--bg-light);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar */
.navbar-custom {
    background: linear-gradient(135deg, #0d6efd 0%, #084298 100%) !important;
    color: white;
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.navbar-brand-custom {
    font-weight: 800;
    letter-spacing: 0.5px;
    font-size: 1.15rem;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.92rem;
}

.navbar-custom .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12);
}

.navbar-custom .nav-link.active {
    color: #ffd700 !important;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.navbar-custom .navbar-toggler {
    background: rgba(255, 255, 255, 0.15);
}

.brand-badge {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #ffd700;
    font-weight: 700;
}

/* Cards */
.card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--card-bg);
    color: var(--text-main);
}

.stat-card {
    border-left: 5px solid var(--primary-color) !important;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-dupe {
    color: var(--danger-color);
}

.stat-amount {
    color: var(--primary-color);
}

/* Drop Zone for PDF */
.drop-zone {
    border: 2px dashed var(--primary-color);
    padding: 25px 15px;
    text-align: center;
    background: #f8fbff;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .drop-zone {
    background: #252525;
    border-color: #3b82f6;
}

.drop-zone:hover, .drop-zone.dragover {
    background: #eef4ff;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

[data-bs-theme="dark"] .drop-zone:hover {
    background: #2d3748;
}

.drop-zone p {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

/* Table Styling */
.table-wrapper {
    max-height: 70vh;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    color: var(--text-main);
}

thead th {
    position: sticky;
    top: 0;
    background-color: #0d6efd !important;
    color: #ffffff !important;
    z-index: 100;
    padding: 12px 14px !important;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    border: none !important;
}

tbody td {
    padding: 10px 14px !important;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
}

tr:hover {
    background-color: var(--table-hover) !important;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background-color: #0b5ed7 !important;
}

th.sortable::after {
    content: ' ⇅';
    font-size: 0.8em;
    opacity: 0.7;
}

/* Status Badges */
.badge-paid {
    background: #e6ffed;
    color: #1e7e34;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid #b7ebc6;
    font-size: 0.75rem;
    display: inline-block;
}

[data-bs-theme="dark"] .badge-paid {
    background: #0f381e;
    color: #48bb78;
    border-color: #1e7e34;
}

.badge-unpaid {
    background: #ffeef0;
    color: #d93025;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid #ffa39e;
    font-size: 0.75rem;
    display: inline-block;
}

[data-bs-theme="dark"] .badge-unpaid {
    background: #3c1618;
    color: #f56565;
    border-color: #9b2c2c;
}

.mismatch-box {
    background: #fff8e6;
    border: 1px solid #ffe8a1;
    color: #856404;
}

[data-bs-theme="dark"] .mismatch-box {
    background: #332701;
    border-color: #665005;
    color: #f6e05e;
}

/* Editable cells */
td[contenteditable="true"]:focus {
    background-color: #fff9db !important;
    outline: 2px solid #fd7e14;
    border-radius: 4px;
    color: #000;
}

/* Column Visibility Helper */
.hidden-col {
    display: none !important;
}

/* Authentication Screen UI */
.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow: 0 10px 30px rgba(13, 110, 253, 0.15);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.auth-header {
    background: linear-gradient(135deg, #0d6efd 0%, #084298 100%);
    color: white;
    padding: 28px 24px;
    text-align: center;
}

.auth-header h3 {
    font-weight: 800;
    margin: 0;
    font-size: 1.5rem;
}

.auth-nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
}

[data-bs-theme="dark"] .auth-nav-tabs {
    background: #252525;
}

.auth-nav-tab {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #6c757d;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.2s;
}

.auth-nav-tab.active {
    color: #0d6efd;
    background: var(--card-bg);
    border-bottom: 3px solid #0d6efd;
}

.auth-body {
    padding: 24px;
}

.cloud-status-badge {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    display: inline-block;
    box-shadow: 0 0 6px #28a745;
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.35);
    color: white;
}

/* ==========================================================================
   Adsterra Banner Placeholders (Clean & Non-Intrusive)
   ========================================================================== */
.adsterra-banner-container {
    width: 100%;
    margin: 12px 0;
    clear: both;
}

.adsterra-placeholder {
    background: #fbfcfe;
    border: 2px dashed #b0c9e8;
    border-radius: 10px;
    padding: 12px;
    color: #6c757d;
    text-align: center;
    transition: all 0.3s;
}

[data-bs-theme="dark"] .adsterra-placeholder {
    background: #1a202c;
    border-color: #2d3748;
    color: #a0aec0;
}

.adsterra-placeholder:hover {
    background: #f0f6ff;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .adsterra-placeholder:hover {
    background: #232d3f;
    border-color: #3b82f6;
}

.adsterra-top-banner {
    min-height: 90px;
    max-width: 728px;
    margin: 0 auto;
}

.adsterra-sidebar-banner {
    min-height: 250px;
    max-width: 300px;
    margin: 0 auto;
}

/* Smooth Fade-in Transition */
.fade-in {
    animation: fadeInApp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ==========================================================================
   Instant Zero-Flicker Session Protection (Pure CSS Fast State Control)
   ========================================================================== */
html.auth-logged-in #authSection,
html.auth-logged-in #mAuthSection {
    display: none !important;
}

html.auth-logged-in #mainNavbar {
    display: flex !important;
}

html.auth-logged-in #mainAppSection,
html.auth-logged-in #mAppSection,
html.auth-logged-in #topBannerAd,
html.auth-logged-in #mTopBannerAd {
    display: block !important;
}

html.auth-logged-out #mainNavbar,
html.auth-logged-out #mainAppSection,
html.auth-logged-out #mAppSection,
html.auth-logged-out #topBannerAd,
html.auth-logged-out #mTopBannerAd {
    display: none !important;
}

html.auth-logged-out #authSection,
html.auth-logged-out #mAuthSection {
    display: flex !important;
}

/* Wasil Baki & Multi-Role Styles */
.role-badge {
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
}
.role-badge-patwari {
    background: #198754;
    color: white;
}
.role-badge-wasilbaki {
    background: #ffc107;
    color: #212529;
}

.mouza-chip-wrapper {
    user-select: none;
}
.cursor-pointer {
    cursor: pointer;
}
.hover-bg-light:hover {
    background-color: #f8fbff;
    border-color: #0d6efd !important;
}

/* Official 1-Page Report Styles */
.official-report-card {
    background: #ffffff;
    border: 2px solid #0d6efd;
    border-radius: 12px;
}
.gov-report-header {
    background: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    color: white;
    padding: 18px 24px;
    border-radius: 10px 10px 0 0;
    text-align: center;
}
.report-meta-box {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 20px;
    font-size: 0.9rem;
}
.report-signature-block {
    margin-top: 35px;
    padding-top: 15px;
}
.sig-line {
    border-top: 1px dashed #6c757d;
    width: 80%;
    margin: 30px auto 5px auto;
}

/* Print Overrides */
@media print {
    @page {
        size: A4 portrait;
        margin: 0.6cm;
    }
    body {
        font-size: 9pt !important;
        background: white !important;
        color: black !important;
    }
    .no-print, 
    .navbar,
    .navbar-custom, 
    .btn, 
    .drop-zone, 
    .adsterra-banner-container, 
    .adsterra-sidebar-ad,
    .modal,
    #columnToggles,
    .input-group,
    .nav-pills,
    .auth-wrapper,
    #wasilBakiNotice,
    #mismatchCard,
    th:last-child, 
    td:last-child {
        display: none !important;
    }
    .col-md-9, .col-md-3, .col-12 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .table-wrapper {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    th, td {
        padding: 4px 6px !important;
        font-size: 8.5pt !important;
        border: 1px solid #444 !important;
        color: black !important;
    }
    thead th {
        background: #eee !important;
        color: black !important;
    }
    .official-report-card {
        border: none !important;
        box-shadow: none !important;
    }
    .gov-report-header {
        background: #f0f0f0 !important;
        color: black !important;
        border: 1px solid #333 !important;
    }
    .gov-report-header h3, .gov-report-header h4 {
        color: black !important;
    }
    .report-signature-block {
        display: flex !important;
        justify-content: space-between !important;
        page-break-inside: avoid;
    }
    #reportHeader {
        display: block !important;
        text-align: center;
        margin-bottom: 12px;
    }
}

.mouza-chip-item {
    transition: all 0.2s ease;
}
.mouza-chip-item label {
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mouza-chip-item label:hover {
    background-color: #f1f5f9;
}

