/* ═══════════════════════════════════════
   Control de Flota — conduccion.lagomdevs.com
   ═══════════════════════════════════════ */

:root {
    --navy: #0F1B2D;
    --navy-light: #1A2D47;
    --slate: #2C4263;
    --amber: #F59E0B;
    --amber-hover: #D97706;
    --amber-light: #FEF3C7;
    --green: #10B981;
    --green-bg: #D1FAE5;
    --green-text: #065F46;
    --blue: #3B82F6;
    --blue-bg: #DBEAFE;
    --blue-text: #1E40AF;
    --red: #EF4444;
    --red-bg: #FEE2E2;
    --red-text: #991B1B;
    --gray-bg: #F3F4F6;
    --bg: #F0F2F5;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 25px 60px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, var(--slate) 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 20px;
    padding: 48px 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--amber), var(--amber-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(245,158,11,0.3);
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 14px;
    margin-bottom: 32px;
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

input[type="file"] {
    padding: 8px 12px;
    font-size: 13px;
}

.password-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1 1 160px;
    min-width: 140px;
    margin-bottom: 0;
}

.form-submit {
    flex: 0 0 auto !important;
    min-width: auto !important;
}

.inline-form {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--amber), var(--amber-hover));
    color: #fff;
    box-shadow: 0 4px 16px rgba(245,158,11,0.25);
}

.btn-secondary {
    background: var(--slate);
    color: #fff;
}

.btn-block { width: 100%; justify-content: center; }

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 14px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    text-decoration: none;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.btn-icon:hover { opacity: 1; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    text-align: center;
}

.alert-danger {
    background: var(--red-bg);
    color: var(--red-text);
}

.alert-success {
    background: var(--green-bg);
    color: var(--green-text);
}

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-blue { background: var(--blue-bg); color: var(--blue-text); }
.badge-amber { background: var(--amber-light); color: var(--amber-hover); }
.badge-red { background: var(--red-bg); color: var(--red-text); }
.badge-gray { background: var(--gray-bg); color: var(--text-secondary); }

/* ── SIDEBAR ── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: var(--navy);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--amber), var(--amber-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-sub {
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    margin-top: 2px;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    margin-bottom: 3px;
    transition: all 0.15s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

.nav-item.active {
    background: rgba(245,158,11,0.15);
    color: var(--amber);
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    margin-bottom: 10px;
}

.sidebar-user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.sidebar-user-role {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    margin-top: 2px;
}

.nav-logout {
    color: rgba(255,255,255,0.45) !important;
    font-size: 13px;
}

/* ── MOBILE HEADER ── */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}

.hamburger {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    color: var(--text);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--navy);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 45;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: 240px;
    padding: 32px 36px;
    min-height: 100vh;
}

/* ── PAGE ELEMENTS ── */
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.page-sub {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── CARDS ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
}

/* ── STATS ── */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    flex: 1 1 220px;
    min-width: 180px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-sub {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-amber { background: var(--amber-light); }
.bg-blue { background: var(--blue-bg); }
.bg-green { background: var(--green-bg); }
.bg-red { background: var(--red-bg); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }

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

thead tr {
    background: var(--bg);
}

th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
}

tbody tr:hover {
    background: var(--bg);
}

.text-right { text-align: right; }
.text-amber { color: var(--amber) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.tabnum { font-variant-numeric: tabular-nums; }

.file-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
}
.file-link:hover { text-decoration: underline; }

/* ── ACTIVITY LIST ── */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-info { flex: 1; min-width: 0; }

.activity-main {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.activity-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── UPLOAD AREA ── */
.upload-area {
    text-align: center;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 14px;
}

.upload-result {
    margin-top: 18px;
    padding: 14px 20px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
}

.upload-result.success {
    background: var(--green-bg);
    color: var(--green-text);
}

.upload-result.error {
    background: var(--red-bg);
    color: var(--red-text);
}

.upload-preview img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 12px;
    border: 2px solid var(--border);
    margin-top: 14px;
}

/* ── SPINNER ── */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── DIVIDER ── */
.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 16px 0;
}

/* ── EMPTY STATE ── */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ── PASSWORD FORM ── */
.password-form {
    margin-bottom: 8px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close {
        display: block;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .mobile-header {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }
    .stats-grid {
        flex-direction: column;
    }
    .stat-card {
        min-width: 100%;
    }
    .form-row {
        flex-direction: column;
    }
    .form-row .form-group {
        flex: 1 1 auto;
        min-width: 100%;
    }
    .stat-value {
        font-size: 22px;
    }
    .login-card {
        padding: 36px 24px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 16px 12px;
    }
    .card {
        padding: 16px;
    }
    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }
}
