/* Digital-Bee Billing — Indigo Dark Theme */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a237e;
    --sidebar-text: rgba(255, 255, 255, 0.75);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --body-bg: #f4f6fb;
    --card-bg: #ffffff;
    --card-radius: 10px;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --btn-primary: #1a237e;
    --btn-primary-hover: #3949ab;
    --table-header-bg: #f8f9ff;
    --table-hover-bg: #f0f4ff;
    --input-editable-bg: #fffde7;
    --input-editable-border: #fbc02d;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-base: 0.9rem;
    --input-radius: 6px;
    --focus-ring: rgba(57, 73, 171, 0.15);
    --topbar-height: 56px;
}

/* Base */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: var(--body-bg);
    margin: 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
    padding: 0.75rem 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-section {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid #e8eaf6;
}

.content-header h4 {
    font-weight: 600;
    font-size: 1.1rem;
}

.breadcrumb {
    font-size: 0.8rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

/* Tables */
.table thead th {
    background: var(--table-header-bg);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #555;
    border-bottom: 1px solid #e0e4f0;
    padding: 0.75rem 1rem;
}

.table tbody tr:hover {
    background: var(--table-hover-bg);
}

.table tbody td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
}

/* Buttons */
.btn-primary {
    background: var(--btn-primary);
    border-color: var(--btn-primary);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
}

/* Inputs */
.form-control, .form-select {
    border-radius: var(--input-radius);
    font-size: var(--font-size-base);
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px var(--focus-ring);
    border-color: #3949ab;
}

.form-control.editable {
    background: var(--input-editable-bg);
    border-color: var(--input-editable-border);
}

/* Badges */
.badge-active { background: #c8e6c9; color: #2e7d32; }
.badge-inactive { background: #e0e0e0; color: #616161; }
.badge-pending { background: #fff9c4; color: #f57f17; }
.badge-trial { background: #e3f2fd; color: #1565c0; }

/* KPI Cards */
.kpi-card {
    border-radius: var(--card-radius);
    padding: 1.25rem;
    color: #fff;
}
.kpi-card.blue { background: linear-gradient(135deg, #1565c0, #1e88e5); }
.kpi-card.green { background: linear-gradient(135deg, #2e7d32, #43a047); }
.kpi-card.orange { background: linear-gradient(135deg, #e65100, #fb8c00); }
.kpi-card.purple { background: linear-gradient(135deg, #6a1b9a, #8e24aa); }

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.kpi-card .kpi-label {
    font-size: 0.8rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Mobile Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1050;
}

.topbar-brand {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

/* Auth Pages */
.auth-body {
    background: var(--body-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 2.5rem 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--btn-primary);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-logo i {
    font-size: 1.75rem;
}

/* Alert Banner */
.alert-banner {
    border-radius: 0;
    font-size: 0.85rem;
    padding: 0.5rem 1.5rem;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar.show ~ .sidebar-backdrop {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: var(--topbar-height);
    }
}

@media (min-width: 992px) {
    .topbar {
        display: none !important;
    }
}

/* Utility */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   New SaaS Billing — project-centric additions
   ============================================================ */

/* Status badges (projects) */
.badge-status { font-size: 0.72rem; padding: 0.3em 0.6em; border-radius: 6px; font-weight: 600; }
.status-enquiry   { background: #e3f2fd; color: #1565c0; }   /* enquiry — blue */
.status-active    { background: #ffe0b2; color: #e65100; }   /* active — orange */
.status-completed { background: #c8e6c9; color: #2e7d32; }   /* completed — green */
.status-onhold    { background: #ede7f6; color: #5e35b1; }   /* on hold — purple/grey */
.status-cancelled { background: #f8d7da; color: #c62828; }   /* cancelled — red */

/* Calendar */
.cal-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 6px; }
.cal-table th { text-align: center; font-size: 0.72rem; text-transform: uppercase; color: #64748b; padding: 6px 0; }
.cal-cell {
    background: #fff; border: 1px solid #e8eaf6; border-radius: 8px; min-height: 90px;
    height: 90px; vertical-align: top; padding: 6px; cursor: pointer; transition: box-shadow .15s;
    position: relative;
}
.cal-cell:hover { box-shadow: 0 4px 14px rgba(26,35,126,0.12); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.today { border: 2px solid #1a237e; }
.cal-date { font-size: 0.8rem; font-weight: 600; color: #334155; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-dark-green  { background: #1b5e20; }   /* multiple scheduled */
.dot-light-green { background: #66bb6a; }   /* single project */
.dot-amber       { background: #f9a825; }   /* enquiry */
.dot-red         { background: #d32f2f; }   /* cancelled */

.cal-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.8rem; color: #475569; }
.cal-legend .cal-dot { margin-right: 6px; vertical-align: middle; }

/* QR code preview */
.qr-box { text-align: center; padding: 1rem; border: 1px dashed #cbd5e1; border-radius: 10px; background: #fafafa; }
.qr-box img, .qr-box svg { max-width: 180px; height: auto; }

/* Repeatable line rows */
.line-row { background: #f8f9ff; border-radius: 8px; padding: 0.75rem; margin-bottom: 0.5rem; }

/* KPI small card (dashboard grid) */
.kpi-mini { background:#fff; border-radius:10px; padding:1rem 1.1rem; box-shadow: var(--card-shadow); height:100%; }
.kpi-mini .lbl { font-size:0.72rem; text-transform:uppercase; letter-spacing:.03em; color:#64748b; font-weight:600; }
.kpi-mini .val { font-size:1.5rem; font-weight:700; color:#1a237e; margin-top:.25rem; }
.kpi-mini .val.money { color:#2e7d32; }
.kpi-mini .val.expense { color:#c62828; }

/* Invoice/estimate print */
@media print {
    .sidebar, .topbar, .content-header, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding-top: 0 !important; }
}

/* Sidebar brand logo — clean white chip so the dark logo shows correctly */
.sidebar-brand .brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
}
.sidebar-brand .brand-chip img { display: block; }

/* Faded logo watermark on on-screen invoice/estimate documents */
.doc-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
    text-align: center;
}
.doc-watermark img { width: 100%; }
