/* style.css - Estilos Globales del Sistema */

:root {
    /* Paleta de Colores Institucional */
    --primary: #4a90e2;       /* Azul Principal */
    --primary-dark: #357abd;  /* Azul Oscuro (Hover) */
    --secondary: #2c3e50;     /* Gris Oscuro / Texto */
    --accent: #f1c40f;        /* Amarillo (Alertas/Recreo) */
    
    /* Semáforo de Estados */
    --success: #27ae60;       /* Verde (Asistió) */
    --danger: #e74c3c;        /* Rojo (Falta) */
    --warning: #f39c12;       /* Naranja (Observado) */
    --muted: #95a5a6;         /* Gris (Pendiente) */

    /* Fondos y Estructura */
    --bg-body: #f4f6f9;       /* Fondo de la página */
    --bg-card: #ffffff;       /* Fondo de tarjetas */
    --shadow-soft: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Tipografía */
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Reset Básico */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--secondary);
    font-size: 16px;
    line-height: 1.5;
}

/* --- COMPONENTES REUTILIZABLES (Para usar en Director y Docente) --- */

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-dark); }

.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { background-color: #c0392b; }

.btn-success { background-color: var(--success); color: white; }

.btn-block { display: block; width: 100%; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Inputs y Formularios */
.form-group { margin-bottom: 15px; text-align: left; }

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Tarjetas */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    padding: 20px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Utilidades de Texto */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--muted); }

/* Animación de Carga */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Estilos específicos del Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.brand-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

/* ============================================
   MENÚ DE BURBUJA DE CHAT (borrar mensajes)
   ============================================ */
.chat-bubble-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
}
/* Animación de entrada de burbuja nueva (mensaje recién recibido/enviado).
   Solo afecta transform + opacity → corre en compositor, no pelea con scroll. */
@keyframes bubble-slide-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.chat-bubble-wrap.bubble-slide-in {
    animation: bubble-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-bubble-menu-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, background 0.15s;
    font-size: 12px;
    color: #444;
    padding: 0;
    z-index: 2;
}
/* Desktop: aparecen SOLO al pasar el mouse por la burbuja */
@media (hover: hover) {
    .chat-bubble-wrap:hover .chat-bubble-menu-btn {
        opacity: 1;
        pointer-events: auto;
    }
}
.chat-bubble-menu-btn:hover { background: #fff; }

/* Móvil/touch: ocultar botón. Se usa long-press en la burbuja (manejado por JS). */
@media (hover: none) {
    .chat-bubble-menu-btn { display: none !important; }
}

/* Feedback visual durante long-press en móvil */
.chat-bubble-wrap.long-press-feedback {
    filter: brightness(0.92);
    transition: filter 0.1s;
}

.chat-bubble-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    padding: 6px 0;
    z-index: 9999;
    min-width: 200px;
    font-family: inherit;
    animation: chat-menu-pop 0.12s ease-out;
}
@keyframes chat-menu-pop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.chat-bubble-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    font-family: inherit;
}
.chat-bubble-menu button:hover { background: #f5f5f5; }
.chat-bubble-menu button.danger { color: #c0392b; }
.chat-bubble-menu button.danger:hover { background: #fdecea; }
.chat-bubble-menu button i { width: 18px; text-align: center; opacity: 0.8; }

.mensaje-eliminado {
    color: #888 !important;
    font-style: italic;
    font-size: 0.9rem !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   MODAL DE CONFIRMACIÓN SUAVE
   ============================================ */
.chat-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: chat-confirm-fade-in 0.2s ease-out forwards;
    padding: 16px;
    box-sizing: border-box;
}
.chat-confirm-backdrop.saliendo { animation: chat-confirm-fade-out 0.18s ease-in forwards; }
@keyframes chat-confirm-fade-in { to { opacity: 1; } }
@keyframes chat-confirm-fade-out { to { opacity: 0; } }

.chat-confirm-modal {
    background: white;
    border-radius: 14px;
    padding: 22px 22px 18px 22px;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    transform: scale(0.92);
    animation: chat-confirm-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-sizing: border-box;
}
.chat-confirm-modal.saliendo { animation: chat-confirm-pop-out 0.18s ease-in forwards; }
@keyframes chat-confirm-pop {
    from { transform: scale(0.92); }
    to { transform: scale(1); }
}
@keyframes chat-confirm-pop-out {
    to { transform: scale(0.94); }
}

.chat-confirm-mensaje {
    font-size: 1rem;
    color: #222;
    margin-bottom: 20px;
    line-height: 1.45;
}
.chat-confirm-botones {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.chat-confirm-botones button {
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s, transform 0.05s;
    font-family: inherit;
    min-height: 38px;
}
.chat-confirm-botones button:active { transform: scale(0.97); }
.chat-confirm-cancel {
    background: #ecf0f1;
    color: #555;
}
.chat-confirm-cancel:hover { background: #dfe6e9; }
.chat-confirm-ok {
    background: #3498db;
    color: white;
}
.chat-confirm-ok:hover { background: #2980b9; }
.chat-confirm-ok.danger { background: #e74c3c; }
.chat-confirm-ok.danger:hover { background: #c0392b; }

/* ============================================
   TOAST SUAVE
   ============================================ */
.chat-toast-suave {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2c3e50;
    color: white;
    padding: 12px 22px;
    border-radius: 22px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.22s, transform 0.22s;
    max-width: calc(100vw - 32px);
    text-align: center;
    font-size: 0.9rem;
    font-family: inherit;
}
.chat-toast-suave.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.chat-toast-error { background: #c0392b; }
.chat-toast-warning { background: #d68910; }
.chat-toast-info { background: #2c3e50; }
