/* =========================================================
   RTA MONITOR - LIGHT PROFESSIONAL DASHBOARD
   ========================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --background: #f4f7fb;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e5eaf1;
    --success: #15803d;
    --danger: #dc2626;
    --sidebar-width: 252px;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(15, 23, 42, .045);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

/* =========================================================
   APPLICATION LAYOUT
   ========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 23px 15px 16px;
    background: #fff;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 9px 20px;
    text-decoration: none;
    color: var(--text);
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 10px rgba(37, 99, 235, .2);
}

.brand-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.brand-text strong {
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -.3px;
}

.brand-text small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0 3px 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 23px;
    flex: 1;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-heading {
    padding: 0 11px 7px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.nav-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 8px;
    color: #526176;
    text-decoration: none;
    font-size: 13px;
    font-weight: 550;
    transition: background .18s ease, color .18s ease;
}

.nav-link:hover {
    color: var(--primary);
    background: #f5f8ff;
}

.nav-link.active {
    color: var(--primary-dark);
    background: var(--primary-light);
    font-weight: 700;
}

.nav-icon {
    width: 21px;
    min-width: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
    color: #8290a5;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
    color: var(--primary);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 16px 3px 0;
    margin-top: 25px;
}

.sidebar-footer-label {
    padding: 0 10px 8px;
    color: #a0aaba;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
}

.logout-form {
    margin: 0;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 11px;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.logout-btn:hover {
    color: #dc2626;
    background: #fef2f2;
}

.main-area {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 0 34px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 13px;
    font-weight: 550;
}

.topbar-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px #dcfce7;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: 30px 34px;
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.app-footer {
    padding: 14px 34px;
    color: #94a3b8;
    font-size: 11px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.app-footer span {
    padding: 0 5px;
}

/* =========================================================
   HEADINGS AND TEXT
   ========================================================= */

h1 {
    margin: 0 0 8px;
    color: #172554;
    font-size: 27px;
    font-weight: 750;
    letter-spacing: -.55px;
    line-height: 1.3;
}

h2 {
    margin: 0 0 17px;
    color: #243247;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.2px;
}

h3 {
    color: #29384d;
}

p {
    line-height: 1.6;
}

.muted {
    color: #758094;
    line-height: 1.5;
}

.page-heading,
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* =========================================================
   CARDS AND DASHBOARD METRICS
   ========================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 25px 0;
}

.stat-card,
.section-card,
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.stat-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .07);
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    color: #1e3a8a;
    font-size: 29px;
    font-weight: 750;
    letter-spacing: -.5px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 550;
}

.section-card {
    margin: 20px 0;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.module-card {
    padding: 21px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .07);
}

.module-icon {
    margin-bottom: 13px;
    font-size: 25px;
}

.module-card h3 {
    margin: 0 0 9px;
    color: #243b64;
    font-size: 16px;
}

.module-card p {
    min-height: 43px;
    margin: 0 0 15px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.module-status {
    display: inline-block;
    padding: 6px 10px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 11px;
}

.module-link {
    display: inline-block;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.primary-btn,
.secondary-btn,
.danger-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s ease, transform .18s ease;
}

.primary-btn {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 5px rgba(37, 99, 235, .15);
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background: #aab5c8;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    color: #334155;
    background: #edf2f8;
}

.secondary-btn:hover {
    background: #e2e8f0;
}

.danger-btn {
    color: #b91c1c;
    background: #fee2e2;
}

.danger-btn:hover {
    background: #fecaca;
}

.full-width {
    width: 100%;
}

/* =========================================================
   FORMS AND INPUTS
   ========================================================= */

.vehicle-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
}

input,
select,
textarea {
    max-width: 100%;
    color: #263449;
}

input,
select {
    width: 100%;
    min-height: 41px;
    padding: 10px 12px;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    padding: 11px 12px;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

input::placeholder,
textarea::placeholder {
    color: #a0aaba;
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 9px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 12px 13px;
    text-align: left;
    border-bottom: 1px solid #edf0f5;
    vertical-align: middle;
}

th {
    color: #64748b;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .35px;
}

tbody tr:hover {
    background: #f9fbff;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    padding: 25px;
    color: #758094;
    background: #f8fafc;
    border-radius: 9px;
    text-align: center;
}

/* =========================================================
   STATUS BADGES AND ALERTS
   ========================================================= */

.status-badge {
    display: inline-block;
    padding: 6px 11px;
    color: #926000;
    background: #fff4d6;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.alert {
    padding: 13px 16px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
}

.alert.success {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.alert.error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.alert.warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, .09), transparent 32%),
        radial-gradient(circle at 85% 85%, rgba(37, 99, 235, .07), transparent 30%),
        #f4f7fb;
}

.login-layout {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-wrapper {
    min-height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    max-width: 410px;
    padding: 34px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .08);
}

.login-card h1 {
    margin-bottom: 8px;
    color: #172554;
    font-size: 27px;
}

.login-card form {
    margin-top: 25px;
}

.login-card label {
    margin-bottom: 7px;
}

.login-card input {
    margin-bottom: 18px;
    min-height: 45px;
}

.login-card .primary-btn {
    min-height: 44px;
}

/* =========================================================
   RENTAL OVERVIEW
   ========================================================= */

.rental-heading {
    margin-bottom: 10px;
}

.rental-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* =========================================================
   RESPONSIVE LAYOUT
   ========================================================= */

@media (max-width: 1100px) {
    :root {
        --sidebar-width: 225px;
    }

    .main-content {
        padding: 25px 22px;
    }

    .topbar {
        padding: 0 22px;
    }

    .app-footer {
        padding-left: 22px;
        padding-right: 22px;
    }

    .stats-grid,
    .module-grid {
        gap: 13px;
    }
}

@media (max-width: 800px) {
    .stats-grid,
    .rental-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vehicle-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 12px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }

    .brand {
        padding: 0 5px 12px;
    }

    .brand-icon {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .sidebar-divider,
    .nav-heading,
    .sidebar-footer-label {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        gap: 5px;
        overflow-x: auto;
        padding: 5px 0;
    }

    .nav-group {
        display: contents;
    }

    .nav-link {
        flex: 0 0 auto;
        min-height: 37px;
        gap: 7px;
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .nav-icon {
        width: auto;
        min-width: 15px;
        font-size: 16px;
    }

    .sidebar-footer {
        margin-top: 7px;
        padding: 7px 0 0;
    }

    .logout-btn {
        width: auto;
        padding: 7px 10px;
    }

    .topbar {
        min-height: 49px;
        padding: 0 16px;
    }

    .main-content {
        padding: 20px 15px;
    }

    .app-footer {
        padding: 12px 15px;
    }
}

@media (max-width: 550px) {
    .stats-grid,
    .rental-stats,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .vehicle-form {
        grid-template-columns: 1fr;
    }

    .page-heading,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    h1 {
        font-size: 23px;
    }

    .login-layout {
        padding: 15px;
    }

    .login-card {
        padding: 25px 21px;
    }

    .system-status {
        font-size: 10px;
    }
}
