/* 
 * Sistema de Diseño Visual - Laboratorios Labic
 * Diseño Premium: Glassmorphism, HSL Teal y Paleta Slate Oscura
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-sans: 'Outfit', sans-serif;
    
    /* Paleta de colores HSL */
    --primary-h: 174;
    --primary-s: 84%;
    --primary-l: 31%; /* Teal */
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-light: hsl(var(--primary-h), var(--primary-s), 45%);
    --primary-glow: hsla(var(--primary-h), var(--primary-s), 50%, 0.15);
    --primary-bg: hsl(var(--primary-h), 50%, 97%);
    
    --dark-bg: #0f172a; /* Slate 900 */
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-bg-dark: rgba(15, 23, 42, 0.65);
    
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: rgba(226, 232, 240, 0.8); /* Slate 200 */
    
    --success: #10b981; /* Emerald 500 */
    --error: #ef4444; /* Red 500 */
    --warning: #f59e0b; /* Amber 500 */
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.03);
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #f0fdfa 0%, #e2e8f0 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Fondo decorativo dinámico */
.bg-decor {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    top: -200px;
    left: -200px;
    z-index: -1;
    pointer-events: none;
}

.bg-decor-right {
    position: absolute;
    width: 650px;
    height: 650px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, rgba(255, 255, 255, 0) 70%);
    bottom: -200px;
    right: -200px;
    z-index: -1;
    pointer-events: none;
}

/* Contenedor principal Glassmorphism */
.glass-container {
    width: 100%;
    max-width: 520px;
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    transition: var(--transition);
    position: relative;
}

.glass-container-wide {
    max-width: 900px;
}

/* Animación de entrada de tarjeta */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Encabezado */
.brand-header {
    text-align: center;
    margin-bottom: 30px;
}

.brand-header img {
    height: 80px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
    transition: var(--transition);
}

.brand-header img:hover {
    transform: scale(1.05) rotate(2deg);
}

.brand-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.brand-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Formulario */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 15px;
    background: rgba(248, 250, 252, 0.8);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    background: #ffffff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Animación de etiqueta en foco */
.form-group.focused .form-label {
    color: var(--primary-light);
}

/* Botón Premium */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
    transition: var(--transition);
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Botón secundario */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(241, 245, 249, 0.6);
    border-color: var(--text-muted);
}

/* Pantalla del código de verificación */
.verification-container {
    display: none;
    text-align: center;
}

.verification-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.verification-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Cajas individuales para el código de 6 dígitos */
.code-inputs {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    max-width: 320px;
    margin: 0 auto 24px auto;
}

.code-digit {
    width: 45px;
    height: 50px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(248, 250, 252, 0.8);
    outline: none;
    color: var(--primary);
    transition: var(--transition);
}

.code-digit:focus {
    border-color: var(--primary-light);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Temporizador */
.timer-wrapper {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.timer-text span {
    font-weight: 700;
    color: var(--primary-light);
}

.timer-bar-container {
    width: 180px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.timer-bar {
    width: 100%;
    height: 100%;
    background: var(--primary-light);
    border-radius: 2px;
    transition: width 1s linear;
}

/* Alertas dinámicas */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid transparent;
    animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.alert-danger {
    background-color: #fee2e2;
    color: var(--error);
    border-left-color: var(--error);
}

.alert-success {
    background-color: #d1fae5;
    color: var(--success);
    border-left-color: var(--success);
}

.alert-warning {
    background-color: #fef3c7;
    color: var(--warning);
    border-left-color: var(--warning);
}

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

/* Estilo para la lista de protocolos */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.patient-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.patient-info p {
    font-size: 13.5px;
    color: var(--text-muted);
}

.btn-logout {
    padding: 8px 14px;
    background: #f1f5f9;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #fee2e2;
    color: var(--error);
}

/* Tabla de Protocolos */
.protocols-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.protocols-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14.5px;
}

.protocols-table th {
    background: #f8fafc;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1.5px solid var(--border-color);
}

.protocols-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.protocols-table tr:last-child td {
    border-bottom: none;
}

.protocols-table tr:hover td {
    background: #f8fafc;
}

/* Estado y tipo */
.estudio-tag {
    display: inline-flex;
    padding: 4px 10px;
    background: #f0fdfa;
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.btn-download {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.15);
    white-space: nowrap;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.btn-view-inline {
    padding: 8px 14px;
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(71, 85, 105, 0.15);
    white-space: nowrap;
}

.btn-view-inline:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(71, 85, 105, 0.25);
}

/* Pie de Página */
.footer-text {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Spinner de carga */
.spinner {
    border: 3px solid rgba(13, 148, 136, 0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* Temporizador Flotante de Cierre de Sesión */
.session-timer-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    animation: fadeInUp 0.3s ease-out forwards;
}

/* Móvil Responsivo */
@media (max-width: 640px) {
    .glass-container {
        padding: 24px 16px;
    }
    
    .code-inputs {
        gap: 6px;
    }
    
    .code-digit {
        width: 38px;
        height: 44px;
        font-size: 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .btn-logout {
        align-self: flex-end;
    }

    /* Transformar tabla en tarjetas para celulares */
    .protocols-table-wrapper {
        border: none;
        background: transparent;
    }
    
    .protocols-table, 
    .protocols-table thead, 
    .protocols-table tbody, 
    .protocols-table th, 
    .protocols-table td, 
    .protocols-table tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    .protocols-table thead {
        display: none;
    }
    
    .protocols-table tr {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: var(--radius-sm);
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
    }
    
    .protocols-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
    }
    
    .protocols-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 13px;
        text-align: left;
        padding-right: 12px;
    }
    
    .protocols-table td[data-label="Acciones"] {
        border-bottom: none;
        padding-top: 14px;
        display: block;
        text-align: center;
    }
    
    .protocols-table td[data-label="Acciones"]::before {
        display: none;
    }
    
    .protocols-table td[data-label="Acciones"] div {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: center;
    }
    
    .protocols-table td[data-label="Acciones"] a {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   ESTILOS ADICIONALES PARA EL MÓDULO ADMINISTRATIVO
   ========================================================================== */

/* Acordeón de Protocolos Administrativo */
.admin-protocols-accordion {
    margin-top: 15px;
}

.accordion-toggle:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

.accordion-content {
    animation: fadeInDown 0.25s ease-out forwards;
}

/* Modales */
.modal-overlay {
    animation: fadeIn 0.3s ease-out forwards;
}

.modal-overlay .glass-container {
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tarjeta de Paciente */
.patient-card {
    transition: transform 0.2s, border-color 0.2s;
}

.patient-card:hover {
    border-color: rgba(13, 148, 136, 0.3) !important;
    transform: translateY(-2px);
}

/* Formulario de Búsqueda */
.admin-search-form {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: var(--radius-md);
}
