/* ================================================================
   VRMS — light-blue & white theme (mobile-first, responsive)
   ================================================================ */

:root {
    --blue-50:  #eaf5fd;
    --blue-100: #d6ecfa;
    --blue-200: #b8def2;
    --blue-300: #8cc8e8;
    --blue-400: #5badd9;
    --blue-500: #3aa0dd;
    --blue-600: #2c7db8;
    --blue-700: #1f5c8a;
    --blue-800: #163d5c;
    --blue-900: #0d2538;

    --white:   #ffffff;
    --gray-50: #f6fafd;
    --gray-100:#eef4f8;
    --gray-200:#dde8f0;
    --gray-300:#c7d5e0;
    --gray-400:#9fb3c3;
    --gray-500:#6a7a8e;
    --gray-600:#4b6584;
    --gray-700:#334559;
    --gray-800:#1f2d3d;

    --green:  #1a9e63;
    --green-bg:#e6f7ee;
    --red:    #c0392b;
    --red-bg: #fdecea;
    --amber:  #c77a00;
    --amber-bg:#fff4e0;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(16,66,112,.08);
    --shadow: 0 4px 16px rgba(16,66,112,.08);
    --shadow-lg: 0 10px 40px rgba(16,66,112,.12);

    --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--blue-800); margin: 0 0 14px; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

hr { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

img { max-width: 100%; height: auto; }

/* ======== GUEST LAYOUT (login, register, etc.) ===================== */
.guest-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blue-100) 0%, var(--blue-200) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.guest-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 440px;
    padding: 32px 28px;
}
.guest-brand {
    text-align: center;
    margin-bottom: 24px;
}
.guest-brand .logo {
    display: inline-flex; width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-600));
    color: var(--white);
    border-radius: 14px;
    align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700;
    margin-bottom: 12px;
}
.guest-brand h1 { font-size: 20px; margin: 0; color: var(--blue-800); }
.guest-brand p  { margin: 4px 0 0; color: var(--gray-500); font-size: 13px; }

/* ======== APP LAYOUT ============================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--blue-800);
    color: rgba(255,255,255,.85);
    position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    overflow-y: auto; z-index: 40;
    transition: transform .25s;
}
.sidebar .brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .logo {
    width: 34px; height: 34px; border-radius: 8px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-500));
    color: var(--white); display: flex;
    align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
}
.sidebar .brand .name { color: var(--white); font-weight: 600; font-size: 15px; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav .section {
    text-transform: uppercase; font-size: 11px; letter-spacing: .06em;
    color: rgba(255,255,255,.4); padding: 14px 12px 6px;
}
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 6px;
    color: rgba(255,255,255,.8); text-decoration: none; font-size: 14px;
    margin-bottom: 2px;
}
.sidebar nav a:hover      { background: rgba(255,255,255,.07); color: var(--white); }
.sidebar nav a.active     { background: var(--blue-600); color: var(--white); }
.sidebar nav a .icon      { width: 18px; text-align: center; }
.sidebar .sidebar-footer  {
    padding: 12px 16px; font-size: 12px;
    color: rgba(255,255,255,.4);
    border-top: 1px solid rgba(255,255,255,.08);
}

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }

.topbar {
    height: 58px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 20;
}
.topbar .menu-toggle {
    display: none; border: none; background: none;
    font-size: 22px; color: var(--blue-800); cursor: pointer; padding: 6px 10px;
}
.topbar .user {
    display: flex; align-items: center; gap: 12px;
}
.topbar .user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--blue-500); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.topbar .user .dropdown { position: relative; }
.topbar .user .dropdown-menu {
    position: absolute; top: 42px; right: 0;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); box-shadow: var(--shadow);
    min-width: 180px; overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: .15s; z-index: 30;
}
.topbar .user .dropdown.open .dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.topbar .user .dropdown-menu a, .topbar .user .dropdown-menu button {
    display: block; width: 100%; padding: 10px 14px;
    text-align: left; background: none; border: none; font-size: 14px;
    color: var(--gray-700); cursor: pointer;
}
.topbar .user .dropdown-menu a:hover, .topbar .user .dropdown-menu button:hover {
    background: var(--blue-50); color: var(--blue-700);
}

.content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin: 0; }

/* ======== CARDS ==================================================== */
.card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); margin-bottom: 18px;
    border: 1px solid var(--gray-200);
}
.card-head {
    padding: 14px 18px; border-bottom: 1px solid var(--gray-100);
    display: flex; justify-content: space-between; align-items: center;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

/* ======== BUTTONS ================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; font-size: 14px; font-weight: 500;
    border-radius: var(--radius); border: 1px solid transparent;
    cursor: pointer; text-decoration: none; line-height: 1.2;
    background: var(--blue-500); color: var(--white);
    transition: background .15s, transform .05s;
}
.btn:hover   { background: var(--blue-600); color: var(--white); text-decoration: none; }
.btn:active  { transform: translateY(1px); }
.btn.secondary  { background: var(--gray-100); color: var(--gray-700); }
.btn.secondary:hover { background: var(--gray-200); color: var(--gray-800); }
.btn.outline    { background: transparent; color: var(--blue-600); border-color: var(--blue-300); }
.btn.outline:hover { background: var(--blue-50); color: var(--blue-700); }
.btn.danger     { background: var(--red); color: var(--white); }
.btn.danger:hover { background: #a02d20; }
.btn.success    { background: var(--green); color: var(--white); }
.btn.sm         { padding: 6px 10px; font-size: 13px; }
.btn.lg         { padding: 12px 20px; font-size: 15px; }
.btn.block      { width: 100%; }
.btn:disabled   { opacity: .55; cursor: not-allowed; }

/* ======== FORMS ==================================================== */
.form-group { margin-bottom: 16px; }
.form-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], input[type=search],
select, textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 14px; font-family: inherit; background: var(--white); color: var(--gray-800);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(58,160,221,.15);
}
textarea { resize: vertical; min-height: 88px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

.form-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding-top: 8px; border-top: 1px solid var(--gray-100);
    margin-top: 18px;
}

/* ======== TABLES =================================================== */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; background: var(--white);
    font-size: 14px;
}
table.data th, table.data td {
    padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
table.data thead th {
    background: var(--blue-50); color: var(--blue-800);
    font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--blue-100);
}
table.data tbody tr:hover { background: var(--blue-50); }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .btn.sm { margin-left: 4px; }

.table-empty {
    padding: 40px 20px; text-align: center; color: var(--gray-500);
}
.table-empty .emoji { font-size: 36px; margin-bottom: 8px; }

/* ======== BADGES =================================================== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em;
}
.badge.blue    { background: var(--blue-100); color: var(--blue-700); }
.badge.green   { background: var(--green-bg); color: var(--green); }
.badge.red     { background: var(--red-bg);   color: var(--red); }
.badge.amber   { background: var(--amber-bg); color: var(--amber); }
.badge.gray    { background: var(--gray-100); color: var(--gray-600); }

/* Status helpers */
.status-available    { background: var(--green-bg); color: var(--green); }
.status-rented       { background: var(--blue-100); color: var(--blue-700); }
.status-maintenance  { background: var(--amber-bg); color: var(--amber); }
.status-inactive     { background: var(--gray-100); color: var(--gray-600); }
.status-reserved     { background: var(--amber-bg); color: var(--amber); }
.status-ongoing      { background: var(--blue-100); color: var(--blue-700); }
.status-completed    { background: var(--green-bg); color: var(--green); }
.status-cancelled    { background: var(--red-bg);   color: var(--red); }
.status-pending      { background: var(--amber-bg); color: var(--amber); }
.status-active       { background: var(--green-bg); color: var(--green); }
.status-rejected     { background: var(--red-bg);   color: var(--red); }
.status-disabled     { background: var(--gray-100); color: var(--gray-600); }

/* ======== ALERTS =================================================== */
.alert {
    padding: 12px 14px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 14px; border: 1px solid transparent;
}
.alert.success { background: var(--green-bg); color: var(--green); border-color: #b7e3c2; }
.alert.error   { background: var(--red-bg);   color: var(--red);   border-color: #f5b7b1; }
.alert.info    { background: var(--blue-50);  color: var(--blue-700); border-color: var(--blue-200); }
.alert.warning { background: var(--amber-bg); color: var(--amber); border-color: #f5d9a1; }

/* ======== STATS GRID =============================================== */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.stat {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 16px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
    position: relative; overflow: hidden;
}
.stat::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--blue-500);
}
.stat .label { color: var(--gray-500); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--blue-800); margin: 6px 0 0; }
.stat .foot  { color: var(--gray-500); font-size: 12px; margin-top: 4px; }
.stat.green::before { background: var(--green); }
.stat.amber::before { background: var(--amber); }
.stat.red::before   { background: var(--red); }

/* ======== PAGINATION =============================================== */
.pagination {
    display: flex; justify-content: center; gap: 4px; padding: 18px 0; flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--gray-200); border-radius: 6px;
    color: var(--gray-600); text-decoration: none; font-size: 13px;
    background: var(--white);
}
.pagination a:hover    { background: var(--blue-50); color: var(--blue-700); }
.pagination .current   { background: var(--blue-500); color: var(--white); border-color: var(--blue-500); }
.pagination .disabled  { opacity: .5; pointer-events: none; }

/* ======== FILTER BAR =============================================== */
.filter-bar {
    background: var(--white); padding: 14px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
    display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
    margin-bottom: 18px;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1 1 150px; }
.filter-bar label { font-size: 11px; }

/* ======== DASHBOARD LAYOUT ========================================= */
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ======== MOBILE RESPONSIVE ======================================== */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 80%; max-width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.4); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: block; }
    .content { padding: 16px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    table.data { font-size: 13px; }
    table.data th, table.data td { padding: 8px 9px; }
}
@media (max-width: 600px) {
    table.data thead { display: none; }
    table.data tr {
        display: block; padding: 10px; margin-bottom: 10px;
        background: var(--white); border: 1px solid var(--gray-200);
        border-radius: var(--radius);
    }
    table.data td {
        display: flex; justify-content: space-between; gap: 10px;
        padding: 4px 0; border: none; font-size: 13px;
    }
    table.data td::before {
        content: attr(data-label); font-weight: 600; color: var(--gray-600);
    }
    table.data td.actions { justify-content: flex-end; padding-top: 8px; border-top: 1px dashed var(--gray-100); }
    table.data td.actions::before { content: ''; }
}

/* sidebar backdrop on mobile */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(22,61,92,.35); z-index: 35;
}
.sidebar-backdrop.show { display: block; }

/* utilities */
.text-muted  { color: var(--gray-500); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.avatar-sm {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--blue-100); color: var(--blue-700);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px; overflow: hidden;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* map */
#live-map, #history-map { height: 520px; width: 100%; border-radius: var(--radius); border: 1px solid var(--gray-200); }

@media print {
    .sidebar, .topbar, .page-head .btn, .no-print { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: none; }
}
