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

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    color: #333333;
}

.container {
    max-width: 100%;
    margin: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    min-height: 100vh;
}

/* Safe area para iPhone X y superiores */
@supports(padding: max(0px)) {
    .container {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

.panel {
    display: none;
    padding: 15px;
    animation: fadeIn 0.3s ease;
    background: #ffffff;
}

.panel.active {
    display: block;
}

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

.header {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    color: white;
    padding: 15px;
    position: relative;
    padding-top: max(15px, env(safe-area-inset-top));
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-info {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: 15px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 6px 10px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.btn-logout {
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    text-decoration: none;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.title-with-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0;
}

.logo-small {
    max-height: 40px;
    max-width: 80px;
    object-fit: contain;
    /* REMOVER: filter: brightness(0) invert(1); */
}

.header h1 {
    font-size: 20px;
    margin-bottom: 5px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

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

.fecha {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.8;
}

/* Botones principales - Grid móvil */
.buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0;
    padding: 0 5px;
}

.btn {
    padding: 18px 10px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #1abc9c, #16a085);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-dark {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
}

/* Resumen mejorado para móvil */
.resumen {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.resumen h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #2c3e50;
    font-weight: 600;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.stats span {
    font-size: 12px;
    padding: 10px 5px;
    background: white;
    border-radius: 10px;
    font-weight: 600;
    color: #555;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #f1f1f1;
}

.stats span span {
    display: block;
    font-size: 16px;
    color: #3498db;
    background: none;
    padding: 4px 0;
    border: none;
    box-shadow: none;
    font-weight: 700;
}

/* Lista de registros optimizada */
.lista-registros {
    max-height: 50vh;
    overflow-y: auto;
    margin: 20px 0;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 10px;
}

.lista-registros h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #2c3e50;
    padding: 0 5px;
    font-weight: 600;
}

.registro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    margin: 8px 0;
    border-radius: 10px;
    background: white;
    border-left: 4px solid #3498db;
    transition: all 0.2s ease;
    min-height: 65px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #f1f1f1;
}

.registro-item:active {
    background: #f8f9fa;
    transform: scale(0.995);
}

.registro-item.pendiente {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
}

.registro-item.completado {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #d1f7c4, #a9dfbf);
}

.patente {
    font-weight: bold;
    font-size: 15px;
    flex: 1;
    min-width: 80px;
    color: #2c3e50;
}

.horario {
    font-size: 13px;
    color: #666;
    flex: 1.5;
    text-align: center;
    padding: 0 5px;
}

.monto {
    font-weight: bold;
    color: #27ae60;
    flex: 1;
    text-align: right;
    font-size: 15px;
}

.badge {
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}

.pendiente-badge {
    background: #e74c3c;
    color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Formularios optimizados para móvil */
.form-group {
    margin: 15px 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-check {
    margin: 15px 0;
    display: flex;
    align-items: center;
}

.form-check-input {
    margin-right: 10px;
    transform: scale(1.3);
}

.form-check-label {
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    color: #333;
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #fafafa;
}

select.form-control {
    padding: 16px;
    background: white url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 12px center;
    background-size: 16px;
}

/* Resultados y mensajes */
.resultado {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.mensaje-exito {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border-left: 4px solid #28a745;
    border: 1px solid #c3e6cb;
}

.mensaje-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border-left: 4px solid #dc3545;
    border: 1px solid #f5c6cb;
}

.mensaje-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    text-align: center;
    border-left: 4px solid #17a2b8;
    border: 1px solid #bee5eb;
}

/* Modal móvil */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 0;
    padding: 20px;
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Ticket optimizado para móvil */
.ticket {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 2px dashed #ddd;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ticket-header {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 2px dashed #ccc;
    padding-bottom: 15px;
}

.ticket-header h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.ticket-body {
    margin: 15px 0;
}

.ticket-line {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    padding: 3px 0;
}

.ticket-barcode {
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.ticket-footer {
    text-align: center;
    margin-top: 15px;
    border-top: 2px dashed #ccc;
    padding-top: 15px;
    font-size: 13px;
    color: #666;
}

/* Código de barras móvil */
.barcode-container {
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #f1f1f1;
}

.barcode-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.barcode-text {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    margin-top: 10px;
    color: #333;
}

/* Botones de impresión móvil */
.btn-print {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    margin: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    min-height: 55px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-print:active {
    transform: scale(0.98);
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

.btn-print:disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    transform: none;
}

/* Estado Bluetooth móvil */
.bluetooth-status {
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    margin: 8px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bluetooth-connected {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.bluetooth-disconnected {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.bluetooth-scanning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Controles de impresión móvil */
.print-controls {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.print-controls h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.print-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Preview de impresión móvil */
.modal-content .ticket {
    border: 2px dashed #ddd;
    padding: 20px;
    margin: 15px 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.modal-content .print-preview {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    padding: 15px;
    background: #f8f9fa;
    margin-bottom: 20px;
    border-radius: 10px;
}

/* Scanner de cámara móvil */
.camara-modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    background: white;
}

#scanner-container {
    position: relative;
    width: 100%;
    height: 50vh;
    margin: 20px 0;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Notificaciones móviles */
.notification {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    right: 15px;
    left: 15px;
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    text-align: center;
    backdrop-filter: blur(10px);
}

.notification.success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.notification.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.notification.info {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

/* Botones pequeños móvil */
.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    margin: 0 3px;
    border-radius: 8px;
    font-weight: 600;
}

/* Usuarios actions */
.usuario-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.usuario-info {
    flex: 1;
}

.usuario-info strong {
    color: #2c3e50;
    font-size: 15px;
}

.usuario-info div {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

/* Scroll personalizado */
.lista-registros::-webkit-scrollbar {
    width: 6px;
}

.lista-registros::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.lista-registros::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.lista-registros::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Orientación landscape */
@media (orientation: landscape) and (max-height: 500px) {
    .header {
        padding: 10px 15px;
    }
    
    .title-with-logo {
        margin: 5px 0;
    }
    
    .buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .btn {
        padding: 14px 8px;
        min-height: 55px;
        font-size: 13px;
    }
    
    .lista-registros {
        max-height: 40vh;
    }
}

/* Tablets pequeñas */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 768px;
        margin: 20px auto;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
    
    .buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .modal-content {
        max-width: 600px;
        margin: 5% auto;
        border-radius: 16px;
        height: auto;
        max-height: 90vh;
        box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    }
    
    .panel {
        padding: 25px;
    }
}

/* Dispositivos muy pequeños */
@media (max-width: 360px) {
    .buttons {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .patente, .horario, .monto {
        font-size: 13px;
    }
    
    .btn {
        padding: 16px 10px;
        font-size: 13px;
    }
    
    .registro-item {
        padding: 12px;
    }
}

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

/* Estados de carga */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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