/*
 * Laika Bill Manager — admin / bootstrap
 * Author: Showket Ahmed
 *
 * A thin layer over Bootstrap 5 for the admin panel. Bootstrap ships the grid,
 * forms and utilities; everything here is the shell (sidebar, topbar), the
 * surfaces (cards, tables) and the pieces Bootstrap has no opinion about
 * (status pills, the donut chart).
 *
 * A full copy of the client area's sheet today, and free to diverge: the two
 * templates are chosen by separate options and share nothing.
 *
 * This file lives inside the template it belongs to, at
 * template/<area>/<name>/assets/, and is linked from that template's own
 * partials/header.twig. A template is one directory: copy it to install it,
 * delete it to remove it, and nothing of it is left anywhere else.
 */

:root {
    --lbm-primary:        #0f4c81;
    --lbm-primary-light:  #1a6fb5;
    --lbm-primary-dark:   #0a3a63;
    --lbm-accent:         #f5a623;
    --lbm-success:        #00c896;
    --lbm-danger:         #e84545;
    --lbm-dark:           #000000;

    --lbm-bg:             #f0f4f9;
    --lbm-card-bg:        #ffffff;
    --lbm-sidebar-bg:     #0a2e50;
    --lbm-sidebar-text:   #a8c4e0;
    --lbm-sidebar-active: #ffffff;

    --lbm-text:           #1a2b3c;
    --lbm-text-muted:     #6b85a0;
    --lbm-border:         #dce8f5;

    --lbm-shadow:         0 4px 24px rgba(15, 76, 129, .08);
    --lbm-shadow-lg:      0 12px 40px rgba(15, 76, 129, .16);
    --lbm-radius:         .625rem;
    --lbm-sidebar-width:  260px;
    --lbm-topbar-height:  62px;
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
    background: var(--lbm-bg);
    color: var(--lbm-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .9375rem;
    min-height: 100vh;
}

a { color: var(--lbm-primary); text-decoration: none; }
a:hover { color: var(--lbm-primary-light); }

.text-muted { color: var(--lbm-text-muted) !important; }

/* Bootstrap's .btn-primary, repainted to the product palette. */
.btn-primary {
    --bs-btn-bg: var(--lbm-primary);
    --bs-btn-border-color: var(--lbm-primary);
    --bs-btn-hover-bg: var(--lbm-primary-light);
    --bs-btn-hover-border-color: var(--lbm-primary-light);
    --bs-btn-active-bg: var(--lbm-primary-dark);
    --bs-btn-active-border-color: var(--lbm-primary-dark);
    --bs-btn-disabled-bg: var(--lbm-primary);
    --bs-btn-disabled-border-color: var(--lbm-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--lbm-primary);
    --bs-btn-border-color: var(--lbm-primary);
    --bs-btn-hover-bg: var(--lbm-primary);
    --bs-btn-hover-border-color: var(--lbm-primary);
    --bs-btn-active-bg: var(--lbm-primary);
    --bs-btn-active-border-color: var(--lbm-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--lbm-primary-light);
    box-shadow: 0 0 0 .2rem rgba(26, 111, 181, .15);
}

/* ==========================================================================
   Text color
   ========================================================================== */
.text-primary {
    color: var(--lbm-primary)!important;
}
.text-primary-light {
    color: var(--lbm-primary-light)!important;
}
.text-primary-dark {
    color: var(--lbm-primary-dark)!important;
}
.text-accent {
    color: var(--lbm-accent)!important;
}
.text-success {
    color: var(--lbm-success)!important;
}
.text-danger {
    color: var(--lbm-danger)!important;
}
.text-default {
    color: var(--lbm-text)!important;
}
.text-muted {
    color: var(--lbm-text-muted)!important;
}
.text-dark {
    color: var(--lbm-dark)!important;
}

/* ==========================================================================
   Shell — sidebar + topbar
   ========================================================================== */

.lbm-shell { min-height: 100vh; }

.lbm-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--lbm-sidebar-width);
    background: var(--lbm-sidebar-bg);
    color: var(--lbm-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
    overflow-y: auto;
}

.lbm-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    height: var(--lbm-topbar-height);
    padding: 0 1.25rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: .01em;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.lbm-sidebar__brand:hover { color: #fff; text-decoration: none; }

.lbm-sidebar__mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--lbm-primary-light), var(--lbm-accent));
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.lbm-sidebar__mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

.lbm-sidebar__nav { padding: .875rem 0 1.5rem; flex: 1 1 auto; }

.lbm-sidebar__label {
    padding: 1rem 1.25rem .375rem;
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(168, 196, 224, .55);
    font-weight: 600;
}

.lbm-sidebar__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5625rem 1.25rem;
    color: var(--lbm-sidebar-text);
    font-size: .875rem;
    border-left: 3px solid transparent;
}

.lbm-sidebar__link:hover {
    background: rgba(255, 255, 255, .05);
    color: var(--lbm-sidebar-active);
    text-decoration: none;
}

.lbm-sidebar__link.is-active {
    background: rgba(255, 255, 255, .08);
    color: var(--lbm-sidebar-active);
    border-left-color: var(--lbm-accent);
    font-weight: 600;
}

.lbm-sidebar__link i { width: 1.125rem; text-align: center; font-size: 1rem; }

.lbm-main {
    margin-left: var(--lbm-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.lbm-topbar {
    height: var(--lbm-topbar-height);
    background: var(--lbm-card-bg);
    border-bottom: 1px solid var(--lbm-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.lbm-content { padding: 1.5rem 1.25rem 3rem; flex: 1 1 auto; }

.lbm-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--lbm-border);
    background: #fff;
    color: var(--lbm-text-muted);
    display: grid;
    place-items: center;
}

.lbm-icon-btn:hover { color: var(--lbm-primary); border-color: var(--lbm-primary-light); text-decoration: none; }

.lbm-sidebar__toggle { display: none; }

@media (max-width: 991.98px) {
    .lbm-sidebar { transform: translateX(-100%); }
    .lbm-sidebar.is-open { transform: translateX(0); box-shadow: var(--lbm-shadow-lg); }
    .lbm-main { margin-left: 0; }
    .lbm-sidebar__toggle { display: grid; }
    .lbm-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(10, 46, 80, .45);
        z-index: 1035;
    }
}

/* ==========================================================================
   Surfaces
   ========================================================================== */

.lbm-card {
    background: var(--lbm-card-bg);
    border: 1px solid var(--lbm-border);
    border-radius: var(--lbm-radius);
    box-shadow: var(--lbm-shadow);
}

.lbm-card__head {
    padding: .875rem 1.125rem;
    border-bottom: 1px solid var(--lbm-border);
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.lbm-card__title { font-size: .9375rem; font-weight: 700; margin: 0; }
.lbm-card__body { padding: 1.125rem; }
.lbm-card__foot { padding: .75rem 1.125rem; border-top: 1px solid var(--lbm-border); }

.lbm-page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* Stat tiles */
.lbm-stat { display: flex; align-items: center; gap: .875rem; padding: 1.125rem; }
.lbm-stat__icon {
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: #fff;
    flex: 0 0 auto;
    color: var(--lbm-primary)
}
.lbm-stat__value { font-size: 1.375rem; font-weight: 700; line-height: 1.15; }
.lbm-stat__label { font-size: .75rem; color: var(--lbm-text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ==========================================================================
   Tables
   ========================================================================== */

.lbm-table {
    margin: 0;
    width:100%;
}
.lbm-table > :not(caption) > * > * { padding: .75rem 1.125rem; }

.lbm-table thead th {
    background: #f7fafd;
    border-bottom: 1px solid var(--lbm-border);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--lbm-text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.lbm-table tbody tr:hover { background: #f7fafd; }
.lbm-table td { vertical-align: middle; border-bottom: 1px solid var(--lbm-border); }
.lbm-table tbody tr:last-child td { border-bottom: 0; }

/* A wide table scrolls inside its own card rather than the page. */
.lbm-table-wrap { overflow-x: auto; }

/* ==========================================================================
   Status pills — colours come from the *_color column, never from CSS
   ========================================================================== */

.lbm-pill {
    display: inline-block;
    padding: .1875rem .5625rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.45;
    white-space: nowrap;
}

/* ==========================================================================
   Empty states
   ========================================================================== */

.lbm-empty { padding: 3rem 1.25rem; text-align: center; color: var(--lbm-text-muted); }
.lbm-empty i { font-size: 2.5rem; opacity: .35; display: block; margin-bottom: .75rem; }

/* ==========================================================================
   Auth + install — centred card on a tinted ground
   ========================================================================== */

.lbm-centre {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, var(--lbm-sidebar-bg), var(--lbm-primary) 60%, var(--lbm-primary-light));
}

.lbm-centre__card {
    width: 100%;
    max-width: 27rem;
    background: var(--lbm-card-bg);
    border-radius: var(--lbm-radius);
    box-shadow: var(--lbm-shadow-lg);
    overflow: hidden;
}

.lbm-centre__card--wide { max-width: 48rem; }

.lbm-centre__head { padding: 1.75rem 1.75rem 0; text-align: center; }
.lbm-centre__body { padding: 1.5rem 1.75rem 1.75rem; }

.lbm-brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--lbm-primary), var(--lbm-accent));
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.5rem;
    margin: 0 auto .875rem;
}

.lbm-brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

/* Wizard step rail */
.lbm-steps {
    display: flex;
    gap: .25rem;
    padding: 1.125rem 1.75rem;
    border-bottom: 1px solid var(--lbm-border);
    background: #f7fafd;
    flex-wrap: wrap;
}

.lbm-step { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--lbm-text-muted); }
.lbm-step + .lbm-step { margin-left: .25rem; }

.lbm-step__no {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 700;
    background: #e4edf7;
    color: var(--lbm-text-muted);
    flex: 0 0 auto;
}

.lbm-step.is-current { color: var(--lbm-primary); font-weight: 600; }
.lbm-step.is-current .lbm-step__no { background: var(--lbm-primary); color: #fff; }
.lbm-step.is-done .lbm-step__no { background: var(--lbm-success); color: #fff; }

.lbm-step__sep { color: var(--lbm-border); align-self: center; }

/* Requirement rows */
.lbm-req { display: flex; align-items: center; gap: .75rem; padding: .5625rem 0; border-bottom: 1px solid var(--lbm-border); }
.lbm-req:last-child { border-bottom: 0; }
.lbm-req__name { flex: 1 1 auto; }
.lbm-req__state { font-size: .8125rem; font-weight: 600; }
.lbm-req--ok .lbm-req__state { color: var(--lbm-success); }
.lbm-req--fail .lbm-req__state { color: var(--lbm-danger); }

/* ==========================================================================
   Status legend
   ========================================================================== */

.lbm-legend { display: flex; flex-direction: column; gap: .5rem; }
.lbm-legend__item { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; }
.lbm-legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }

/* ==========================================================================
   Print — invoices
   ========================================================================== */

@media print {
    .lbm-sidebar, .lbm-topbar, .lbm-no-print { display: none !important; }
    .lbm-main { margin-left: 0; }
    .lbm-content { padding: 0; }
    .lbm-card { border: 0; box-shadow: none; }
    body { background: #fff; }
}
