/* ============================================================
   Barangay Bubuyan Digital Services Platform
   Modern Green & White Design System
   ============================================================ */

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

:root {
    --bb-primary: #15803d;
    --bb-primary-hover: #166534;
    --bb-primary-dark: #0f3d21;
    --bb-primary-light: #22c55e;
    --bb-primary-soft: #dcfce7;
    --bb-primary-softer: #f0fdf4;
    --bb-bg: #f5faf6;
    --bb-white: #ffffff;
    --bb-border: #dcece2;
    --bb-ink: #0f172a;
    --bb-text: #334155;
    --bb-muted: #64748b;
    --bb-danger: #dc2626;
    --bb-warning: #d97706;
    --bb-info: #0284c7;
    --bb-radius: 14px;
    --bb-radius-sm: 10px;
    --bb-shadow-sm: 0 2px 8px rgba(15, 61, 33, 0.05);
    --bb-shadow: 0 8px 24px rgba(15, 61, 33, 0.08);
    --bb-shadow-lg: 0 18px 40px rgba(15, 61, 33, 0.12);
    --bb-sidebar-w: 268px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bb-bg);
    color: var(--bb-ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--bb-primary);
    text-decoration: none;
}

a:hover {
    color: var(--bb-primary-hover);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-bb-primary {
    background: linear-gradient(135deg, var(--bb-primary), #16a34a);
    color: #fff !important;
    border: none;
    border-radius: var(--bb-radius-sm);
    font-weight: 600;
    padding: 0.62rem 1.25rem;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.22);
    transition: all 0.2s ease;
}

.btn-bb-primary:hover,
.btn-bb-primary:focus {
    background: linear-gradient(135deg, var(--bb-primary-hover), var(--bb-primary));
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(21, 128, 61, 0.28);
    color: #fff !important;
}

.btn-bb-outline {
    background: var(--bb-white);
    color: var(--bb-primary) !important;
    border: 1.5px solid var(--bb-primary);
    border-radius: var(--bb-radius-sm);
    font-weight: 600;
    padding: 0.58rem 1.2rem;
    transition: all 0.2s ease;
}

.btn-bb-outline:hover {
    background: var(--bb-primary-softer);
    color: var(--bb-primary-dark) !important;
}

.btn-bb-soft {
    background: var(--bb-primary-soft);
    color: var(--bb-primary-dark) !important;
    border: none;
    border-radius: var(--bb-radius-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-bb-soft:hover {
    background: #bbf7d0;
}

/* ============================================================
   Landing Page (main.html)
   ============================================================ */
.bb-navbar {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bb-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.bb-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bb-primary-soft);
    box-shadow: var(--bb-shadow-sm);
}

.bb-brand-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--bb-primary-dark);
    line-height: 1.15;
}

.bb-brand-sub {
    font-size: 0.75rem;
    color: var(--bb-muted);
    font-weight: 500;
}

.bb-hero {
    background: radial-gradient(circle at top right, #dcfce7 0%, #f5faf6 48%, #ffffff 100%);
    padding: 4.2rem 0 4rem;
    border-bottom: 1px solid var(--bb-border);
}

.bb-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bb-primary-soft);
    color: var(--bb-primary-dark);
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 1.1rem;
}

.bb-hero-title {
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--bb-ink);
    letter-spacing: -0.025em;
}

.bb-hero-title span {
    color: var(--bb-primary);
}

.bb-hero-img-wrap {
    background: #fff;
    border-radius: 22px;
    padding: 1rem;
    border: 1px solid var(--bb-border);
    box-shadow: var(--bb-shadow-lg);
}

.bb-hero-img-wrap img {
    width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
}

.bb-section {
    padding: 4.5rem 0;
}

.bb-section-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bb-primary);
    margin-bottom: 0.45rem;
}

.bb-section-title {
    font-size: clamp(1.6rem, 2.8vw, 2.25rem);
    font-weight: 800;
    color: var(--bb-ink);
    letter-spacing: -0.02em;
}

.bb-service-card {
    background: var(--bb-white);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    padding: 1.5rem;
    height: 100%;
    box-shadow: var(--bb-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.bb-service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--bb-shadow);
    border-color: var(--bb-primary-light);
}

.bb-service-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bb-primary-softer);
    color: var(--bb-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.bb-price-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--bb-primary-softer);
    color: var(--bb-primary-dark);
    border: 1px solid #bbf7d0;
}

.bb-price-tag.is-free {
    background: #15803d;
    color: #ffffff;
    border-color: #15803d;
}

.bb-step-num {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bb-primary);
    color: #fff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bb-footer {
    background: var(--bb-primary-dark);
    color: #d1fae5;
    padding: 3rem 0 2rem;
}

/* ============================================================
   Dashboard Layout (Sidebar + Topbar + Main Content)
   ============================================================ */
.bb-app-shell {
    display: flex;
    min-height: 100vh;
}

.bb-sidebar {
    width: var(--bb-sidebar-w);
    background: var(--bb-white);
    border-right: 1px solid var(--bb-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.bb-sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--bb-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bb-sidebar-nav {
    padding: 1rem 0.85rem;
    flex: 1;
    overflow-y: auto;
}

.bb-nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bb-muted);
    padding: 0.65rem 0.75rem 0.35rem;
}

.bb-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.68rem 0.9rem;
    border-radius: 10px;
    color: var(--bb-text);
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
    transition: all 0.16s ease;
}

.bb-nav-link i {
    font-size: 1.1rem;
    color: var(--bb-muted);
}

.bb-nav-link:hover {
    background: var(--bb-primary-softer);
    color: var(--bb-primary-dark);
}

.bb-nav-link:hover i {
    color: var(--bb-primary);
}

.bb-nav-link.active {
    background: linear-gradient(135deg, var(--bb-primary), #16a34a);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
}

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

.bb-sidebar-footer {
    padding: 1rem 1rem;
    border-top: 1px solid var(--bb-border);
    background: #fafdfb;
}

.bb-main-wrap {
    margin-left: var(--bb-sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bb-topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bb-border);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.bb-content {
    padding: 1.65rem;
    flex: 1;
}

.bb-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .bb-sidebar {
        transform: translateX(-100%);
    }
    .bb-sidebar.open {
        transform: translateX(0);
    }
    .bb-sidebar-backdrop.open {
        display: block;
    }
    .bb-main-wrap {
        margin-left: 0;
    }
    .bb-content {
        padding: 1.1rem;
    }
    .bb-topbar {
        padding: 0.75rem 1rem;
    }
}

/* ============================================================
   Cards, Stats & Badges
   ============================================================ */
.bb-card {
    background: var(--bb-white);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow-sm);
}

.bb-card-header {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--bb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.bb-card-body {
    padding: 1.35rem;
}

.bb-stat-card {
    background: var(--bb-white);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    padding: 1.25rem;
    box-shadow: var(--bb-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 100%;
}

.bb-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.bb-stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--bb-ink);
}

.bb-stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bb-muted);
    margin-top: 0.2rem;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-ready {
    background: #dcfce7;
    color: #166534;
}

.badge-completed {
    background: #e0f2fe;
    color: #075985;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge-free {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* ============================================================
   Document Request Form & File Uploads
   ============================================================ */
.bb-doc-choice {
    background: var(--bb-white);
    border: 1.5px solid var(--bb-border);
    border-radius: var(--bb-radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.bb-doc-choice:hover {
    border-color: var(--bb-primary);
    background: var(--bb-primary-softer);
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow);
    color: inherit;
}

.bb-doc-choice.selected {
    border-color: var(--bb-primary);
    background: var(--bb-primary-softer);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.14);
}

.bb-form-section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--bb-primary-dark);
    padding-bottom: 0.6rem;
    margin-bottom: 1.15rem;
    border-bottom: 2px solid var(--bb-primary-soft);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.87rem;
    color: var(--bb-ink);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1.5px solid #d5e3da;
    padding: 0.62rem 0.88rem;
    font-size: 0.93rem;
    color: var(--bb-ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.14);
}

.bb-upload-box {
    border: 1.5px dashed #86efac;
    background: #f8fdf9;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.bb-upload-box:hover {
    border-color: var(--bb-primary);
    background: #f0fdf4;
}

.bb-upload-preview {
    max-height: 110px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--bb-border);
    margin-top: 0.6rem;
    object-fit: cover;
}

.bb-qr-card {
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
    border: 1.5px solid #86efac;
    border-radius: 16px;
    padding: 1.4rem;
}

.bb-qr-img {
    max-width: 220px;
    width: 100%;
    border-radius: 14px;
    border: 2px solid #bbf7d0;
    background: #fff;
    padding: 8px;
    box-shadow: var(--bb-shadow-sm);
}

/* ============================================================
   Auth Pages
   ============================================================ */
.bb-auth-page {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #dcfce7 0%, #f5faf6 45%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.bb-auth-card {
    background: var(--bb-white);
    border: 1px solid var(--bb-border);
    border-radius: 20px;
    box-shadow: var(--bb-shadow-lg);
    width: 100%;
    max-width: 460px;
    padding: 2.2rem 2rem;
}

.bb-auth-card.wide {
    max-width: 620px;
}

/* ============================================================
   DataTables Custom Green & White Theme
   ============================================================ */
.table {
    color: var(--bb-ink);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table thead th {
    background-color: #f0fdf4 !important;
    color: var(--bb-primary-dark);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1.5px solid #bbf7d0 !important;
    padding: 0.85rem 0.9rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.85rem 0.9rem;
    border-color: #edf5ef;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 9px !important;
    border: 1.5px solid #d5e3da !important;
    padding: 0.36rem 0.7rem !important;
    font-size: 0.86rem !important;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--bb-primary) !important;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.14);
}

.page-item.active .page-link {
    background-color: var(--bb-primary) !important;
    border-color: var(--bb-primary) !important;
    color: #fff !important;
}

.page-link {
    color: var(--bb-primary-dark);
    border-radius: 8px !important;
    margin: 0 2px;
}

/* ============================================================
   Top-Right Toast Notifications
   ============================================================ */
.bb-toast-container {
    position: fixed;
    top: 1.15rem;
    right: 1.15rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: 390px;
    width: calc(100vw - 2.3rem);
    pointer-events: none;
}

.bb-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    background: #ffffff;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    border: 1px solid #e2e8f0;
    border-left: 5px solid var(--bb-primary);
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.bb-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.bb-toast-success {
    border-left-color: #16a34a;
}
.bb-toast-success .bb-toast-icon {
    color: #16a34a;
}

.bb-toast-error {
    border-left-color: #dc2626;
}
.bb-toast-error .bb-toast-icon {
    color: #dc2626;
}

.bb-toast-warning {
    border-left-color: #d97706;
}
.bb-toast-warning .bb-toast-icon {
    color: #d97706;
}

.bb-toast-info {
    border-left-color: #0284c7;
}
.bb-toast-info .bb-toast-icon {
    color: #0284c7;
}

.bb-toast-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-top: 2px;
}

.bb-toast-body {
    flex: 1;
    min-width: 0;
}

.bb-toast-title {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--bb-ink);
}

.bb-toast-msg {
    font-size: 0.83rem;
    color: var(--bb-text);
    line-height: 1.4;
    word-break: break-word;
}

.bb-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.bb-toast-close:hover {
    color: var(--bb-ink);
}

/* ============================================================
   Requirement Thumbnails & Lightbox
   ============================================================ */
.bb-req-thumb {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--bb-border);
    cursor: pointer;
    transition: transform 0.2s ease;
    background: #f8fafc;
}

.bb-req-thumb:hover {
    transform: scale(1.02);
}

.bb-modal-content {
    border-radius: 16px;
    border: 1px solid var(--bb-border);
    box-shadow: var(--bb-shadow-lg);
}

.bb-modal-header {
    background: #f0fdf4;
    border-bottom: 1px solid var(--bb-border);
    border-radius: 16px 16px 0 0;
}

.bb-rejection-banner {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-left: 5px solid #dc2626;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    color: #7f1d1d;
}

.bb-filter-pills .nav-link {
    border-radius: 999px;
    color: var(--bb-text);
    font-weight: 600;
    font-size: 0.84rem;
    padding: 0.42rem 0.95rem;
    border: 1px solid var(--bb-border);
    background: #fff;
}

.bb-filter-pills .nav-link.active {
    background: var(--bb-primary);
    color: #fff;
    border-color: var(--bb-primary);
}

/* ============================================================
   Global Processing / SMTP Loading Overlay
   ============================================================ */
.bb-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 61, 33, 0.42);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.bb-loading-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.bb-loader-card {
    background: #ffffff;
    border: 1px solid var(--bb-border);
    border-radius: 20px;
    padding: 2rem 1.85rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 55px rgba(15, 61, 33, 0.24);
    transform: translateY(10px) scale(0.97);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.bb-loading-overlay.show .bb-loader-card {
    transform: translateY(0) scale(1);
}

.bb-loader-spinner-wrap {
    position: relative;
    width: 68px;
    height: 68px;
    margin: 0 auto 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bb-loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid var(--bb-primary-soft);
    border-top-color: var(--bb-primary);
    border-right-color: var(--bb-primary-light);
    animation: bbSpin 0.85s linear infinite;
}

.bb-loader-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bb-primary-softer);
    color: var(--bb-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bb-loader-title {
    font-weight: 800;
    font-size: 1.06rem;
    color: var(--bb-ink);
    margin-bottom: 0.4rem;
}

.bb-loader-msg {
    font-size: 0.88rem;
    color: var(--bb-text);
    line-height: 1.5;
    margin-bottom: 1.1rem;
}

.bb-loader-bar {
    height: 5px;
    width: 100%;
    background: var(--bb-primary-soft);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.bb-loader-bar-fill {
    height: 100%;
    width: 42%;
    background: linear-gradient(90deg, var(--bb-primary), var(--bb-primary-light));
    border-radius: 999px;
    animation: bbIndeterminate 1.35s ease-in-out infinite;
}

.bb-loader-hint {
    font-size: 0.76rem;
    color: var(--bb-muted);
    font-weight: 500;
}

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

@keyframes bbIndeterminate {
    0% {
        transform: translateX(-110%);
    }
    100% {
        transform: translateX(260%);
    }
}
