/* ============================================
   SISTEMA DE CONTROL DE HORARIOS
   ESTILOS OPTIMIZADOS PARA MÓVILES
   Compatible: Safari iOS, Chrome Android, Desktop
   ============================================ */

/* RESET ESPECÍFICO PARA MÓVILES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS Safe Area Insets */
@supports (padding: max(0px)) {
    body {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-top: max(15px, env(safe-area-inset-top));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* CONTENEDOR PRINCIPAL */
.container {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    position: relative;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: clamp(25px, 6vw, 35px) 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.2;
}

.header .subtitle {
    font-size: clamp(0.9rem, 3vw, 1rem);
    opacity: 0.9;
    font-weight: 400;
}

/* ============================================
   ESTILOS DE GEOLOCALIZACIÓN
   ============================================ */
.geo-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.geo-status.geo-loading {
    background: #e3f2fd;
    border-bottom-color: #2196f3;
}

.geo-status.geo-success {
    background: #e8f5e9;
    border-bottom-color: #4caf50;
}

.geo-status.geo-error {
    background: #ffebee;
    border-bottom-color: #f44336;
}

.geo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.geo-loading .geo-icon {
    background: #2196f3;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

.geo-success .geo-icon {
    background: #4caf50;
    color: white;
}

.geo-error .geo-icon {
    background: #f44336;
    color: white;
}

.geo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.geo-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.geo-loading .geo-label {
    color: #1976d2;
}

.geo-success .geo-label {
    color: #2e7d32;
}

.geo-error .geo-label {
    color: #c62828;
}

.geo-coords {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   FIN ESTILOS DE GEOLOCALIZACIÓN
   ============================================ */

/* CONTENEDOR DEL FORMULARIO */
.form-container {
    padding: clamp(20px, 5vw, 30px) clamp(15px, 4vw, 25px);
}

/* GRUPO DE INPUT */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: clamp(1rem, 4vw, 1.1rem);
    line-height: 1.4;
}

.input-group input {
    width: 100%;
    padding: 18px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: clamp(1.1rem, 4vw, 1.2rem);
    text-align: center;
    transition: all 0.3s ease;
    background: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 56px;
}

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

@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .input-group input {
        font-size: 16px !important;
    }
}

/* INFORMACIÓN DE EMPLEADA */
.info-empleada {
    margin: 25px 0;
    animation: fadeIn 0.5s ease;
}

.info-card {
    background: #f8f9fa;
    border-left: 5px solid #667eea;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-card h3 {
    color: #566c83;
    margin-bottom: 10px;
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    font-weight: 600;
    line-height: 1.3;
}

.info-card p {
    color: #5e7d9c;
    font-size: clamp(0.95rem, 3.5vw, 1rem);
    line-height: 1.4;
}

/* CONTENEDOR DE BOTONES */
.botones {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* BOTONES GENERALES */
.btn {
    padding: 20px 15px;
    border: none;
    border-radius: 12px;
    font-size: clamp(1.1rem, 4vw, 1.2rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 64px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

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

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

/* BOTÓN INGRESO */
.btn-ingreso {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.btn-ingreso:active:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}

/* BOTÓN SALIDA */
.btn-salida {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.btn-salida:active:not(:disabled) {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
}

/* MENSAJES */
.mensaje {
    margin-top: 20px;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    display: none;
    font-size: clamp(0.95rem, 3.5vw, 1rem);
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

.mensaje.success {
    background: #d4edda;
    color: #155724;
    display: block;
    border-left: 4px solid #28a745;
}

.mensaje.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
    border-left: 4px solid #dc3545;
}

.mensaje.info {
    background: #e3f2fd;
    color: #1565c0;
    display: block;
    border-left: 4px solid #2196f3;
}

/* FOOTER */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    border-top: 1px solid #eee;
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    line-height: 1.5;
}

.footer .instruccion {
    font-size: clamp(0.75rem, 2.8vw, 0.8rem);
    color: #999;
    margin-top: 5px;
    font-style: italic;
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* SPINNER PARA CARGA */
.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   MEDIA QUERIES ESPECÍFICAS
   ============================================ */

/* MÓVILES PEQUEÑOS (hasta 360px) */
@media (max-width: 360px) {
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .input-group input {
        padding: 16px 12px;
        min-height: 52px;
    }
    
    .btn {
        min-height: 58px;
        padding: 16px 12px;
    }
    
    .info-card {
        padding: 15px;
    }
    
    .geo-status {
        padding: 12px 15px;
    }
    
    .geo-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* MÓVILES GRANDES Y TABLETS (361px - 768px) */
@media (min-width: 361px) and (max-width: 768px) {
    .container {
        max-width: 420px;
        margin: 0 auto;
    }
    
    .botones {
        gap: 18px;
    }
    
    .btn {
        min-height: 62px;
    }
}

/* TABLETS EN HORIZONTAL (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 500px;
    }
    
    .botones {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn {
        flex: 1;
        min-width: 200px;
    }
}

/* DESKTOP (1025px en adelante) */
@media (min-width: 1025px) {
    .container {
        max-width: 500px;
    }
    
    .btn:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .btn-ingreso:hover:not(:disabled) {
        box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
    }
    
    .btn-salida:hover:not(:disabled) {
        box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
    }
}

/* ORIENTACIÓN HORIZONTAL EN MÓVILES */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
        align-items: flex-start;
    }
    
    .container {
        max-height: 90vh;
        overflow-y: auto;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .form-container {
        padding: 15px 20px;
    }
    
    .input-group {
        margin-bottom: 15px;
    }
    
    .botones {
        margin-top: 20px;
    }
    
    .btn {
        min-height: 55px;
        padding: 12px 15px;
    }
}

/* HIGH-DPI DISPLAYS */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .container {
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    }
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .container {
        background: #1a202c;
        color: #e2e8f0;
    }
    
    .input-group label {
        color: #e2e8f0;
    }
    
    .input-group input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .info-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .footer {
        color: #a0aec0;
        border-top-color: #2d3748;
    }
    
    .geo-status {
        background: #2d3748;
        border-bottom-color: #4a5568;
    }
    
    .geo-label {
        color: #e2e8f0;
    }
    
    .geo-coords {
        color: #a0aec0;
    }
}

/* IMPROVE TOUCH TARGETS FOR MOBILE */
@media (pointer: coarse) {
    .btn {
        min-height: 60px;
    }
    
    .input-group input {
        min-height: 56px;
    }
}

/* PREVENT IOS TEXT SIZE ADJUST */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
