/* Fleet Maintenance System - Clean, minimal theme
   Inspired by modern dashboard SaaS UIs: white surfaces,
   hairline borders, a single restrained blue accent,
   pastel-tinted icon containers, and Inter typography. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Brand navy palette, sampled from the Fleet Maintenance
       Service logo (dark gear ~#1e3a5f, light gear ~#3f5f8c). */
    --fms-primary:        #1e3a5f;
    --fms-primary-hover:  #15283f;
    --fms-primary-2:      #3f5f8c;
    --fms-primary-soft:   #eaf0f8;
    --fms-primary-soft-2: #d6e0ee;

    --fms-text:           #0f172a;
    --fms-text-muted:     #5b6b80;
    --fms-text-soft:      #94a3b8;
    --fms-bg:             #f5f7fa;
    --fms-surface:        #ffffff;
    --fms-border:         #e2e6ec;
    --fms-border-strong:  #cdd3dc;

    /* Stat-card tints — desaturated to harmonize with the
       navy primary (slightly cooler / more professional). */
    --fms-tint-blue:    #eaf0f8;
    --fms-tint-green:   #e6f4ec;
    --fms-tint-amber:   #fbf2dc;
    --fms-tint-red:     #f8e3e3;
    --fms-tint-purple:  #ece7f5;
    --fms-tint-slate:   #eef1f5;

    --fms-icon-blue:    #1e3a5f;
    --fms-icon-green:   #1f8a5f;
    --fms-icon-amber:   #b07a1c;
    --fms-icon-red:     #b53034;
    --fms-icon-purple:  #5b4ba0;

    --fms-radius:       10px;
    --fms-radius-sm:    8px;
}

/* ---------- Base ---------- */
html, body {
    height: 100%;
}
body {
    background: var(--fms-bg);
    color: var(--fms-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--fms-text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a { color: var(--fms-primary); }
a:hover { color: var(--fms-primary-hover); }

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

/* ---------- App shell (sidebar + topbar + main) ---------- */
:root {
    --fms-sidebar-w: 240px;
    --fms-topbar-h: 56px;
}

.fms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--fms-sidebar-w);
    background: var(--fms-surface);
    border-right: 1px solid var(--fms-border);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform 0.2s ease;
}
.fms-shell {
    margin-left: var(--fms-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.fms-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--fms-topbar-h);
    background: var(--fms-surface);
    border-bottom: 1px solid var(--fms-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
}
.fms-topbar .topbar-spacer { flex: 1; }
.fms-topbar .topbar-user {
    color: var(--fms-text) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
}
.fms-topbar .topbar-user:hover {
    background: var(--fms-tint-slate);
}
.fms-topbar .dropdown-menu {
    border: 1px solid var(--fms-border);
    border-radius: var(--fms-radius);
    box-shadow: 0 10px 25px -5px rgb(15 23 42 / 8%);
    padding: 0.375rem;
    min-width: 200px;
}
.fms-topbar .dropdown-item {
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.45rem 0.65rem;
}
.fms-topbar .dropdown-item:hover { background: var(--fms-tint-slate); }

.fms-main {
    flex: 1;
    padding: 1.5rem 1.5rem 2rem;
    max-width: 1320px;
    width: 100%;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 35%);
    z-index: 1025;
}
.sidebar-overlay.show {
    display: block;
}

/* ---------- Sidebar internals ---------- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--fms-text) !important;
    border-bottom: 1px solid var(--fms-border);
}
.sidebar-brand .brand-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    object-position: center;
}
.sidebar-brand .brand-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
}
.sidebar-brand .brand-text-top {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--fms-primary);
    letter-spacing: -0.01em;
}
.sidebar-brand .brand-text-bot {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--fms-text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem 0.75rem;
}
.sidebar-section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fms-text-soft);
    font-weight: 600;
    padding: 0.85rem 0.85rem 0.4rem;
}
.sidebar-items {
    list-style: none;
    padding: 0;
    margin: 0 0 0.25rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.85rem;
    margin: 1px 0;
    border-radius: 8px;
    color: var(--fms-text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    line-height: 1.2;
}
.sidebar-link i {
    width: 18px;
    text-align: center;
    color: var(--fms-text-soft);
    font-size: 14px;
}
.sidebar-link:hover {
    background: var(--fms-tint-slate);
    color: var(--fms-text);
}
.sidebar-link:hover i { color: var(--fms-text); }
.sidebar-link.active {
    background: var(--fms-primary-soft);
    color: var(--fms-primary);
}
.sidebar-link.active i { color: var(--fms-primary); }

.sidebar-footer {
    border-top: 1px solid var(--fms-border);
    padding: 0.75rem 1rem;
    color: var(--fms-text-soft);
    text-align: center;
}

/* ---------- Mobile: sidebar becomes a drawer ---------- */
@media (max-width: 991.98px) {
    .fms-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 10px 25px -5px rgb(15 23 42 / 18%);
    }
    .fms-sidebar.show {
        transform: translateX(0);
    }
    .fms-shell {
        margin-left: 0;
    }
}

/* ---------- Cards ---------- */
.card {
    background: var(--fms-surface);
    border: 1px solid var(--fms-border);
    border-radius: var(--fms-radius);
    box-shadow: none;
}
.card-header {
    background: var(--fms-surface);
    border-bottom: 1px solid var(--fms-border);
    padding: 0.85rem 1.1rem;
    font-weight: 600;
}
.card-header h5,
.card-header h6 { margin-bottom: 0; font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 1.1rem; }
.card.shadow-sm { box-shadow: none !important; }

/* Replace the loud border-start accent with a soft tinted icon box */
.card.border-start { border-left: 1px solid var(--fms-border) !important; }

/* ---------- Stat Card (dashboard) ---------- */
.stat-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem;
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-icon.tint-blue   { background: var(--fms-tint-blue);   color: var(--fms-icon-blue); }
.stat-icon.tint-green  { background: var(--fms-tint-green);  color: var(--fms-icon-green); }
.stat-icon.tint-amber  { background: var(--fms-tint-amber);  color: var(--fms-icon-amber); }
.stat-icon.tint-red    { background: var(--fms-tint-red);    color: var(--fms-icon-red); }
.stat-icon.tint-purple { background: var(--fms-tint-purple); color: var(--fms-icon-purple); }

.stat-card .stat-label {
    color: var(--fms-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-card .stat-value {
    color: var(--fms-text);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 2px;
}

/* ---------- Buttons ---------- */
.btn {
    font-weight: 500;
    border-radius: 8px;
    padding: 0.45rem 0.95rem;
    font-size: 0.875rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary {
    background: var(--fms-primary);
    border-color: var(--fms-primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--fms-primary-hover);
    border-color: var(--fms-primary-hover);
}
.btn-outline-primary {
    color: var(--fms-primary);
    border-color: var(--fms-border-strong);
    background: var(--fms-surface);
}
.btn-outline-primary:hover {
    background: var(--fms-primary-soft);
    color: var(--fms-primary);
    border-color: var(--fms-primary);
}
.btn-secondary,
.btn-light {
    background: var(--fms-surface);
    border-color: var(--fms-border-strong);
    color: var(--fms-text);
}
.btn-secondary:hover,
.btn-light:hover {
    background: var(--fms-tint-slate);
    color: var(--fms-text);
    border-color: var(--fms-border-strong);
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8125rem; }

/* ---------- Forms ---------- */
.form-control,
.form-select {
    border: 1px solid var(--fms-border-strong);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--fms-text);
    background: var(--fms-surface);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--fms-primary);
    box-shadow: 0 0 0 3px rgb(30 58 95 / 14%);
}
.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fms-text);
    margin-bottom: 0.35rem;
}
.input-group-text {
    background: var(--fms-tint-slate);
    border: 1px solid var(--fms-border-strong);
    color: var(--fms-text-muted);
    font-size: 0.875rem;
}

/* ---------- Tables ---------- */
.table {
    color: var(--fms-text);
    margin-bottom: 0;
}
.table thead.table-light th,
.table thead th {
    background: var(--fms-tint-slate);
    color: var(--fms-text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--fms-border);
    padding: 0.65rem 0.85rem;
}
.table tbody td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--fms-border);
    vertical-align: middle;
    font-size: 0.875rem;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover {
    background: var(--fms-tint-slate);
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.35em 0.6em;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.badge.bg-primary    { background: var(--fms-tint-blue)   !important; color: var(--fms-icon-blue); }
.badge.bg-success    { background: var(--fms-tint-green)  !important; color: var(--fms-icon-green); }
.badge.bg-info       { background: var(--fms-tint-blue)   !important; color: var(--fms-icon-blue); }
.badge.bg-warning    { background: var(--fms-tint-amber)  !important; color: var(--fms-icon-amber); }
.badge.bg-danger     { background: var(--fms-tint-red)    !important; color: var(--fms-icon-red); }
.badge.bg-secondary  { background: var(--fms-tint-slate)  !important; color: var(--fms-text-muted); }
.badge.bg-dark       { background: #111827 !important; color: #fff; }

/* ---------- Alerts ---------- */
.alert {
    border: 1px solid var(--fms-border);
    border-radius: var(--fms-radius);
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
}
.alert-success { background: var(--fms-tint-green);  border-color: #bbf7d0; color: #047857; }
.alert-danger  { background: var(--fms-tint-red);    border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: var(--fms-tint-amber);  border-color: #fde68a; color: #b45309; }
.alert-info    { background: var(--fms-tint-blue);   border-color: #c7d2fe; color: #1d4ed8; }

/* (Old top-navbar container override removed; sidebar layout
   now uses .fms-shell / .fms-main from the App shell section.) */

/* ---------- Auth screen ---------- */
.auth-shell {
    min-height: 100vh;
    background: var(--fms-bg);
}
.auth-card {
    background: var(--fms-surface);
    border: 1px solid var(--fms-border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}
.auth-brand {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--fms-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.auth-logo {
    width: 150px;
    height: auto;
    display: block;
    margin: 0 auto 1.25rem;
    object-fit: contain;
}

/* ---------- Utility helpers ---------- */
.text-tiny { font-size: 0.75rem; }
.section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--fms-text-soft);
    letter-spacing: 0.06em;
    font-weight: 600;
}
.divider {
    height: 1px;
    background: var(--fms-border);
    margin: 1rem 0;
}

/* Soft hover surface for clickable cards */
.card.card-hover {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card.card-hover:hover {
    border-color: var(--fms-border-strong);
    box-shadow: 0 1px 2px rgb(15 23 42 / 5%);
}
