/* style.css - Estilos mejorados con responsive */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

/* Header - Tamaño reducido */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    gap: 8px;
}

.header-left {
    flex: 0 1 auto;
    min-width: 120px;
}

.header-left h1 {
    font-size: 18px;
    margin-bottom: 2px;
}

.header-left p {
    opacity: 0.9;
    font-size: 11px;
}

.header-center {
    flex: 0 0 auto;
    text-align: center;
}

.reloj {
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    min-width: 120px;
}

.reloj #horaActual {
    font-size: 18px;
    font-weight: bold;
    display: block;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.reloj #fechaActual {
    font-size: 10px;
    opacity: 0.9;
}

.stats-header {
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    flex-wrap: wrap;
}

.stats-header div {
    font-size: 11px;
    white-space: nowrap;
}

.stats-header span {
    font-weight: bold;
    font-size: 14px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    width: 100%;
}

/* Formulario */
.form-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.form-container h2 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-size: 18px;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.required {
    color: #dc3545;
}

.help-text {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input:invalid {
    border-color: #dc3545;
}

input:valid {
    border-color: #28a745;
}

/* Select personalizado para móviles */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.radio-group {
    display: flex;
    gap: 15px;
    padding-top: 3px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
    font-size: 14px;
}

.radio-group input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: radio;
    appearance: radio;
}

.placa-group {
    display: none;
}

.placa-group.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.destino-group {
    display: block;
}

.destino-group.oculto {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Mensajes */
.mensaje {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.mensaje.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mensaje.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mensaje.info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* Tabla */
.table-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.table-header h2 {
    color: #333;
    font-size: 18px;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 450px;
    overflow-y: auto;
}

.table-responsive table {
    min-width: 600px;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    word-break: break-word;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.badge-entrada {
    background: #d4edda;
    color: #155724;
}

.badge-salida {
    background: #f8d7da;
    color: #721c24;
}

.badge-si {
    background: #cce5ff;
    color: #004085;
}

.badge-no {
    background: #e2e3e5;
    color: #383d41;
}

/* Destino con color */
.destino-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-block;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destino-comando { background: #f8d7da; color: #721c24; }
.destino-segundo { background: #fff3cd; color: #856404; }
.destino-planes { background: #d1ecf1; color: #0c5460; }
.destino-personal { background: #d4edda; color: #155724; }
.destino-mantenimiento { background: #cce5ff; color: #004085; }
.destino-abastos { background: #f5c6cb; color: #721c24; }
.destino-operaciones { background: #c3e6cb; color: #155724; }
.destino-finanzas { background: #ffeaa7; color: #6c5f04; }
.destino-legal { background: #dfe6e9; color: #2d3436; }
.destino-inspectoria { background: #fd79a8; color: #6c0b30; }
.destino-prevac { background: #a29bfe; color: #2d1b69; }
.destino-null { background: #e2e3e5; color: #383d41; font-style: italic; }

/* Loading */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sin-registros {
    text-align: center;
    padding: 30px 15px;
    color: #999;
}

.sin-registros .icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

/* Scrollbar personalizado */
.table-responsive::-webkit-scrollbar {
    height: 5px;
    width: 5px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================ */
/* RESPONSIVE - MÓVILES Y TABLETS */
/* ============================================ */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        padding: 0 5px;
    }
}

/* Móviles grandes y tablets pequeñas */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 10px 12px;
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    
    .header-left {
        min-width: auto;
        width: 100%;
    }
    
    .header-left h1 {
        font-size: 17px;
    }
    
    .header-left p {
        font-size: 10px;
    }
    
    .header-center {
        width: 100%;
    }
    
    .reloj {
        display: inline-block;
        padding: 3px 10px;
        min-width: 100px;
    }
    
    .reloj #horaActual {
        font-size: 17px;
    }
    
    .reloj #fechaActual {
        font-size: 9px;
    }
    
    .stats-header {
        width: 100%;
        justify-content: center;
        gap: 8px;
        padding: 5px 8px;
    }
    
    .stats-header div {
        font-size: 10px;
    }
    
    .stats-header span {
        font-size: 13px;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .form-container h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    label {
        font-size: 12px;
    }
    
    input, select, textarea {
        font-size: 16px;
        padding: 10px 12px;
    }
    
    .radio-group label {
        font-size: 13px;
    }
    
    .btn-submit {
        font-size: 15px;
        padding: 12px 15px;
    }
    
    .table-container {
        padding: 15px;
    }
    
    .table-header h2 {
        font-size: 16px;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .table-actions {
        justify-content: center;
        gap: 6px;
    }
    
    .btn {
        font-size: 11px;
        padding: 5px 12px;
    }
    
    .table-responsive table {
        font-size: 12px;
        min-width: 500px;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .destino-badge {
        font-size: 10px;
        padding: 2px 6px;
        max-width: 80px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 0;
    }
    
    .header {
        padding: 8px 10px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .header-left h1 {
        font-size: 15px;
    }
    
    .header-left p {
        font-size: 9px;
    }
    
    .reloj #horaActual {
        font-size: 15px;
    }
    
    .reloj #fechaActual {
        font-size: 8px;
    }
    
    .stats-header {
        gap: 5px;
        padding: 4px 6px;
    }
    
    .stats-header div {
        font-size: 9px;
    }
    
    .stats-header span {
        font-size: 12px;
    }
    
    .form-container {
        padding: 12px;
        border-radius: 8px;
    }
    
    .form-container h2 {
        font-size: 14px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    label {
        font-size: 11px;
    }
    
    input, select, textarea {
        font-size: 15px;
        padding: 8px 10px;
        border-radius: 4px;
    }
    
    .radio-group {
        gap: 10px;
    }
    
    .radio-group label {
        font-size: 12px;
    }
    
    .btn-submit {
        font-size: 14px;
        padding: 10px 12px;
        border-radius: 4px;
    }
    
    .table-container {
        padding: 10px;
        border-radius: 8px;
    }
    
    .table-header h2 {
        font-size: 14px;
    }
    
    .btn {
        font-size: 10px;
        padding: 4px 10px;
        border-radius: 4px;
    }
    
    .table-responsive table {
        font-size: 11px;
        min-width: 400px;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    .badge {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    .destino-badge {
        font-size: 9px;
        padding: 2px 5px;
        max-width: 60px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .header-left h1 {
        font-size: 13px;
    }
    
    .reloj #horaActual {
        font-size: 13px;
    }
    
    .stats-header div {
        font-size: 8px;
    }
    
    .stats-header span {
        font-size: 11px;
    }
    
    input, select, textarea {
        font-size: 14px;
        padding: 6px 8px;
    }
    
    .table-responsive table {
        font-size: 10px;
        min-width: 350px;
    }
    
    th, td {
        padding: 4px 3px;
    }
    
    .btn {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* Orientación horizontal en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .header-left {
        flex: 1;
        min-width: 100px;
    }
    
    .header-center {
        flex: 0 0 auto;
    }
    
    .stats-header {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .table-container {
        padding: 15px;
    }
}

/* Mejoras para touch */
@media (hover: none) {
    .btn:hover {
        transform: none !important;
    }
    
    .btn-submit:hover {
        transform: none !important;
    }
    
    tr:hover {
        background: transparent;
    }
    
    input, select, textarea {
        font-size: 16px;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}