/* ============================================================
   Vensha Fuel EOD — shared UI layer (Bootstrap 4.6 add-on)
   Keeps the existing navy theme; adds responsiveness, polish
   and "smart" interactive affordances across every page.
   ============================================================ */

:root {
    --navy: #1b2a4a;
    --navy-2: #24345c;
    --accent: #4a90d9;
    --accent-d: #2f6fb0;
    --bg: #f5f7fa;
    --card-shadow: 0 2px 10px rgba(27, 42, 74, .08);
    --card-shadow-h: 0 6px 22px rgba(27, 42, 74, .14);
    --radius: 10px;
    --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: var(--bg);
    background-image: radial-gradient(1200px 600px at 100% -10%, rgba(74,144,217,.10), transparent 60%),
                      radial-gradient(900px 500px at -10% 110%, rgba(122,111,240,.08), transparent 55%);
    background-attachment: fixed;
    color: #2a3242;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, #16233e 100%);
    min-height: 100vh; padding: 18px 0; position: fixed; left: 0; top: 0;
    width: var(--sidebar-w); z-index: 1040; overflow-y: auto;
    transition: transform .28s ease;
}
.sidebar .brand { color: #fff; font-size: 17px; font-weight: 700; padding: 0 22px 16px; display: flex; align-items: center; gap: 10px; }
.sidebar .brand i { color: var(--accent); }
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: rgba(255,255,255,.55); }
.sidebar a {
    color: #cdd6e4; padding: 12px 22px; display: flex; align-items: center; gap: 12px;
    text-decoration: none; border-left: 4px solid transparent; font-size: 14px; transition: all .15s;
}
.sidebar a .fa-fw { width: 18px; text-align: center; }
.sidebar a:hover { background: var(--navy-2); color: #fff; }
.sidebar a.active { background: var(--navy-2); border-left-color: var(--accent); color: #fff; font-weight: 600; }
.sidebar hr { border-color: rgba(255,255,255,.12); margin: 10px 16px; }
.sidebar .userbox { padding: 12px 22px; color: #9fb0cc; font-size: 12px; }

/* ---------- Topbar (mobile + desktop) ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1030; background: #fff;
    border-bottom: 1px solid #e6eaf1; padding: 12px 28px;
    display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar .page-title { font-size: 18px; font-weight: 700; color: var(--navy); margin: 0; }
.topbar .spacer { flex: 1; }
.topbar .topbar-user { font-size: 13px; color: #6b7689; white-space: nowrap; }
.topbar .topbar-user strong { color: var(--navy); }
.menu-toggle {
    display: none; background: var(--navy); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 8px; font-size: 18px; cursor: pointer; flex: 0 0 auto;
}

/* ---------- Content ---------- */
.content { margin-left: var(--sidebar-w); min-height: 100vh; }
.content-inner { padding: 24px 28px 80px; }
.content h3 { color: var(--navy); font-weight: 700; }

/* sidebar backdrop on mobile */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5);
    z-index: 1035; opacity: 0; transition: opacity .25s;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* ---------- Cards ---------- */
.card { margin-bottom: 20px; box-shadow: var(--card-shadow); border: none; border-radius: var(--radius); transition: box-shadow .2s, transform .2s; }
.card h5, .card h6 { color: var(--navy); font-weight: 700; }
.card h5 { margin-bottom: 14px; }

/* Stat cards */
.stat-card { display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; }
.stat-card::after { /* radiant glow blob */
    content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
    border-radius: 50%; background: radial-gradient(circle, rgba(74,144,217,.16), transparent 70%); pointer-events: none;
}
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 14px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    box-shadow: 0 6px 16px rgba(74,144,217,.35);
}
.stat-card .stat-num { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1.1; letter-spacing: -.02em; }
.stat-card .stat-label { color: #8a93a6; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-card.hoverable:hover { box-shadow: var(--card-shadow-h); transform: translateY(-3px); }
.stat-icon.tone-green { background: linear-gradient(135deg, #36b37e, #2a9269); box-shadow: 0 6px 16px rgba(54,179,126,.35); }
.stat-icon.tone-amber { background: linear-gradient(135deg, #f0a429, #d98a17); box-shadow: 0 6px 16px rgba(240,164,41,.35); }
.stat-icon.tone-purple { background: linear-gradient(135deg, #7a6ff0, #5a4fd0); box-shadow: 0 6px 16px rgba(122,111,240,.35); }
.stat-icon.tone-red { background: linear-gradient(135deg, #ff6b6b, #e03131); box-shadow: 0 6px 16px rgba(224,49,49,.35); }

/* ---------- Dashboard hero greeting ---------- */
.hero {
    border-radius: 16px; padding: 26px 28px; margin-bottom: 22px; color: #fff; position: relative; overflow: hidden;
    background: linear-gradient(120deg, var(--navy) 0%, #2b4d80 55%, var(--accent) 130%);
    box-shadow: 0 12px 30px rgba(27,42,74,.30);
}
.hero::before { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); }
.hero::after { content: ''; position: absolute; right: 90px; bottom: -90px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%); }
.hero h2 { font-weight: 800; font-size: 24px; margin: 0 0 4px; }
.hero p { margin: 0; color: rgba(255,255,255,.78); font-size: 14px; }
.hero .hero-meta { position: relative; z-index: 1; }
.hero .hero-clock { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- Section heading ---------- */
.section-title { color: var(--navy); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; }
.section-title i { color: var(--accent); }

/* ---------- Recent activity list ---------- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef1f6; }
.activity li:last-child { border-bottom: none; }
.activity .av-icon { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: #eef4fb; color: var(--accent-d); font-size: 15px; }
.activity .av-main { flex: 1; min-width: 0; }
.activity .av-title { font-weight: 600; color: var(--navy); font-size: 14px; }
.activity .av-sub { color: #8a93a6; font-size: 12px; }
.activity .av-amt { font-weight: 700; color: var(--navy); white-space: nowrap; }

/* alert pill list */
.alert-pill { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #fff6f6; border: 1px solid #ffd8d8; color: #b42318; font-size: 14px; margin-bottom: 10px; }
.alert-pill.ok { background: #f0fbf5; border-color: #c6efd6; color: #1c7a48; }
.alert-pill i { font-size: 16px; }

/* chart card body height */
.chart-wrap { position: relative; height: 280px; }

/* Quick-action tiles */
.quick-tile {
    display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius);
    background: #fff; box-shadow: var(--card-shadow); color: var(--navy); text-decoration: none;
    transition: all .18s; height: 100%;
}
.quick-tile:hover { box-shadow: var(--card-shadow-h); transform: translateY(-2px); color: var(--accent-d); text-decoration: none; }
.quick-tile i { font-size: 22px; color: var(--accent); }

/* ---------- Forms ---------- */
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 .15rem rgba(74,144,217,.2); }
label { font-weight: 600; font-size: 13px; color: #4a5468; margin-bottom: 4px; }
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-d); border-color: var(--accent-d); }
.btn i { margin-right: 0; }
.btn .fas + span, .btn i + span { margin-left: 6px; }

/* Sticky form action bar */
.form-actionbar {
    position: sticky; bottom: 0; z-index: 1020; background: rgba(255,255,255,.96);
    backdrop-filter: blur(4px); border-top: 1px solid #e6eaf1;
    padding: 12px 28px; margin: 0 -28px -80px; display: flex; gap: 10px; align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}

/* ---------- Tables ---------- */
.table thead th { border-top: none; border-bottom: 2px solid #e6eaf1; color: #6b7689; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.table-hover tbody tr { transition: background .12s; }
.table-hover tbody tr:hover { background: #f0f5fb; }
.table tfoot th { border-top: 2px solid #e6eaf1; color: var(--navy); }
tr.row-link { cursor: pointer; }

/* numeric cells line up nicely */
input[type=number].form-control { text-align: right; }

/* difference / variance highlight */
.cell-flag-bad { background: #fff1f0 !important; color: #cf1322; font-weight: 600; }
.cell-flag-ok { color: #2a9269; }

/* status badges a touch larger */
.badge { font-size: 11px; padding: 5px 9px; border-radius: 6px; font-weight: 600; }

/* table search box */
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.table-tools .search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.table-tools .search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9aa3b2; }
.table-tools .search-wrap input { padding-left: 34px; }

/* attachment thumbnails */
.attach-thumb { height: 90px; border: 1px solid #e0e4ec; border-radius: 8px; object-fit: cover; transition: transform .15s; }
.attach-thumb:hover { transform: scale(1.04); }
.preview-grid { display: flex; flex-wrap: wrap; gap: 10px; }

/* flash alerts float-in */
.alert { border: none; border-radius: 8px; box-shadow: var(--card-shadow); }

/* ---------- Auth pages (login / change password) ---------- */
.auth-body { background: linear-gradient(135deg, var(--navy) 0%, #24557a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; padding: 38px; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.28); max-width: 410px; width: 100%; }
.auth-card .brand-mark { text-align: center; margin-bottom: 18px; }
.auth-card .brand-mark .logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-d)); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; }
.auth-card h2 { color: var(--navy); text-align: center; margin-bottom: 4px; font-weight: 700; font-size: 22px; }
.auth-card .sub { text-align: center; color: #8a93a6; font-size: 13px; margin-bottom: 24px; }
.pw-field { position: relative; }
.pw-toggle { position: absolute; right: 12px; top: 38px; cursor: pointer; color: #9aa3b2; background: none; border: none; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); width: 270px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
}
@media (max-width: 768px) {
    .content-inner { padding: 16px 14px 80px; }
    .topbar { padding: 10px 14px; }
    .topbar .topbar-user { display: none; }
    .form-actionbar { margin: 0 -14px -80px; padding: 10px 14px; flex-wrap: wrap; }
    /* wide tables scroll horizontally instead of breaking layout */
    .table-scroll { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* safety net: any card data-table scrolls on small screens (covers admin pages) */
    .content-inner table.table:not(.no-scroll) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card { border-radius: 8px; }
}

/* keep print clean (eod/print.php has its own styles, this is a safety net) */
@media print {
    .sidebar, .topbar, .menu-toggle, .form-actionbar, .sidebar-backdrop { display: none !important; }
    .content { margin-left: 0; }
}

.content-inner.is-loading { opacity: .55; pointer-events: none; transition: opacity .12s ease; }

