/* =============================================================================
   AquaFlow — UI styles. Builds on Bootstrap 5 with a custom sidebar shell.
   ============================================================================= */
:root {
    --aqua:        #0ea5e9;
    --aqua-dark:   #0369a1;
    --aqua-deep:   #075985;
    --ink:         #0f172a;
    --muted:       #64748b;
    --bg:          #f1f5f9;
    --sidebar-w:   250px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---- Shell ---------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--aqua-deep), var(--aqua-dark));
    color: #e2f2fb;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
}
.brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.2rem 1.25rem;
    font-size: 1.25rem; font-weight: 700; letter-spacing: .3px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand i { color: #7dd3fc; }

.sidebar .nav { padding: .75rem .5rem; gap: 2px; flex: 1; }
.sidebar .nav-link {
    display: flex; align-items: center; gap: .75rem;
    color: #cfe9f7; border-radius: 10px;
    padding: .6rem .85rem; font-weight: 500; font-size: .95rem;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--aqua-deep); font-weight: 600; }

.sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: .75rem; }
.mini-tank {
    width: 26px; height: 52px; border: 2px solid #7dd3fc; border-radius: 5px;
    position: relative; overflow: hidden; background: rgba(255,255,255,.08); flex: none;
}
.mini-tank-fill { position: absolute; bottom: 0; width: 100%; background: #38bdf8; transition: height .4s; }
.mini-tank.low .mini-tank-fill { background: #f59e0b; }
.sidebar-foot small { color: #cfe9f7; line-height: 1.3; }

/* ---- Main ----------------------------------------------------------------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: #fff; padding: .85rem 1.5rem;
    border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 1020;
}
.page-title { font-size: 1.3rem; margin: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; }
.content { padding: 1.5rem; flex: 1; }
.app-foot { padding: 1rem 1.5rem; color: var(--muted); font-size: .85rem; border-top: 1px solid #e2e8f0; }

/* ---- Dashboard cards ------------------------------------------------------ */
.stat-card {
    background: #fff; border-radius: 14px; padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.06); border: 1px solid #eef2f6;
    display: flex; align-items: center; gap: 1rem; height: 100%;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 1.35rem; color: #fff;
}
.stat-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.bg-aqua   { background: var(--aqua); }
.bg-green  { background: #16a34a; }
.bg-amber  { background: #f59e0b; }
.bg-violet { background: #7c3aed; }
.bg-rose   { background: #e11d48; }

.card { border-radius: 14px; border: 1px solid #eef2f6; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.card-header { background: #fff; border-bottom: 1px solid #eef2f6; font-weight: 600; }

/* ---- Big water tank widget ------------------------------------------------ */
.tank-widget { display: flex; align-items: center; gap: 1.5rem; }
.tank {
    width: 110px; height: 180px; border: 4px solid var(--aqua-dark); border-radius: 12px;
    position: relative; overflow: hidden; background: #eaf6fd; flex: none;
}
.tank-fill {
    position: absolute; bottom: 0; width: 100%;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    transition: height .6s ease;
}
.tank.low .tank-fill { background: linear-gradient(180deg, #fbbf24, #d97706); }
.tank-pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; color: #07314a; }

/* ---- Status badges -------------------------------------------------------- */
.status { padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status-Pending     { background: #fef3c7; color: #92400e; }
.status-In-Progress { background: #dbeafe; color: #1e40af; }
.status-Delivered   { background: #e0e7ff; color: #3730a3; }
.status-Paid        { background: #dcfce7; color: #166534; }

table td, table th { vertical-align: middle; }

/* ---- Mobile --------------------------------------------------------------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}

/* ---- Print (receipts, manifests) ------------------------------------------ */
@media print {
    .sidebar, .topbar, .app-foot, .no-print { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    body { background: #fff; }
}
