/* ═══════════════════════════════════════════════════════════
   Mi Flota PN — Custom UI Layer
   Importado en base.html DESPUÉS de Bootstrap 4
   ═══════════════════════════════════════════════════════════ */

:root {
    --pn-navy: #001d3d;
    --pn-gold: #ffc107;
    --pn-light: #f8f9fa;
    --radius: 10px;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Tipografía ─────────────────────────────────────────── */
body { font-family: var(--font) !important; background: #f0f2f5 !important; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-hover) !important; }
.card-header {
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── Inputs ─────────────────────────────────────────────── */
.form-control {
    border-radius: 8px !important;
    border: 1.5px solid #dee2e6 !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.875rem;
}
.form-control:focus {
    border-color: var(--pn-gold) !important;
    box-shadow: 0 0 0 3px rgba(255,193,7,0.15) !important;
    outline: none;
}
.input-group-text {
    border-radius: 8px 0 0 8px !important;
    border: 1.5px solid #dee2e6 !important;
}
.input-group > .form-control:last-child { border-radius: 0 8px 8px 0 !important; }
.input-group > .form-control:not(:first-child):not(:last-child) { border-radius: 0 !important; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
    border-radius: 8px !important;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0) !important; box-shadow: none !important; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    border-radius: 6px !important;
    font-weight: 500;
    padding: 4px 8px;
    font-size: 0.73rem;
    letter-spacing: 0.3px;
}

/* ── Tabla ───────────────────────────────────────────────── */
.table th {
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.table td { vertical-align: middle !important; font-size: 0.875rem; }
.table-hover tbody tr:hover { background: rgba(255,193,7,0.05) !important; }

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar { box-shadow: 2px 0 15px rgba(0,0,0,0.2); }
.nav-link-custom {
    border-radius: 8px;
    margin: 2px 8px;
    transition: all 0.2s ease;
    padding: 10px 14px !important;
}
.nav-link-custom:hover,
.nav-link-custom.active {
    background: rgba(255,193,7,0.15) !important;
    color: var(--pn-gold) !important;
    border-left: 3px solid var(--pn-gold) !important;
    padding-left: 11px !important;
}

/* ── Top navbar ──────────────────────────────────────────── */
.top-navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 12px 20px;
}

/* ── Estado tarjetas (dashboard → historial) ────────────── */
.tarjeta-estado:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; transition: all 0.2s; }

/* ── Dashboard border-left cards ────────────────────────── */
.border-left-primary    { border-left: 4px solid #4e73df !important; }
.border-left-success    { border-left: 4px solid #1cc88a !important; }
.border-left-warning    { border-left: 4px solid #f6c23e !important; }
.border-left-danger     { border-left: 4px solid #e74a3b !important; }
.border-left-info       { border-left: 4px solid #36b9cc !important; }
.border-left-secondary  { border-left: 4px solid #858796 !important; }
.border-left-teal       { border-left: 4px solid #17a2b8 !important; }
.border-left-green-dark { border-left: 4px solid #155724 !important; }
.border-left-orange     { border-left: 4px solid #e67e22 !important; }
.text-teal       { color: #17a2b8 !important; }
.text-green-dark { color: #155724 !important; }
.text-orange     { color: #e67e22 !important; }
/* ── Exec card label/value — tamaño compacto ────────────── */
.exec-card-label    { font-size: 0.58rem !important; line-height: 1.2; margin-bottom: 0 !important; }
.exec-card-label-sm { font-size: 0.52rem !important; }
.exec-card-value    { font-size: 1rem !important; }
/* ── Date input compacto (formulario de reporte) ─────────── */
.date-compact { max-width: 140px; min-width: 110px; }
/* ── Chart helpers ───────────────────────────────────────── */
.chart-container { position: relative; height: 220px; width: 100%; min-height: 220px; overflow: visible; }
.chart-canvas    { display: block; max-width: 100%; }
#myPieChart      { display: block; }

.filtro-card { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.filtro-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important; }
.filtro-card.activa { box-shadow: 0 0 0 2px #4e73df !important; }
/* ── Misc utilities ──────────────────────────────────────── */
.fs-082      { font-size: .82rem; }
.mw-600      { max-width: 600px; }
.bg-grad-navy { background: linear-gradient(135deg, #001d3d, #003366) !important; color: #fff !important; }
/* ── Importar BD drop zone ───────────────────────────────── */
.dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s ease;
    background: #f8f9fa;
}
/* ── Configurar 2FA ──────────────────────────────────────── */
.qr-img          { width: 200px; height: 200px; }
.code-secret     { letter-spacing: .15rem; font-size: .9rem; }
.input-2fa-large { font-size: 1.4rem; letter-spacing: .4rem; font-family: monospace; font-weight: bold; }

/* ── Labels de formulario ────────────────────────────────── */
.form-group label {
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    color: #555;
    text-transform: uppercase;
}
select.form-control { cursor: pointer; }

/* ── Responsive móvil ────────────────────────────────────── */
@media (max-width: 576px) {
    .container-fluid { padding: 10px !important; }
    .card-body { padding: 12px !important; }
    h4.font-weight-bold { font-size: 1.1rem; }
    .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
    .table { font-size: 0.8rem; }
}

/* ── Print ───────────────────────────────────────────────── */
@page { margin: 1.5cm; }
@media print {
    #sidebar, .top-navbar, .no-print { display: none !important; }
    body { background: white !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ═══════════════════════════════════════════════════════════
   Clases extraídas de templates — sin unsafe-inline
   ═══════════════════════════════════════════════════════════ */

/* ── Layout base (base.html) ────────────────────────────── */
:root { --sidebar-width: 260px; }
#wrapper   { display: flex; height: 100vh; overflow: hidden; }
#sidebar   {
    width: var(--sidebar-width); min-width: var(--sidebar-width); max-width: var(--sidebar-width);
    background: var(--pn-navy); display: flex; flex-direction: column;
    transition: width 0.3s, margin-left 0.3s; z-index: 1050; flex-shrink: 0;
}
.sidebar-header {
    padding: 20px; text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 15px;
}
.sidebar-logo    { width: 60px; height: auto; max-width: 100%; margin-bottom: 10px; }
.sidebar-logo-lg { width: 80px; height: auto; max-width: 100%; margin-bottom: 15px; }
.sidebar-title  { color: #fff; font-size: 15px; font-weight: bold; margin-bottom: 5px; letter-spacing: .5px; }
.sidebar-sub    { color: #fff; font-size: 11px; line-height: 1.3; }
.nav-link-custom {
    color: rgba(255,255,255,0.7); padding: 12px 20px;
    display: flex; align-items: center;
    text-decoration: none !important; font-size: 0.85rem;
}
.nav-link-custom i { width: 25px; }
#content { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.top-navbar { background: #fff; padding: 10px 15px; border-bottom: 1px solid #dee2e6; }
.btn-salir  { background-color: #ffc107 !important; color: #001d3d !important; }
@media (max-width: 768px) {
    #sidebar { position: fixed; margin-left: calc(-1 * var(--sidebar-width)); height: 100%; }
    #sidebar.active { margin-left: 0; }
}

/* ── Login (login.html / login_2fa.html) ─────────────────── */
body.pn-login {
    background: linear-gradient(135deg, #001d3d 0%, #003566 100%) !important;
    height: 100vh !important; display: flex !important;
    align-items: center !important; justify-content: center !important;
}
.login-card {
    width: 100%; max-width: 400px; background: white; padding: 30px;
    border-radius: 10px; box-shadow: 0 15px 35px rgba(0,0,0,.3);
    border-top: 5px solid #ffc107;
}
.btn-pn             { background: #003566 !important; color: #fff !important; font-weight: bold !important; border: none !important; }
.btn-pn:hover       { background: #001d3d !important; color: #fff !important; }
input.codigo-input  {
    font-size: 1.5rem !important; letter-spacing: .35rem !important;
    text-align: center !important; font-weight: bold !important;
    font-family: 'Courier New', monospace !important;
}

/* ── Gestión de usuarios (admin_users.html) ──────────────── */
.online-dot  { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.dot-online  { background: #28a745; box-shadow: 0 0 0 2px rgba(40,167,69,.3); }
.dot-offline { background: #ced4da; }
.dot-inactive{ background: #dc3545; box-shadow: 0 0 0 2px rgba(220,53,69,.3); }
.role-badge  { font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: .2rem .5rem; border-radius: .3rem; }
.edit-panel  { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 12px; }
.action-btn  { width: 30px; height: 30px; padding: 0; font-size: .75rem; }

/* ── DyP / Accidente — section header colors ────────────── */
.dyp-hdr-teal { background: linear-gradient(135deg, #001d3d, #17a2b8); }
.dyp-hdr-red  { background: linear-gradient(135deg, #7b0000, #c0392b); }
.dyp-hdr-gray { background: linear-gradient(135deg, #6c757d, #495057); color: #fff; }
/* ── SVG vehicle diagram — responsive ───────────────────── */
#vehicleDiagram,
#vehicleDiagramAcc,
.svg-vehicle {
    width: 100% !important;
    max-width: 180px !important;
    aspect-ratio: 236 / 400;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    cursor: pointer;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
.svg-vehicle-wrap { max-width: 180px; margin: 0 auto; }
/* ── Legend color squares ────────────────────────────────── */
.legend-sq { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; }
.legend-sq-red    { background: #e74c3c; }
.legend-sq-yellow { background: #ffc107; }
/* ── Soft tinted boxes ───────────────────────────────────── */
.bg-danger-soft   { background: #fff5f5; border: 1px solid #f5c6cb; }
.bg-warning-soft  { background: #fff8e1; border-color: #ffc107 !important; }
.border-danger-dashed { border: 2px dashed #dc3545 !important; border-radius: 10px !important; }
/* ── Gap utilities ───────────────────────────────────────── */
.d-flex-gap-lg { gap: 1.5rem; }
/* ── Save button gradient ────────────────────────────────── */
.btn-grad-dark { background: linear-gradient(135deg, #6c757d, #495057); color: #fff; }

/* ── DyP / Accidente (dyp_accidente.html) ────────────────── */
#formHeader       { background: linear-gradient(135deg,#001d3d,#003366) !important; border-radius: 8px 8px 0 0; }
.dyp-card         { border-radius: 12px !important; box-shadow: 0 4px 20px rgba(0,0,0,.10) !important; border: none !important; }
.dyp-section-card { border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.06); border: 1px solid #e9ecef !important; }
.dyp-section-header {
    padding: 10px 16px; border-radius: 8px; color: #fff;
    font-weight: bold; font-size: .95rem; margin-bottom: 1rem;
}
#btnGuardar { border: none; border-radius: 10px; transition: opacity .2s, transform .2s, box-shadow .2s; }
#btnGuardar:not(:disabled):hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.22) !important; }
.svg-zone  { cursor: pointer; }
.area-card { border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.06); border: 1px solid #e9ecef !important; }

/* ── Reporte imprimible ──────────────────────────────────── */
.pn-titulo { letter-spacing: 1px; }

/* ── Editor vehículos (editor_vehiculos.html) ───────────── */
.fila-editor td    { vertical-align: middle; font-size: .83rem; }
.fila-edit-panel td{ padding: 0; border-top: none; }
.edit-veh-panel    { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 14px; margin: 6px; }
.d-flex-gap        { display: flex; gap: .4rem; }
.text-090          { font-size: 0.9rem; }
.hr-subtle         { border-top: 1px solid rgba(0,0,0,0.1) !important; }
.select-compact    { font-size: .8rem; width: auto; }
.d-flex-gap-xs     { display: flex; gap: .25rem; }
.d-flex-gap-sm     { display: flex; gap: .5rem; }
.thead-pn          { background: #001d3d !important; color: #fff !important; }

/* ── Historial vehículo (historial_vehiculo.html) ────────── */
.print-header { display: none; text-align: center; margin-bottom: 18px; border-bottom: 2px solid #000; padding-bottom: 10px; }
.print-firma  { display: none; justify-content: space-around; margin-top: 60px; }
.firma-box    { text-align: center; border-top: 1px solid #000; width: 200px; padding-top: 6px; font-size: 10pt; }
.print-logo      { height: 60px; width: auto; max-width: 120px; margin-bottom: 6px; }
.print-title     { font-size: 14pt; }
.print-subtitle  { font-size: 10pt; }
.print-doc-title { font-size: 12pt; text-transform: uppercase; }
@media print {
    .print-header { display: block !important; }
    .print-firma  { display: flex !important; }
    body.hv-print { font-size: 11pt; margin-top: 1cm; margin-bottom: 1cm; }
}

/* ═══════════════════════════════════════
   RESPONSIVE GLOBAL
   ═══════════════════════════════════════ */

@media (max-width: 576px) {
    .container-fluid { padding-left: 8px; padding-right: 8px; }
    .card-body { padding: 0.5rem !important; }
    .badge { font-size: 0.65rem; }
    .btn-sm { padding: 0.2rem 0.35rem; font-size: 0.72rem; }
    .table { font-size: 0.75rem; }
    h1.h4 { font-size: 1.1rem; }
    input[type="date"] { font-size: 0.8rem; }
    #vehicleDiagram, #vehicleDiagramAcc, .svg-vehicle { max-width: 110px !important; }
    .svg-vehicle-wrap { max-width: 110px; }
    /* Touch targets mínimos 44px */
    .btn { min-height: 38px; }
    .btn-sm { min-height: 34px; }
    /* Tabla: columnas menos críticas ocultas en móvil */
    .col-hide-xs { display: none !important; }
    /* Sidebar close button solo visible en móvil */
    .sidebar-close-btn { display: inline-block !important; }
    /* Panel edición: separador visual entre columnas */
    .border-top { border-top: 1px solid #dee2e6 !important; }
    .border-md-top-0 { border-top: 1px solid #dee2e6 !important; }
}

@media (max-width: 768px) {
    .table-responsive { -webkit-overflow-scrolling: touch; }
    /* Sidebar close button visible en tablets */
    .sidebar-close-btn { display: inline-block !important; }
    /* Botones de acción en tabla: asegurar espacio táctil */
    .action-btn { min-width: 34px; min-height: 34px; }
}

@media (min-width: 769px) {
    /* En escritorio el botón X del sidebar se oculta (el hamburger del topbar basta) */
    .sidebar-close-btn { display: none !important; }
    /* Separador lateral del panel edit de usuarios */
    .border-md-top-0 { border-top: none !important; border-left: 1px solid #dee2e6 !important; }
}

@media (min-width: 992px) {
    #vehicleDiagram, #vehicleDiagramAcc, .svg-vehicle { max-width: 380px !important; }
    .svg-vehicle-wrap { max-width: 380px; }
}

/* ── Clases extraídas de style= inline — limpieza CSP ─── */
.progress-4px    { height: 4px; }
.progress-init   { width: 0%; }
.text-072        { font-size: 0.72rem; }
.text-075        { font-size: 0.75rem; }
.text-078        { font-size: 0.78rem; }
.text-08         { font-size: 0.8rem; }
.icon-14         { font-size: 1.4rem; }
.scroll-350      { max-height: 350px; overflow-y: auto; }
.scroll-600      { max-height: 600px; overflow-y: auto; }
.th-36           { width: 36px; }
.td-ellipsis-180 { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border-maint-active { border: 2px solid #dc3545 !important; }
.link-legal      { font-size: 0.72rem; text-decoration: underline dotted; }
.modal-hdr-pn    { background: #001d3d !important; color: #fff !important; }
.modal-logo-sm   { height: 28px; width: auto; margin-right: 8px; vertical-align: middle; }
.modal-body-pn   { font-size: 0.85rem; line-height: 1.7; }
.btn-close-sidebar { color: rgba(255,255,255,0.6) !important; font-size: 1.1rem; }
.detail-clip     { max-width: 160px; white-space: normal; line-height: 1.2; }
.pre-logs        { font-size: 0.72rem; max-height: 600px; overflow-y: auto; border-radius: 0 0 8px 8px; white-space: pre-wrap; word-break: break-all; }
.input-totp      { font-size: 1.3rem; letter-spacing: 0.3em; }
