/**
 * ============================================
 * SISTEMA EUNACOM - ESTILOS GLOBALES
 * Universidad de Chile - Medicina
 * Compatible con todos los módulos
 * ============================================
 */

/* ============================================
   RESET Y BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ============================================
   CONTENEDORES PRINCIPALES
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: white;
    border-radius: 15px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.header-left p {
    color: #7f8c8d;
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
}

.user-email {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* ============================================
   BOXES DE LOGIN/REGISTRO
   ============================================ */
.login-box,
.login-container,
.register-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    width: 100%;
    max-width: 450px;
}

.login-box {
    padding: 40px;
}

.register-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.register-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.register-header p {
    opacity: 0.9;
}

.register-body {
    padding: 40px 30px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 5px;
}

.logo p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input::placeholder {
    color: #adb5bd;
}

small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.85rem;
}

/* ============================================
   BOTONES
   ============================================ */
.btn-primary,
button[type="submit"] {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-primary:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:active,
button[type="submit"]:active {
    transform: translateY(0);
}

.btn-logout {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-home-green {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-home-green:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-home-blue {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-home-blue:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* ============================================
   ALERTAS Y MENSAJES
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.mensaje-exito {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.mensaje-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* ============================================
   LINKS
   ============================================ */
.link-secundario {
    display: inline-block;
    margin-top: 15px;
    color: #667eea;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.link-secundario:hover {
    color: #764ba2;
    text-decoration: underline;
}

.link-primary {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.link-primary:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ============================================
   SEPARADORES Y DIVIDERS
   ============================================ */
.divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e9ecef;
}

.divider span {
    background: white;
    padding: 0 15px;
    position: relative;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* ============================================
   CÓDIGO DE RECUPERACIÓN
   ============================================ */
.codigo-box {
    background: #f0f9ff;
    border: 2px dashed #0ea5e9;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    margin: 20px 0;
}

.codigo-display {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 10px;
    color: #0369a1;
    font-family: monospace;
    margin: 20px 0;
    user-select: all;
}

.codigo-instruccion {
    color: #0c4a6e;
    font-size: 14px;
    margin-top: 15px;
}

.expiracion-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 13px;
}

/* ============================================
   CARDS Y CONTENEDORES
   ============================================ */
.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h2, .card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

/* ============================================
   WELCOME BANNER
   ============================================ */
.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.welcome-banner h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.welcome-banner p {
    opacity: 0.95;
    font-size: 1.1rem;
}

/* ============================================
   MÓDULOS (Grid de 3 columnas)
   ============================================ */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.module-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.module-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.module-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.module-card p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.module-btn {
    display: inline-block;
    padding: 10px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.module-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 10px;
    color: #7f8c8d;
}

.breadcrumb-current {
    color: #2c3e50;
    font-weight: 600;
}

/* ============================================
   ESTADÍSTICAS (Stats Grid)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* ============================================
   ACTIVIDAD RECIENTE
   ============================================ */
.recent-activity {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.recent-activity h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.activity-item {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-finalizado {
    background: #d4edda;
    color: #155724;
}

.status-en-curso {
    background: #fff3cd;
    color: #856404;
}

/* ============================================
   CONFIGURACIÓN ALERT (Solo desarrollo)
   ============================================ */
.config-alert {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-alert strong {
    color: #856404;
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-info {
        text-align: left;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .codigo-display {
        font-size: 32px;
        letter-spacing: 5px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header-left h1 {
        font-size: 1.4rem;
    }
    
    .login-box,
    .register-body {
        padding: 30px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}