/* =========================================================================
   Buzz360 — theme (Bootstrap 5 is loaded from CDN in includes/header.php;
   this file only adds the custom look & feel on top of it)
   ========================================================================= */

:root {
    --bb-primary: #4f46e5;
    --bb-primary-dark: #3730a3;
    --bb-primary-light: #818cf8;
    --bb-accent: #06b6d4;
    --bb-sidebar-bg: #1e1b4b;
    --bb-sidebar-bg-2: #312e81;
    --bb-sidebar-text: #c7d2fe;
    --bb-sidebar-active: #4f46e5;
    --bb-bg: #f4f5fb;
    --bb-card-radius: 14px;
    --bb-success: #16a34a;
    --bb-warning: #d97706;
    --bb-danger: #dc2626;
    --bb-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--bb-font);
    background: var(--bb-bg);
    color: #1f2333;
    min-height: 100vh;
}

a { text-decoration: none; }

/* ---------------- Layout shell -------------------------------------- */
.bb-shell { display: flex; min-height: 100vh; }

.bb-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--bb-sidebar-bg) 0%, var(--bb-sidebar-bg-2) 100%);
    color: var(--bb-sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .25s ease;
}

.bb-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.bb-sidebar-brand .bi { font-size: 26px; color: var(--bb-accent); }

.bb-nav-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8b87c9;
    padding: 16px 20px 6px;
}

.bb-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--bb-sidebar-text);
    font-size: 14.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease;
}

.bb-nav-link .bi { font-size: 17px; width: 20px; text-align: center; }

.bb-nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.bb-nav-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-left-color: var(--bb-accent);
}

.bb-main {
    margin-left: 260px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bb-topbar {
    background: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eceefb;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.bb-content { padding: 24px; flex: 1; }

.bb-sidebar-toggle {
    display: none;
    border: none;
    background: transparent;
    font-size: 22px;
    color: #4b5563;
}

@media (max-width: 991px) {
    .bb-sidebar { transform: translateX(-100%); }
    .bb-sidebar.show { transform: translateX(0); }
    .bb-main { margin-left: 0; }
    .bb-sidebar-toggle { display: inline-block; }
}

/* ---------------- Cards / widgets ------------------------------------ */
.bb-card {
    background: #fff;
    border-radius: var(--bb-card-radius);
    border: 1px solid #eceefb;
    box-shadow: 0 2px 10px rgba(79,70,229,.04);
}

.bb-stat-card {
    padding: 20px;
    border-radius: var(--bb-card-radius);
    color: #fff;
    position: relative;
    overflow: hidden;
}
.bb-stat-card .bb-stat-icon {
    position: absolute;
    right: 14px; top: 14px;
    font-size: 40px;
    opacity: .25;
}
.bb-stat-card h3 { font-size: 26px; font-weight: 700; margin: 6px 0 0; }
.bb-stat-card span { font-size: 13px; opacity: .9; }

.bb-stat-1 { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.bb-stat-2 { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.bb-stat-3 { background: linear-gradient(135deg, #16a34a, #22c55e); }
.bb-stat-4 { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bb-stat-5 { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ---------------- Buttons -------------------------------------------- */
.btn-primary {
    background: var(--bb-primary);
    border-color: var(--bb-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--bb-primary-dark);
    border-color: var(--bb-primary-dark);
}
.btn-outline-primary {
    color: var(--bb-primary);
    border-color: var(--bb-primary);
}
.btn-outline-primary:hover {
    background: var(--bb-primary);
    border-color: var(--bb-primary);
}

/* ---------------- Tables ---------------------------------------------- */
.bb-table thead th {
    background: #f8f8fd;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6b7280;
    border-bottom: 1px solid #eceefb;
    white-space: nowrap;
}
.bb-table td { vertical-align: middle; font-size: 14px; }
.bb-table tbody tr:hover { background: #f8f8fd; }

/* ---------------- Badges / status pills -------------------------------- */
.bb-badge { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 20px; }
.bb-badge-paid, .bb-badge-active, .bb-badge-accepted, .bb-badge-sent, .bb-badge-received { background: #dcfce7; color: #15803d; }
.bb-badge-partial, .bb-badge-draft, .bb-badge-pending { background: #fef3c7; color: #b45309; }
.bb-badge-unpaid, .bb-badge-rejected, .bb-badge-inactive { background: #fee2e2; color: #b91c1c; }
.bb-badge-converted, .bb-badge-closed { background: #e0e7ff; color: #4338ca; }

/* ---------------- Forms ------------------------------------------------ */
.form-label { font-weight: 600; font-size: 13.5px; color: #374151; }
.form-control:focus, .form-select:focus {
    border-color: var(--bb-primary-light);
    box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}
.bb-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--bb-primary-dark);
    margin: 22px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eceefb;
}

/* ---------------- Auth pages -------------------------------------------- */
.bb-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #4f46e5, #1e1b4b 60%);
    padding: 20px;
}
.bb-auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 40px 36px;
    box-shadow: 0 20px 50px rgba(30,27,75,.35);
}
.bb-auth-logo {
    text-align: center;
    margin-bottom: 24px;
    font-weight: 800;
    font-size: 24px;
    color: var(--bb-primary-dark);
}

/* ---------------- Party (customer/vendor) picker ------------------------ */
.bb-party-search { cursor: pointer; background-color: #fff; }
.bb-party-search:focus { cursor: text; }
.bb-party-caret {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    pointer-events: none;
}
.bb-party-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(30,27,75,.15);
    z-index: 1060;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
}
.bb-party-option {
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
}
.bb-party-option:hover { background: #f4f5fb; }
.bb-party-add-option {
    color: var(--bb-primary);
    font-weight: 600;
    background: #f5f4ff;
    border-top: 1px solid #eceefb;
}
.bb-party-add-option:hover { background: #ece9fe; }
.bb-party-empty { padding: 10px 14px; font-size: 13px; color: #9ca3af; }

/* ---------------- Invoice line item builder ---------------------------- */
.bb-line-items-table input, .bb-line-items-table select { font-size: 13.5px; }
.bb-remove-row { color: var(--bb-danger); cursor: pointer; }

/* ---------------- Print view --------------------------------------------- */
.bb-print-sheet {
    background: #fff;
    max-width: 800px;
    margin: 20px auto;
    padding: 40px;
    border-radius: var(--bb-card-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
@media print {
    .bb-no-print { display: none !important; }
    .bb-print-sheet { box-shadow: none; margin: 0; max-width: 100%; }
    html, body { background: #fff; height: auto !important; overflow: visible !important; }
    .bb-sidebar, .bb-topbar { display: none !important; }
    .bb-shell, .bb-main { display: block !important; margin: 0 !important; height: auto !important; overflow: visible !important; }
    .bb-content { padding: 0 !important; }
}

/* ---------------- Misc ------------------------------------------------- */
.bb-empty-state { text-align: center; padding: 60px 20px; color: #9ca3af; }
.bb-empty-state .bi { font-size: 48px; color: #c7d2fe; margin-bottom: 12px; }
.bb-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--bb-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
}

/* ---------------- BlocBuzz "powered by" credit -------------------------- */
.bb-powered-by {
    text-align: center;
    font-size: 12.5px;
    color: #9ca3af;
    margin: 0;
}
.bb-blocbuzz-wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--bb-primary);
    text-decoration: none;
    letter-spacing: .01em;
}
.bb-blocbuzz-wordmark:hover { color: var(--bb-primary-dark); text-decoration: underline; }
