/* ==========================================================================
   Nagar Palika Parishad Jaunpur - Enterprise Portal CSS
   Design System: Modern Government Cloud / Strict Viewport Architecture
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --gov-navy: #0f172a;       /* Slate 900 */
    --gov-navy-light: #1e293b; /* Slate 800 */
    --gov-blue: #1d4ed8;       /* Primary Blue */
    --gov-blue-hover: #1e40af;
    --gov-blue-subtle: #eff6ff;
    --gov-saffron: #f59e0b;    /* National Saffron / Gold */
    --gov-green: #10b981;      /* Emerald */
    --gov-green-dark: #047857;
    --gov-red: #ef4444;        /* Crimson */
    --gov-border: #e2e8f0;     /* Slate 200 */
    --gov-bg: #f8fafc;         /* Slate 50 */
    --gov-card-bg: #ffffff;
    --gov-text: #0f172a;
    --gov-muted: #64748b;
    --gov-sidebar-width: 260px;
    --header-height: 70px;
    --footer-height: 38px;
}

/* --------------------------------------------------------------------------
   1. Strict Viewport Layout (Header & Footer fixed, Sidebar & Content scroll)
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden !important; /* Window never scrolls! */
    font-family: 'Plus Jakarta Sans', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--gov-bg);
    color: var(--gov-text);
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Top Tricolor Accent Bar */
.gov-tricolor-bar {
    height: 3.5px;
    background: linear-gradient(90deg, #ff9933 33.3%, #ffffff 33.3%, #ffffff 66.6%, #138808 66.6%);
    width: 100%;
    flex-shrink: 0;
}

/* Fixed Header */
.gov-top-header {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--gov-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

.brand-emblem-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-emblem {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.brand-text-block h1 {
    font-size: 1.12rem;
    font-weight: 800;
    margin: 0;
    color: var(--gov-navy);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.brand-text-block p {
    font-size: 0.75rem;
    margin: 2px 0 0 0;
    color: var(--gov-muted);
    font-weight: 500;
}

/* Language Switcher & Profile Controls */
.lang-pill-switch {
    background: #f1f5f9;
    padding: 3px;
    border-radius: 20px;
    display: inline-flex;
    border: 1px solid var(--gov-border);
}

.lang-pill-switch a {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.lang-pill-switch a.active {
    background: var(--gov-blue);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(29, 78, 216, 0.2);
}

.user-profile-btn {
    background: #ffffff;
    border: 1px solid var(--gov-border);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #0f172a);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   2. Main Middle Workspace (Sidebar + Content)
   -------------------------------------------------------------------------- */
.app-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0; /* Critical for inner scrolling */
    position: relative;
}

/* Fixed Independent Sidebar */
.app-sidebar {
    width: var(--gov-sidebar-width);
    height: 100%;
    background: #0f172a; /* Sleek Deep Slate */
    color: #cbd5e1;
    border-right: 1px solid #1e293b;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 0;
    z-index: 90;
}

/* Custom Scrollbar for Sidebar */
.app-sidebar::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 12px 20px 6px;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0 10px;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 3px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar-nav-link i {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.sidebar-nav-link:hover i {
    transform: scale(1.15);
}

.sidebar-nav-link.active {
    background: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.4);
}

.sidebar-nav-link.active i {
    color: #ffffff;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
}

/* Independent Scrollable Main Content Area */
.app-main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Ensures proper scrollbar behavior */
    padding: 24px 30px;
    background-color: #f8fafc;
}

/* Custom Scrollbar for Main Content */
.app-main-content::-webkit-scrollbar {
    width: 8px;
}
.app-main-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.app-main-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.app-main-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Fixed Bottom Status Footer */
.gov-bottom-footer {
    height: var(--footer-height);
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 100;
    font-size: 0.75rem;
    color: #94a3b8;
}

.gov-bottom-footer a {
    color: #cbd5e1;
    text-decoration: none;
}
.gov-bottom-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   3. Modern Card & Widget Architecture
   -------------------------------------------------------------------------- */
.gov-card {
    background: var(--gov-card-bg);
    border: 1px solid var(--gov-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    overflow: hidden;
}

.gov-card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--gov-border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gov-navy);
}

.gov-card-body {
    padding: 20px;
}

/* Metric Cards */
.metric-card {
    background: #ffffff;
    border: 1px solid var(--gov-border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.metric-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.metric-icon-box.blue { background: #eff6ff; color: #1d4ed8; }
.metric-icon-box.green { background: #ecfdf5; color: #059669; }
.metric-icon-box.amber { background: #fffbeb; color: #d97706; }
.metric-icon-box.purple { background: #faf5ff; color: #7c3aed; }

.metric-data-title {
    font-size: 0.8rem;
    color: var(--gov-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.metric-data-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--gov-navy);
    letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   4. High-Performance Enterprise Data Tables & Drag-to-Scroll
   -------------------------------------------------------------------------- */
.gov-table-wrapper {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--gov-border);
    background: #ffffff;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.gov-table-wrapper.is-dragging {
    cursor: grabbing !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    scroll-behavior: auto !important;
}

.gov-table-wrapper.is-dragging * {
    cursor: grabbing !important;
    pointer-events: none !important;
}

/* Highly visible responsive horizontal scrollbar */
.gov-table-wrapper::-webkit-scrollbar {
    height: 9px;
}
.gov-table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}
.gov-table-wrapper::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}
.gov-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.gov-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

/* Subtle scroll hint badges */
.table-scroll-hint {
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* Explicit Table Min-Widths to ensure every column is fully legible & scrolls horizontally */
.table-dashboard {
    min-width: 840px;
}

.table-assignments {
    min-width: 1080px;
}

.table-ledger-9col {
    min-width: 1300px;
}

.table-nakal {
    min-width: 980px;
}

.table-audit {
    min-width: 920px;
}

.table-users {
    min-width: 860px;
}

.table-mohallas {
    min-width: 760px;
}

.gov-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--gov-border);
    border-right: 1px solid #f1f5f9;
    z-index: 10;
    white-space: nowrap;
}

.gov-table tbody td {
    padding: 12px 14px;
    font-size: 0.88rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f8fafc;
    vertical-align: middle;
}

.gov-table tbody tr {
    transition: background-color 0.15s ease;
}

.gov-table tbody tr:hover {
    background-color: #f8fafc;
}

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

/* Strikethrough & Multi-owner styles */
.transferred-owner-pill {
    text-decoration: line-through;
    text-decoration-color: #ef4444;
    text-decoration-thickness: 1.5px;
    color: #64748b;
    font-size: 0.82rem;
    display: inline-block;
}

.transferred-tag {
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    text-decoration: none !important;
    display: inline-block;
}

.active-owner-text {
    font-weight: 600;
    color: #0f172a;
}

/* Action Button Group */
.table-action-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-table-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--gov-border);
    background: #ffffff;
    color: #475569;
    font-size: 0.9rem;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-table-action:hover {
    background: #f1f5f9;
    color: var(--gov-blue);
    border-color: #cbd5e1;
}

.btn-table-nakal {
    padding: 4px 10px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-table-nakal:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

/* --------------------------------------------------------------------------
   5. Search & Filter Bar with Debounce
   -------------------------------------------------------------------------- */
.filter-card {
    background: #ffffff;
    border: 1px solid var(--gov-border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.search-input-group {
    position: relative;
    width: 100%;
}

.search-input-group i.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
}

.search-input-group input {
    padding-left: 36px;
    padding-right: 36px;
    border-radius: 8px;
    border: 1px solid var(--gov-border);
    font-size: 0.88rem;
    height: 40px;
}

.search-input-group .search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.search-input-group.loading .search-spinner {
    display: block;
}

/* --------------------------------------------------------------------------
   6. Pagination Component
   -------------------------------------------------------------------------- */
.gov-pagination-bar {
    padding: 12px 18px;
    background: #ffffff;
    border-top: 1px solid var(--gov-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination-pill-item a,
.pagination-pill-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.pagination-pill-item a:hover {
    background: #f1f5f9;
    border-color: var(--gov-border);
    color: var(--gov-navy);
}

.pagination-pill-item.active span {
    background: var(--gov-blue);
    color: #ffffff;
    border-color: var(--gov-blue);
    box-shadow: 0 1px 3px rgba(29, 78, 216, 0.3);
}

.pagination-pill-item.disabled span {
    color: #cbd5e1;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Step Wizard Component
   -------------------------------------------------------------------------- */
.step-wizard-container {
    padding: 10px 0;
}

.step-wizard-item {
    width: 18%;
}

.step-circle {
    width: 40px;
    height: 40px;
    background-color: #ffffff;
    border: 3px solid #cbd5e1;
    color: #64748b;
    font-weight: 800;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.step-wizard-item.active .step-circle {
    background-color: var(--gov-blue);
    border-color: var(--gov-blue);
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.2);
}

.step-wizard-item.completed .step-circle {
    background-color: var(--gov-green);
    border-color: var(--gov-green);
    color: #ffffff;
}

.step-wizard-item.active .step-title {
    color: var(--gov-blue);
    font-weight: 800;
}

.step-wizard-item.completed .step-title {
    color: var(--gov-green);
}

.step-title {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 6px;
}

/* Role Badges */
.badge-admin { background-color: #dc2626; color: #fff; }
.badge-verifier { background-color: #2563eb; color: #fff; }
.badge-operator { background-color: #059669; color: #fff; }

/* Alert Styling */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Flash Alert Auto-Dismiss Styling */
.flash-alert {
    border-radius: 8px;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s ease, max-height 0.5s ease, margin 0.5s ease, padding 0.5s ease;
    will-change: opacity, transform, max-height;
}

.flash-alert.dismissing {
    opacity: 0 !important;
    transform: translateY(-8px) scale(0.98) !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
}
