/**
 * Fichaje360 - Sistema de Fichaje Digital
 * Estilos principales
 */

/* ========== Variables ========== */
:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --secondary: #00CEC9;
    --success: #00D97E;
    --success-dark: #00B368;
    --warning: #FDCB6E;
    --warning-dark: #E17055;
    --danger: #E85D75;
    --danger-dark: #D63031;
    --info: #74B9FF;
    --dark: #1a1a2e;
    --darker: #16213e;
    --light: #F8F9FD;
    --gray-50: #FAFBFE;
    --gray-100: #F1F3F9;
    --gray-200: #E2E6F0;
    --gray-300: #CBD2E0;
    --gray-400: #8E99B0;
    --gray-500: #64708D;
    --gray-600: #475069;
    --sidebar-width: 260px;
    --header-height: 60px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--light);
    color: #2d3436;
    min-height: 100vh;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ========== Tables ========== */
.table-fichaje {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-fichaje th {
    background: var(--gray-100);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.table-fichaje td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table-fichaje tbody tr:hover {
    background: var(--gray-50);
}

/* ========== Buttons ========== */
.btn-primary-custom {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-success-custom {
    background: var(--success);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-success-custom:hover {
    background: var(--success-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-danger-custom {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-custom:hover {
    background: var(--danger-dark);
    color: white;
}

.btn-outline-custom {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-custom:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* ========== Cards ========== */
.card-custom {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.card-custom h2, .card-custom h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== Stat Cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-icon.bg-primary { background: var(--primary); }
.stat-icon.bg-success { background: var(--success); }
.stat-icon.bg-warning { background: var(--warning-dark); }
.stat-icon.bg-danger { background: var(--danger); }
.stat-icon.bg-info { background: var(--info); }
.stat-icon.bg-secondary { background: var(--secondary); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1;
}

.stat-info p {
    color: var(--gray-500);
    font-size: 13px;
    margin: 0;
    margin-top: 4px;
}

/* ========== Badges ========== */
.badge-estado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-completa { background: #dcfce7; color: #166534; }
.badge-incompleta { background: #fef3c7; color: #92400e; }
.badge-sin_fichaje { background: #fee2e2; color: #991b1b; }
.badge-vacaciones { background: #dbeafe; color: #1e40af; }
.badge-festivo { background: #f3e8ff; color: #6b21a8; }
.badge-ausencia { background: #fae8ff; color: #86198f; }
.badge-baja_medica { background: #ffe4e6; color: #be123c; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-aprobada { background: #dcfce7; color: #166534; }
.badge-rechazada { background: #fee2e2; color: #991b1b; }
.badge-cancelada { background: var(--gray-200); color: var(--gray-600); }

/* ========== Fichaje Button (PWA) ========== */
.fichaje-btn {
    width: 100%;
    max-width: 320px;
    padding: 24px;
    border: none;
    border-radius: 20px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fichaje-btn-entrada {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 8px 24px rgba(0, 217, 126, 0.3);
}

.fichaje-btn-entrada:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 217, 126, 0.4);
}

.fichaje-btn-salida {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 8px 24px rgba(232, 93, 117, 0.3);
}

.fichaje-btn-salida:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(232, 93, 117, 0.4);
}

.fichaje-btn-pausa {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: white;
    box-shadow: 0 8px 24px rgba(253, 203, 110, 0.3);
}

/* ========== Calendar Grid ========== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
    padding: 8px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-day:hover { background: var(--gray-100); }
.calendar-day.today { border: 2px solid var(--primary); }
.calendar-day.completa { background: #dcfce7; color: #166534; }
.calendar-day.incompleta { background: #fef3c7; color: #92400e; }
.calendar-day.sin_fichaje { background: #fee2e2; color: #991b1b; }
.calendar-day.vacaciones { background: #dbeafe; color: #1e40af; }
.calendar-day.festivo { background: #f3e8ff; color: #6b21a8; }
.calendar-day.other-month { opacity: 0.3; }
.calendar-day.weekend { color: var(--gray-400); }

.calendar-day small {
    font-size: 9px;
    margin-top: 2px;
}

/* ========== Forms ========== */
.form-label-custom {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 13px;
    margin-bottom: 6px;
}

.form-control-custom {
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
    outline: none;
}

/* ========== Login Page ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--darker) 50%, var(--primary-dark) 100%);
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    background: white;
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast-item.toast-success { border-left-color: var(--success); }
.toast-item.toast-error { border-left-color: var(--danger); }
.toast-item.toast-warning { border-left-color: var(--warning-dark); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== Filters Bar ========== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.filters-bar .form-control,
.filters-bar .form-select {
    border-radius: 10px;
    border: 1px solid var(--gray-300);
    padding: 8px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info h3 {
        font-size: 22px;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filters-bar .form-control,
    .filters-bar .form-select {
        width: 100%;
    }

    .fichaje-btn {
        max-width: 100%;
        padding: 20px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        font-size: 12px;
    }
}
