/**
 * E-Barangay Information Management System
 * Custom Styles
 */

:root {
    --primary-color: #2563eb;
    --secondary-color: #475569;
    --success-color: #0f766e;
    --danger-color: #be123c;
    --warning-color: #b45309;
    --info-color: #0284c7;
    --light-color: #f8fafc;
    --dark-color: #0f172a;
    --module-bg-image: url('img/barangay_logo2.png');
    --ui-border-soft: #e6ebf2;
    --ui-border-hover: #d6e4ff;
    --ui-bg-soft: #ffffff;
    --ui-bg-soft-hover: #f5f9ff;
    --ui-text-muted: #5b6678;
    --ui-text-hover: #2f4f95;
    --ui-pill-radius: 999px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Officials module tiles */
.officials-tiles {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.officials-group {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 16px 28px -26px rgba(15, 23, 42, 0.55);
}

.officials-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0.25rem 0.85rem;
}

.officials-group-title {
    font-weight: 900;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.officials-group-meta {
    font-size: 0.85rem;
    font-weight: 600;
}

.officials-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.official-tile .official-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    font-size: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 20px -18px rgba(15, 23, 42, 0.55);
}

.official-tile .official-name {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.official-tile .official-sub {
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.official-tile .official-term {
    white-space: nowrap;
}

.official-icon.is-captain {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}
.official-icon.is-kagawad {
    background: rgba(2, 132, 199, 0.12);
    color: #0369a1;
}
.official-icon.is-sk {
    background: rgba(180, 83, 9, 0.12);
    color: #b45309;
}
.official-icon.is-secretary {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}
.official-icon.is-treasurer {
    background: rgba(190, 18, 60, 0.12);
    color: #be123c;
}
.official-icon.is-default {
    background: rgba(71, 85, 105, 0.12);
    color: #475569;
}

.officials-empty .officials-empty-icon {
    font-size: 2.25rem;
    color: rgba(71, 85, 105, 0.6);
}

.official-tile-vacant {
    border: 1px dashed rgba(71, 85, 105, 0.35) !important;
    background: rgba(255, 255, 255, 0.5);
}

.officials-history summary {
    cursor: pointer;
    user-select: none;
    font-weight: 700;
}

.officials-history-grid .official-tile {
    opacity: 0.9;
}

.resident-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1080;
    max-height: 280px;
    overflow: auto;
    border-radius: 12px;
    box-shadow: 0 18px 36px -26px rgba(15, 23, 42, 0.7);
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.app-topbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 14px 26px -22px rgba(15, 23, 42, 0.7);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.app-navbar-logo {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.78);
}

.app-brand-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-brand-title {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #f8fafc;
}

.app-brand-subtitle {
    font-size: 0.74rem;
    color: rgba(248, 250, 252, 0.82);
    font-weight: 500;
}

.app-topbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.32);
}

.app-topbar .navbar-toggler:focus {
    box-shadow: 0 0 0 0.18rem rgba(147, 197, 253, 0.35);
}

/* Notifications bell: no white “badge” — sits flush on blue bar, aligned with view switch */
.app-topbar #navbarNav .navbar-nav {
    align-items: center;
}

.app-topbar .app-notifications-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.35rem 0.5rem;
    min-width: 2.25rem;
    min-height: calc(0.8rem * 1.5 + 0.6rem);
    line-height: 1;
    background: transparent;
    color: rgba(248, 250, 252, 0.95);
    border-radius: 8px;
    box-shadow: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.app-topbar .app-notifications-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

.app-topbar .app-notifications-btn:focus-visible {
    outline: 0;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.75);
}

.app-topbar .app-notifications-btn .bi-bell-fill {
    font-size: 1.25rem;
    line-height: 1;
    vertical-align: middle;
}

.app-topbar .app-notifications-btn--unread .bi-bell-fill {
    animation: appNotificationsBellGlow 2.2s ease-in-out infinite;
}

@keyframes appNotificationsBellGlow {
    0%, 100% {
        filter: drop-shadow(0 0 0 transparent);
    }
    50% {
        filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.85));
    }
}

.app-topbar .app-notifications-badge {
    position: absolute;
    top: 0.1rem;
    right: 0.1rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    font-size: 0.6rem;
    font-weight: 800;
    line-height: 1.2rem;
    text-align: center;
    color: #fff;
    background: #dc2626;
    border: 2px solid rgba(15, 23, 42, 0.9);
    box-shadow: none;
}

/* —— Notifications dropdown panel —— */
.app-notifications-menu {
    min-width: 340px;
    max-width: min(100vw - 1.5rem, 400px);
    padding: 0;
    margin-top: 0.5rem !important;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.app-notifications-menu > li {
    list-style: none;
}

.app-notifications-menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.app-notifications-menu-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.25rem 0.35rem;
}

.app-notifications-menu-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.app-notifications-mark-all {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.app-notifications-mark-all:hover {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
}

.app-notifications-clear-all {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.app-notifications-clear-all:hover {
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.08);
}

.app-notifications-menu-scroll-wrap {
    padding: 0;
    max-height: min(360px, 55vh);
    overflow: hidden;
}

.app-notifications-list {
    max-height: min(360px, 55vh);
    overflow-y: auto;
    padding: 0.35rem 0;
    margin: 0;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

.app-notifications-list::-webkit-scrollbar {
    width: 6px;
}

.app-notifications-list::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.2);
    border-radius: 6px;
}

.app-notification-row {
    list-style: none;
    margin: 0 0.5rem 0.35rem;
}

.app-notification-row:last-child {
    margin-bottom: 0.5rem;
}

.app-notification-card {
    display: flex;
    align-items: stretch;
    gap: 0.15rem;
}

.app-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.5rem 0.65rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.app-notification-delete {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.35rem;
    margin-right: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-notification-delete:hover {
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.1);
}

.app-notification-delete:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.app-notification-delete .bi {
    font-size: 0.95rem;
}

.app-notification-item:hover {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.06);
    color: inherit;
}

.app-notification-item.is-unread {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.07) 0%, rgba(37, 99, 235, 0.02) 100%);
    border-color: rgba(37, 99, 235, 0.12);
}

.app-notification-item.is-unread:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.04) 100%);
}

.app-notification-item.is-read {
    opacity: 0.92;
}

.app-notification-item.is-read .app-notification-title {
    font-weight: 600;
    color: #475569;
}

.app-notification-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1rem;
}

.app-notification-icon--primary {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.app-notification-icon--success {
    background: rgba(22, 163, 74, 0.14);
    color: #15803d;
}

.app-notification-icon--danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.app-notification-icon--warning {
    background: rgba(217, 119, 6, 0.14);
    color: #c2410c;
}

.app-notification-icon--secondary {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.app-notification-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.app-notification-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

.app-notification-msg {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.app-notification-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.app-notification-time .bi-clock {
    font-size: 0.65rem;
    opacity: 0.85;
}

.app-notification-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.app-notifications-empty,
.app-notifications-loading {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1.25rem;
    text-align: center;
    font-size: 0.8125rem;
    color: #94a3b8;
}

.app-notifications-empty .bi-inbox {
    font-size: 1.75rem;
    opacity: 0.45;
}

.app-notifications-empty--error {
    color: #b91c1c;
}

.app-notifications-loading {
    padding: 1.5rem;
}

.view-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
}

.view-switch .view-label {
    opacity: 0.85;
}

.view-switch .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.view-switch .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.view-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.2s;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.view-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background-color: #f8fafc;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.view-switch .switch input:checked + .slider {
    background-color: rgba(59, 130, 246, 0.7);
}

.view-switch .switch input:checked + .slider:before {
    transform: translateX(22px);
}

@media (max-width: 576px) {
    .app-brand-title {
        font-size: 0.88rem;
    }

    .app-brand-subtitle {
        font-size: 0.68rem;
    }
}

.main-content {
    position: relative;
    isolation: isolate;
    background-image:
        linear-gradient(rgba(241, 245, 249, 0.72), rgba(241, 245, 249, 0.72)),
        var(--module-bg-image);
    background-repeat: no-repeat, no-repeat;
    background-position: center center, center center;
    background-size: cover, 45% auto;
    background-attachment: fixed, fixed;
}

.main-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: rgba(241, 245, 249, 0.18);
    pointer-events: none;
}

.main-content > * {
    position: relative;
    z-index: 1;
}

.main-content .container-fluid > h2 {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.2rem !important;
}

.module-page .module-hero {
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #eff6ff 100%);
    border: 1px solid rgba(37, 99, 235, 0.18) !important;
    box-shadow: 0 14px 28px -24px rgba(15, 23, 42, 0.32);
}

.module-page .module-kicker {
    letter-spacing: 0.08em;
    color: #475569;
    font-weight: 700;
}

.module-page .module-subtitle {
    color: #64748b;
}

.module-page .search-bar,
.users-page .search-bar,
.residents-page .search-bar,
.apps-page .search-bar,
.resident-apps-page .search-bar,
.blotter-page .search-bar,
.complaints-page .search-bar,
.announcements-page .search-bar,
.households-page .search-bar,
.reports-page .search-bar {
    padding: 0.9rem !important;
    border-radius: 14px !important;
    border: 1px solid #d7dee8 !important;
    background: #f2f4f7 !important;
    box-shadow: 0 12px 24px -24px rgba(15, 23, 42, 0.45) !important;
}

.module-page .search-bar .form-control,
.module-page .search-bar .form-select,
.users-page .search-bar .form-control,
.users-page .search-bar .form-select,
.residents-page .search-bar .form-control,
.residents-page .search-bar .form-select,
.apps-page .search-bar .form-control,
.apps-page .search-bar .form-select,
.resident-apps-page .search-bar .form-control,
.resident-apps-page .search-bar .form-select,
.blotter-page .search-bar .form-control,
.blotter-page .search-bar .form-select,
.complaints-page .search-bar .form-control,
.complaints-page .search-bar .form-select,
.announcements-page .search-bar .form-control,
.announcements-page .search-bar .form-select,
.households-page .search-bar .form-control,
.households-page .search-bar .form-select,
.reports-page .search-bar .form-control,
.reports-page .search-bar .form-select {
    min-height: 42px !important;
    border-radius: 8px !important;
    border-color: #cfd8e3 !important;
    background: #f8fafc !important;
}

.module-page .search-bar .btn,
.users-page .search-bar .btn,
.residents-page .search-bar .btn,
.apps-page .search-bar .btn,
.resident-apps-page .search-bar .btn,
.blotter-page .search-bar .btn,
.complaints-page .search-bar .btn,
.announcements-page .search-bar .btn,
.households-page .search-bar .btn,
.reports-page .search-bar .btn {
    min-height: 42px !important;
    border-radius: 10px !important;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
}

.module-page .search-bar .btn.btn-primary,
.users-page .search-bar .btn.btn-primary,
.residents-page .search-bar .btn.btn-primary,
.apps-page .search-bar .btn.btn-primary,
.resident-apps-page .search-bar .btn.btn-primary,
.blotter-page .search-bar .btn.btn-primary,
.complaints-page .search-bar .btn.btn-primary,
.announcements-page .search-bar .btn.btn-primary,
.households-page .search-bar .btn.btn-primary,
.reports-page .search-bar .btn.btn-primary {
    background: #1f6feb !important;
    border-color: #1f6feb !important;
    color: #ffffff !important;
}

.module-page .search-bar .btn.btn-outline-secondary,
.users-page .search-bar .btn.btn-outline-secondary,
.residents-page .search-bar .btn.btn-outline-secondary,
.apps-page .search-bar .btn.btn-outline-secondary,
.resident-apps-page .search-bar .btn.btn-outline-secondary,
.blotter-page .search-bar .btn.btn-outline-secondary,
.complaints-page .search-bar .btn.btn-outline-secondary,
.announcements-page .search-bar .btn.btn-outline-secondary,
.households-page .search-bar .btn.btn-outline-secondary,
.reports-page .search-bar .btn.btn-outline-secondary {
    background: #f8fafc !important;
    border-color: #8b95a7 !important;
    color: #5b6576 !important;
}

.module-page .search-bar .btn.btn-secondary,
.users-page .search-bar .btn.btn-secondary,
.residents-page .search-bar .btn.btn-secondary,
.apps-page .search-bar .btn.btn-secondary,
.resident-apps-page .search-bar .btn.btn-secondary,
.blotter-page .search-bar .btn.btn-secondary,
.complaints-page .search-bar .btn.btn-secondary,
.announcements-page .search-bar .btn.btn-secondary,
.households-page .search-bar .btn.btn-secondary,
.reports-page .search-bar .btn.btn-secondary {
    background: #6b7280 !important;
    border-color: #6b7280 !important;
    color: #f8fafc !important;
}

.module-page .btn-action-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.module-page .btn-action-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.module-page .btn-action-secondary {
    background: #fff;
    border-color: #cbd5e1;
    color: #475569;
}

.module-page .btn-action-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
}

.module-page .btn-action-danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.module-page .btn-action-danger:hover {
    background: #ffe4e6;
    border-color: #fda4af;
    color: #9f1239;
}

.module-page .search-bar .btn i {
    font-size: 0.92rem;
    line-height: 1;
}

.module-page .action-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--ui-border-soft);
    background: var(--ui-bg-soft);
    color: var(--ui-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.module-page .action-icon-btn:hover,
.module-page .action-icon-btn:focus-visible {
    background: var(--ui-bg-soft-hover);
    border-color: var(--ui-border-hover);
    color: var(--ui-text-hover);
}

.module-page .action-icon-btn i {
    font-size: 0.92rem;
    line-height: 1;
}

.module-page th[class$='-actions-col'],
.module-page td[class$='-actions-col'] {
    white-space: nowrap;
}

.module-page .actions-col-compact {
    width: 140px !important;
    min-width: 140px !important;
}

.module-page .actions-col-wide {
    width: 176px !important;
    min-width: 176px !important;
}

@media (max-width: 768px) {
    .module-page .actions-col-compact,
    .module-page .actions-col-wide {
        width: 140px !important;
        min-width: 140px !important;
    }
}

.module-page .users-actions,
.module-page .resident-actions,
.module-page .resident-apps-actions,
.module-page .households-actions,
.module-page .blotter-actions,
.module-page .complaints-actions,
.module-page .announcements-actions,
.module-page .apps-actions,
.module-page .official-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.module-page .resident-pill,
.module-page .resident-apps-pill,
.module-page .blotter-pill,
.module-page .apps-pill,
.module-page .complaints-pill,
.module-page .announcement-pill,
.module-page .user-pill,
.module-page .official-pill,
.module-page .vacant-pill {
    min-height: 28px;
    padding: 0.33rem 0.62rem;
    font-size: 0.75rem;
    line-height: 1.1;
    border-radius: var(--ui-pill-radius);
}

.module-page .app-tabs,
.users-page .app-tabs,
.residents-page .app-tabs,
.apps-page .app-tabs,
.resident-apps-page .app-tabs,
.blotter-page .app-tabs,
.complaints-page .app-tabs,
.announcements-page .app-tabs,
.households-page .app-tabs,
.reports-page .app-tabs {
    border-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.module-page .app-tabs .nav-item,
.users-page .app-tabs .nav-item,
.residents-page .app-tabs .nav-item,
.apps-page .app-tabs .nav-item,
.resident-apps-page .app-tabs .nav-item,
.blotter-page .app-tabs .nav-item,
.complaints-page .app-tabs .nav-item,
.announcements-page .app-tabs .nav-item,
.households-page .app-tabs .nav-item,
.reports-page .app-tabs .nav-item {
    flex: 1 1 160px;
    margin-bottom: 0;
}

.module-page .app-tabs .nav-link,
.users-page .app-tabs .nav-link,
.residents-page .app-tabs .nav-link,
.apps-page .app-tabs .nav-link,
.resident-apps-page .app-tabs .nav-link,
.blotter-page .app-tabs .nav-link,
.complaints-page .app-tabs .nav-link,
.announcements-page .app-tabs .nav-link,
.households-page .app-tabs .nav-link,
.reports-page .app-tabs .nav-link {
    width: 100%;
    text-align: center;
    border: 1px solid #ccd6e3 !important;
    border-radius: 999px;
    color: #4b5565;
    font-weight: 600;
    padding: 0.56rem 1rem;
    background: #f2f4f7 !important;
}

.module-page .app-tabs .nav-link.active,
.users-page .app-tabs .nav-link.active,
.residents-page .app-tabs .nav-link.active,
.apps-page .app-tabs .nav-link.active,
.resident-apps-page .app-tabs .nav-link.active,
.blotter-page .app-tabs .nav-link.active,
.complaints-page .app-tabs .nav-link.active,
.announcements-page .app-tabs .nav-link.active,
.households-page .app-tabs .nav-link.active,
.reports-page .app-tabs .nav-link.active {
    color: #1f4ecb !important;
    background: #dfe8f5 !important;
    border-color: #adc3e9 !important;
}

@media (max-width: 768px) {
    .module-page .search-bar,
    .users-page .search-bar,
    .residents-page .search-bar,
    .apps-page .search-bar,
    .resident-apps-page .search-bar,
    .blotter-page .search-bar,
    .complaints-page .search-bar,
    .announcements-page .search-bar,
    .households-page .search-bar,
    .reports-page .search-bar {
        padding: 0.75rem !important;
    }

    .module-page .app-tabs .nav-item,
    .users-page .app-tabs .nav-item,
    .residents-page .app-tabs .nav-item,
    .apps-page .app-tabs .nav-item,
    .resident-apps-page .app-tabs .nav-item,
    .blotter-page .app-tabs .nav-item,
    .complaints-page .app-tabs .nav-item,
    .announcements-page .app-tabs .nav-item,
    .households-page .app-tabs .nav-item,
    .reports-page .app-tabs .nav-item {
        flex: 1 1 calc(50% - 0.45rem);
    }
}

.module-page .data-table .table th,
.module-page .data-table .table td {
    vertical-align: middle;
}

.module-page .data-table code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
}

.card {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.card .card-header {
    border-bottom: 1px solid #eef2f7;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.35)),
        url('img/barangay_logo2.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

.login-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-card .card-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.login-card .form-label {
    font-weight: 500;
    color: #495057;
}

/* Dashboard Cards */
.stat-card {
    position: relative;
    border-radius: 15px;
    padding: 1rem 1rem 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    min-height: 128px;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 55%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.2);
}

.stat-card[role="button"] {
    cursor: pointer;
}

.stat-card[role="button"]:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.35);
    outline-offset: 3px;
}

.stat-card .stat-icon {
    position: absolute;
    top: 11px;
    right: 13px;
    font-size: 1.22rem;
    opacity: 0.95;
}

.stat-card .stat-value {
    font-size: 2.05rem;
    font-weight: 700;
    line-height: 1.15;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    text-transform: none;
    opacity: 0.96;
}

.stat-card.text-dark {
    color: #fff;
}

.stat-card.text-dark .stat-label,
.stat-card.text-dark .stat-icon {
    color: rgba(255, 255, 255, 0.85);
}

/* Gradient tile themes */
.stat-card.bg-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.stat-card.bg-success {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}
.stat-card.bg-info {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}
.stat-card.bg-warning {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
}
.stat-card.bg-danger {
    background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
}
.stat-card.bg-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}
.stat-card.bg-dark {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

/* Table Styles */
.data-table {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.users-page .users-table-scroll {
    max-height: min(62vh, 640px);
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;                 /* Firefox */
    scrollbar-color: #94a3b8 #f1f5f9;      /* thumb track */
}

.users-page .users-table-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.users-page .users-table-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.users-page .users-table-scroll::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
    border: 2px solid #f1f5f9;
}

.users-page .users-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.users-page .users-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8fafc;
}

.data-table .table {
    margin-bottom: 0;
}

.data-table .table thead {
    background-color: #f8fafc;
    color: #334155;
}

.data-table .table thead th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table > :not(caption) > * > * {
    border-bottom-color: #e2e8f0;
}

.data-table .table tbody tr {
    transition: background-color 0.2s;
}

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

/* Badge Styles */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 500;
}

/* Form Styles */
.form-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    margin-bottom: 2rem;
}

/* Role Permissions Panel */
.role-permissions-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
    overflow: hidden;
}

.role-permissions-card .card-header {
    background: linear-gradient(135deg, #f7f9fc 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.role-permissions-card .card-header h5 {
    font-weight: 600;
    color: #1f2937;
}

.role-permissions-card .permissions-hint {
    background: #f1f5f9;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    display: inline-block;
}

.permissions-role-icons {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.25rem;
}

/* Role Permissions (Tile UI) */
.permissions-role-tiles {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.9rem;
}

.permissions-role-tile {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    padding: 0.9rem 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.permissions-role-tile .tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
    flex: 0 0 44px;
}

.permissions-role-tile .tile-icon i {
    font-size: 1.2rem;
    color: #475569;
}

.permissions-role-tile .tile-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.1;
}

.permissions-role-tile .tile-subtitle {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.permissions-role-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.10);
}

.permissions-role-tile.active {
    border-color: #0d6efd;
    background: #eaf2ff;
    box-shadow: 0 0 0 0.12rem rgba(13, 110, 253, 0.14);
}

.permissions-role-tile.active .tile-icon {
    background: #ffffff;
    border-color: rgba(13, 110, 253, 0.25);
}

.permissions-role-tile.active .tile-icon i {
    color: #0d6efd;
}

.permissions-role-tile:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.permission-module-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
}

.permission-module-tile {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
    overflow: hidden;
}

.permission-module-tile .module-tile-head {
    padding: 1rem 1.05rem;
    background: linear-gradient(135deg, #f7f9fc 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.permission-module-tile .module-tile-title {
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    font-size: 1.02rem;
}

.permission-module-tile .module-tile-body {
    padding: 0.95rem 1.05rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.9rem;
}

.permission-module-tile .perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.permission-module-tile .perm-label {
    font-size: 0.95rem;
    color: #334155;
    font-weight: 600;
}

.permission-module-tiles.access-only {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.permission-module-tile.access-only .module-tile-body,
.permission-module-tile .module-tile-body.access-only {
    grid-template-columns: 1fr;
}

.permissions-role-icon {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 14px;
    padding: 0.95rem 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.permissions-role-icon i {
    font-size: 1.2rem;
    color: #475569;
}

.permissions-role-icon:hover {
    transform: translateY(-1px);
}

.permissions-role-icon.active {
    border-color: #0d6efd;
    background: #eaf2ff;
    color: #0b3c9d;
    box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, 0.14);
}

.permissions-role-icon.active i {
    color: #0d6efd;
}

.permissions-role-icon:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

@media (max-width: 1200px) {
    .permissions-role-icons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .permissions-role-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .permission-module-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .permissions-role-icons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .permissions-role-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .permission-module-tiles {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .permissions-role-icons {
        grid-template-columns: 1fr;
    }
    .permissions-role-tiles {
        grid-template-columns: 1fr;
    }
}

.permissions-table {
    border-radius: 10px;
    overflow: hidden;
}

.permissions-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 0.55rem 0.5rem;
}

.permissions-table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.permissions-table tbody tr:hover {
    background: #f1f5f9;
}

.permissions-table td {
    padding: 0.5rem 0.45rem;
    vertical-align: middle;
}

.permissions-table td:first-child {
    font-weight: 600;
    color: #1f2937;
}

/* Switch toggle (used in tables + tiles) */
.perm-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 2.7rem;
    height: 1.5rem;
    border-radius: 999px;
    background: #e2e8f0;
    border: 1px solid rgba(15, 23, 42, 0.2);
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.perm-toggle::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 1.16rem;
    height: 1.16rem;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.perm-toggle:checked {
    background: #0d6efd;
    border-color: #0d6efd;
}

.perm-toggle:checked::after {
    transform: translateX(1.18rem);
}

.perm-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.2);
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

/* Status Badges */
.status-pending {
    background-color: #ffc107;
    color: #000;
}

.status-approved {
    background-color: #198754;
    color: #fff;
}

.status-rejected {
    background-color: #dc3545;
    color: #fff;
}

.status-active {
    background-color: #198754;
    color: #fff;
}

.status-inactive {
    background-color: #6c757d;
    color: #fff;
}

.status-resolved {
    background-color: #0dcaf0;
    color: #000;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* Pagination */
.pagination {
    margin-top: 1rem;
}

/* Search Bar */
.search-bar {
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .form-card {
        padding: 1rem;
    }
}
/* ============================================================================
   GLOBAL BUTTON SYSTEM - Consistent Styling Across All Pages
   ============================================================================ */

/* Base Button Styles */
.btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-family: 'Inter', 'Segoe UI', sans-serif !important;
    padding: 0.575rem 1.2rem !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
    border: 1px solid transparent !important;
    letter-spacing: 0.01em;
    cursor: pointer;
}

/* Primary Button (Blue) */
.btn-primary {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    border-color: #1d4ed8 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:focus-visible {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.25) !important;
}

.btn-primary:active,
.btn-primary.active {
    background-color: #60a5fa !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    transform: scale(1.01);
    box-shadow: inset 0 2px 8px rgba(29, 78, 216, 0.18), 0 0 0 0.18rem rgba(59, 130, 246, 0.2) !important;
}

/* Secondary/Outline Button (Gray) */
.btn-outline-secondary {
    background-color: #ffffff !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:focus-visible {
    background-color: #f8fbff !important;
    color: #1e3a8a !important;
    border-color: #bfdbfe !important;
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
}

.btn-outline-secondary:active,
.btn-outline-secondary.active {
    background-color: #eaf2ff !important;
    border-color: #93c5fd !important;
    color: #1e3a8a !important;
    transform: scale(1.01);
    box-shadow: inset 0 2px 8px rgba(30, 64, 175, 0.12), 0 0 0 0.18rem rgba(191, 219, 254, 0.45) !important;
}

/* Success Button (Green) */
.btn-success {
    background-color: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.btn-success:hover,
.btn-success:focus {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(5, 150, 105, 0.25) !important;
}

.btn-success:active {
    background-color: #065f46 !important;
    border-color: #065f46 !important;
}

/* Danger Button (Red) */
.btn-danger {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.25) !important;
}

.btn-danger:active {
    background-color: #991b1b !important;
    border-color: #991b1b !important;
}

/* Link Button */
.btn-link {
    color: #1d4ed8 !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-weight: 600 !important;
}

.btn-link:hover,
.btn-link:focus {
    color: #1e40af !important;
    text-decoration: underline !important;
    transform: none;
    box-shadow: none !important;
}

/* Button Sizes */
.btn-sm {
    padding: 0.35rem 0.85rem !important;
    font-size: 0.875rem !important;
}

.btn-lg {
    padding: 0.75rem 1.75rem !important;
    font-size: 1rem !important;
}

/* Full Width Button */
.btn.w-100 {
    width: 100% !important;
}

/* Disabled Button State */
.btn:disabled,
.btn-primary:disabled,
.btn-outline-secondary:disabled,
.btn-success:disabled,
.btn-danger:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Button with Icon Spacing */
.btn i {
    margin-right: 0.4rem;
}

.btn i:last-child {
    margin-right: 0;
}
/* ===== Role-Specific Badge Colors ===== */

.role-pill.role-super-admin {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.role-pill.role-captain {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.role-pill.role-secretary {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.role-pill.role-treasurer {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.role-pill.role-kagawad {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #a5b4fc;
}

.role-pill.role-sk {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #f9a8d4;
}

.role-pill.role-resident {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* ===== Navbar View-Mode Switch ===== */

.view-mode-switch-wrap {
    white-space: nowrap;
}

.view-mode-label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.btn-view-switch {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-view-switch:hover,
.btn-view-switch:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-view-switch:active {
    transform: translateY(0);
}

@media (max-width: 991.98px) {
    .view-mode-switch-wrap {
        padding: 0.5rem 0;
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}
