/* Control de Asistencia - Estilos v1.1 */

#ca-container {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ca-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    border-radius: 12px;
    color: white;
}

.ca-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.ca-fecha {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

/* ========================================
   PANEL DE ADMINISTRACIÓN
   ======================================== */
.ca-admin-panel {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.ca-admin-header {
    background: #f59e0b;
    color: #000;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 14px;
}

.ca-admin-controles {
    padding: 15px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.ca-admin-grupo {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ca-admin-grupo label {
    font-size: 14px;
    color: #92400e;
    font-weight: 500;
}

.ca-admin-grupo input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #d97706;
    border-radius: 6px;
    font-size: 14px;
}

.ca-btn-admin {
    background: #d97706;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ca-btn-admin:hover {
    background: #b45309;
}

.ca-btn-admin.ca-btn-danger {
    background: #dc2626;
}

.ca-btn-admin.ca-btn-danger:hover {
    background: #b91c1c;
}

/* ========================================
   PANEL DE REGISTRO
   ======================================== */
.ca-registro-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.ca-input-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.ca-input-group label {
    font-weight: 600;
    color: #334155;
    font-size: 16px;
}

#ca-rut {
    flex: 1;
    min-width: 200px;
    font-size: 24px;
    padding: 12px 18px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    transition: border-color 0.2s;
}

#ca-rut:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#ca-btn-registrar {
    background: #16a34a;
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#ca-btn-registrar:hover {
    background: #15803d;
    transform: translateY(-1px);
}

#ca-btn-registrar:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
#ca-feedback {
    margin-top: 15px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 15px;
    display: none;
}

#ca-feedback.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

#ca-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ========================================
   FORMULARIO REGISTRO MANUAL
   ======================================== */
.ca-registro-manual {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.ca-manual-header {
    background: #3b82f6;
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ca-btn-cancelar {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.ca-btn-cancelar:hover {
    background: rgba(255,255,255,0.3);
}

.ca-manual-info {
    padding: 15px 15px 0 15px;
    margin: 0;
    color: #1e40af;
    font-size: 14px;
}

.ca-manual-form {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.ca-campo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ca-campo label {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}

.ca-campo input {
    padding: 10px 12px;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 15px;
}

.ca-campo input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.ca-campo input[readonly] {
    background: #dbeafe;
    font-family: 'Courier New', monospace;
}

.ca-btn-guardar {
    grid-column: 1 / -1;
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ca-btn-guardar:hover {
    background: #1d4ed8;
}

.ca-btn-guardar:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ========================================
   PANEL DE LISTA
   ======================================== */
.ca-lista-panel {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.ca-lista-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.ca-lista-header h3 {
    margin: 0;
    font-size: 18px;
    color: #334155;
}

#ca-total {
    background: #2563eb;
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 16px;
}

.ca-btn-descargar {
    background: #0369a1;
    color: white !important;
    text-decoration: none !important;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.ca-btn-descargar:hover {
    background: #075985;
}

/* Lista de asistentes */
#ca-lista-asistentes {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.ca-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px;
    font-size: 15px;
}

.ca-asistente-item {
    display: grid;
    grid-template-columns: 60px 1fr 120px 60px;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.ca-asistente-item.ca-invitado {
    background: #fef3c7;
    border-color: #fcd34d;
}

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

.ca-num {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 18px;
    color: #2563eb;
    text-align: center;
    background: #dbeafe;
    padding: 4px 8px;
    border-radius: 6px;
}

.ca-invitado .ca-num {
    background: #fde68a;
    color: #92400e;
}

.ca-nombre {
    font-weight: 500;
    color: #1e293b;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ca-badge-invitado {
    background: #f59e0b;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    text-transform: uppercase;
}

.ca-rut-display {
    font-family: 'Courier New', monospace;
    color: #64748b;
    font-size: 13px;
}

.ca-hora {
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .ca-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    #ca-rut {
        width: 100%;
    }
    
    .ca-lista-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .ca-asistente-item {
        grid-template-columns: 50px 1fr;
        grid-template-rows: auto auto;
    }
    
    .ca-rut-display, .ca-hora {
        grid-column: 2;
    }
    
    .ca-admin-controles {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ca-admin-grupo {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ca-manual-form {
        grid-template-columns: 1fr;
    }
}
