/* ============================================
   Control Horario Pro v3.0.0 — Frontend Styles
   ============================================ */

:root {
    --ch-primary: #667eea;
    --ch-primary-dark: #5a67d8;
    --ch-secondary: #764ba2;
    --ch-success: #4caf50;
    --ch-success-dark: #45a049;
    --ch-danger: #f44336;
    --ch-danger-dark: #d32f2f;
    --ch-warning: #ff9800;
    --ch-warning-dark: #f57c00;
    --ch-info: #2196f3;
    --ch-info-dark: #1976d2;
    --ch-bg: #f8f9fa;
    --ch-card-bg: #ffffff;
    --ch-text: #333333;
    --ch-text-muted: #666666;
    --ch-border: #e0e0e0;
    --ch-radius: 16px;
    --ch-radius-sm: 12px;
    --ch-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --ch-shadow-lg: 0 10px 30px rgba(102, 126, 234, 0.3);
    --ch-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ch-dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: var(--ch-text);
    line-height: 1.6;
}

/* ===== Header ===== */
.ch-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 25px;
    background: linear-gradient(135deg, var(--ch-primary) 0%, var(--ch-secondary) 100%);
    color: white;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow-lg);
    position: relative;
    overflow: hidden;
}

.ch-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: ch-pulse 8s ease-in-out infinite;
}

@keyframes ch-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.ch-header h2 {
    margin: 0 0 15px 0;
    font-size: 1.5rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.ch-reloj {
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

.ch-fecha {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 8px;
    text-transform: capitalize;
    position: relative;
    z-index: 1;
}

/* ===== Estado Actual ===== */
.ch-estado-actual {
    text-align: center;
    margin: 25px 0;
    padding: 18px;
    border-radius: var(--ch-radius-sm);
    font-size: 1.3rem;
    font-weight: 600;
    transition: var(--ch-transition);
    background: var(--ch-card-bg);
    box-shadow: var(--ch-shadow);
}

.ch-estado-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    border-radius: 50px;
    background: #e0e0e0;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: var(--ch-transition);
}

.ch-estado-trabajando .ch-estado-badge { 
    background: var(--ch-success); 
    color: white; 
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}
.ch-estado-pausa .ch-estado-badge { 
    background: var(--ch-warning); 
    color: white; 
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}
.ch-estado-fuera .ch-estado-badge { 
    background: var(--ch-danger); 
    color: white; 
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

/* ===== Botones ===== */
.ch-botones {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.ch-btn {
    padding: 22px 18px;
    border: none;
    border-radius: var(--ch-radius-sm);
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ch-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.ch-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ch-btn:active::after {
    width: 300px;
    height: 300px;
}

.ch-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.ch-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ch-btn .ch-btn-icon {
    font-size: 1.4rem;
}

.ch-btn .ch-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ch-spin 0.8s linear infinite;
}

.ch-btn.loading .ch-spinner { display: inline-block; }
.ch-btn.loading .ch-btn-icon { display: none; }

@keyframes ch-spin {
    to { transform: rotate(360deg); }
}

.ch-btn-entrada { 
    background: linear-gradient(135deg, var(--ch-success), var(--ch-success-dark)); 
    color: white; 
}
.ch-btn-salida { 
    background: linear-gradient(135deg, var(--ch-danger), var(--ch-danger-dark)); 
    color: white; 
}
.ch-btn-pausa { 
    background: linear-gradient(135deg, var(--ch-warning), var(--ch-warning-dark)); 
    color: white; 
}
.ch-btn-pausa-fin { 
    background: linear-gradient(135deg, var(--ch-info), var(--ch-info-dark)); 
    color: white; 
}

/* ===== Notas ===== */
.ch-notas {
    margin: 20px 0;
}

.ch-notas textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--ch-border);
    border-radius: var(--ch-radius-sm);
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--ch-transition);
    background: var(--ch-card-bg);
}

.ch-notas textarea:focus {
    outline: none;
    border-color: var(--ch-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ch-notas textarea::placeholder {
    color: #aaa;
}

/* ===== Toast Notifications ===== */
#ch-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.ch-toast {
    padding: 16px 20px;
    border-radius: var(--ch-radius-sm);
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: ch-toast-in 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.ch-toast.ch-toast-success { background: rgba(76, 175, 80, 0.95); }
.ch-toast.ch-toast-error { background: rgba(244, 67, 54, 0.95); }
.ch-toast.ch-toast-warning { background: rgba(255, 152, 0, 0.95); }
.ch-toast.ch-toast-info { background: rgba(33, 150, 243, 0.95); }

.ch-toast.ch-toast-out {
    animation: ch-toast-out 0.3s ease-in forwards;
}

@keyframes ch-toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes ch-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== Resumen de Hoy ===== */
.ch-resumen-hoy {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 28px;
    border-radius: var(--ch-radius);
    margin: 25px 0;
    border: 1px solid #dee2e6;
    animation: ch-fade-in 0.5s ease-out;
}

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

.ch-resumen-hoy h3 {
    margin: 0 0 20px 0;
    color: var(--ch-text);
    font-size: 1.2rem;
    font-weight: 600;
}

.ch-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ch-stat {
    text-align: center;
    padding: 20px 15px;
    background: white;
    border-radius: var(--ch-radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: var(--ch-transition);
}

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

.ch-stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--ch-primary);
    line-height: 1.2;
}

.ch-stat-value.positive { color: var(--ch-success); }
.ch-stat-value.negative { color: var(--ch-danger); }

.ch-stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--ch-text-muted);
    margin-top: 8px;
    font-weight: 500;
}

/* ===== Graficos ===== */
.ch-grafico-semanal, .ch-grafico-mensual {
    margin-top: 30px;
    background: var(--ch-card-bg);
    padding: 28px;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    animation: ch-fade-in 0.5s ease-out;
}

.ch-grafico-semanal h3, .ch-grafico-mensual h3 {
    margin: 0 0 20px 0;
    color: var(--ch-text);
    font-size: 1.15rem;
    font-weight: 600;
}

.ch-chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

/* ===== Historial ===== */
.ch-historial, .ch-resumen-semanal {
    margin-top: 30px;
    background: var(--ch-card-bg);
    padding: 28px;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    animation: ch-fade-in 0.5s ease-out;
}

.ch-historial h3, .ch-resumen-semanal h3 {
    margin: 0 0 20px 0;
    color: var(--ch-text);
    font-size: 1.15rem;
    font-weight: 600;
}

.ch-tabla-container {
    overflow-x: auto;
    border-radius: var(--ch-radius-sm);
    border: 1px solid var(--ch-border);
}

.ch-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ch-tabla th, .ch-tabla td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.ch-tabla th {
    font-weight: 600;
    color: var(--ch-text-muted);
    background: #f8f9fa;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.ch-tabla tbody tr {
    transition: background 0.2s;
}

.ch-tabla tbody tr:hover {
    background: #f8f9fa;
}

.ch-tabla tbody tr:last-child td {
    border-bottom: none;
}

.ch-tabla .ch-tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.ch-tipo-entrada { background: #d4edda; color: #155724; }
.ch-tipo-salida { background: #f8d7da; color: #721c24; }
.ch-tipo-pausa_inicio { background: #fff3cd; color: #856404; }
.ch-tipo-pausa_fin { background: #cce5ff; color: #004085; }

/* ===== Alertas ===== */
.ch-alert {
    padding: 20px;
    border-radius: var(--ch-radius-sm);
    margin: 20px 0;
    font-weight: 500;
}

.ch-alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.ch-alert a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .ch-dashboard { padding: 12px; }
    .ch-header { padding: 20px 15px; }
    .ch-reloj { font-size: 2.5rem; }
    .ch-botones { grid-template-columns: 1fr; }
    .ch-stats-grid { grid-template-columns: 1fr; }
    .ch-chart-container { height: 250px; }
    .ch-btn { padding: 18px 14px; font-size: 1rem; }
    #ch-toast-container { left: 10px; right: 10px; max-width: none; }
}

@media (max-width: 480px) {
    .ch-reloj { font-size: 2rem; }
    .ch-header h2 { font-size: 1.2rem; }
    .ch-estado-actual { font-size: 1.1rem; padding: 14px; }
    .ch-stat-value { font-size: 1.8rem; }
}
