/* =====================================================
   PLATAFORMA DDSI - Diseño de Sistemas de Información
   Estilos principales
   UTN Argentina - Todas las regionales
   ===================================================== */

/* =====================================================
   VARIABLES Y RESET
   ===================================================== */
:root {
    /* Paleta UTN - Azul institucional + acentos modernos */
    --utn-azul: #1a3a5c;
    --utn-azul-claro: #2563eb;
    --utn-azul-hover: #1d4ed8;
    --utn-celeste: #3b82f6;
    --utn-verde: #16a34a;
    --utn-rojo: #dc2626;
    --utn-naranja: #ea580c;
    --utn-dorado: #d97706;

    /* Fondos y superficies */
    --bg-principal: #f8fafc;
    --bg-tarjeta: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-input: #f1f5f9;
    --bg-hover: #e2e8f0;

    /* Texto */
    --texto-principal: #1e293b;
    --texto-secundario: #64748b;
    --texto-terciario: #94a3b8;
    --texto-blanco: #f8fafc;

    /* Bordes y sombras */
    --borde: #e2e8f0;
    --borde-focus: #3b82f6;
    --sombra-sm: 0 1px 2px rgba(0,0,0,0.05);
    --sombra-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --sombra-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    --sombra-xl: 0 20px 40px -10px rgba(0,0,0,0.15);

    /* Tipografía */
    --fuente-principal: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    --fuente-titulo: 'Outfit', 'Source Sans 3', sans-serif;
    --fuente-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Espaciado */
    --radio-sm: 6px;
    --radio-md: 10px;
    --radio-lg: 16px;
    --radio-xl: 24px;

    /* Layout */
    --sidebar-ancho: 260px;
    --header-alto: 64px;
    --contenido-max: 1200px;

    /* Transiciones */
    --transicion: 0.2s ease;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--fuente-principal);
    color: var(--texto-principal);
    background: var(--bg-principal);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--utn-azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.contenido-principal {
    flex: 1;
    margin-left: var(--sidebar-ancho);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.pagina-contenido {
    flex: 1;
    padding: 24px 32px;
    max-width: var(--contenido-max);
    width: 100%;
    margin: 0 auto;
}

/* =====================================================
   SIDEBAR / NAVEGACIÓN LATERAL
   ===================================================== */

.sidebar {
    width: var(--sidebar-ancho);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transicion);
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icono {
    width: 40px;
    height: 40px;
    background: var(--utn-azul-claro);
    border-radius: var(--radio-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-logo .logo-texto {
    display: flex;
    flex-direction: column;
}

.sidebar-logo .logo-titulo {
    color: var(--texto-blanco);
    font-family: var(--fuente-titulo);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-logo .logo-sub {
    color: var(--texto-terciario);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-seccion-titulo {
    color: var(--texto-terciario);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radio-md);
    color: #94a3b8;
    cursor: pointer;
    transition: all var(--transicion);
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--texto-blanco);
    text-decoration: none;
}

.nav-item.activo {
    background: rgba(37,99,235,0.15);
    color: var(--utn-azul-claro);
}

.nav-item .nav-icono {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--utn-azul-claro);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-usuario {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-usuario .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--utn-azul-claro);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-usuario .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-usuario .info-nombre {
    color: var(--texto-blanco);
    font-size: 13px;
    font-weight: 600;
}

.sidebar-usuario .info-rol {
    color: var(--texto-terciario);
    font-size: 11px;
}

/* =====================================================
   HEADER / BARRA SUPERIOR
   ===================================================== */

.header-top {
    height: var(--header-alto);
    border-bottom: 1px solid var(--borde);
    background: var(--bg-tarjeta);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-titulo {
    font-family: var(--fuente-titulo);
    font-size: 20px;
    font-weight: 700;
    color: var(--texto-principal);
}

.header-acciones {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =====================================================
   BOTONES
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radio-md);
    font-family: var(--fuente-principal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transicion);
    white-space: nowrap;
}

.btn-primario {
    background: var(--utn-azul-claro);
    color: white;
}
.btn-primario:hover { background: var(--utn-azul-hover); transform: translateY(-1px); }

.btn-secundario {
    background: var(--bg-input);
    color: var(--texto-principal);
    border: 1px solid var(--borde);
}
.btn-secundario:hover { background: var(--bg-hover); }

.btn-exito {
    background: var(--utn-verde);
    color: white;
}
.btn-exito:hover { background: #15803d; }

.btn-peligro {
    background: var(--utn-rojo);
    color: white;
}
.btn-peligro:hover { background: #b91c1c; }

.btn-outline {
    background: transparent;
    color: var(--utn-azul-claro);
    border: 1.5px solid var(--utn-azul-claro);
}
.btn-outline:hover { background: rgba(37,99,235,0.06); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =====================================================
   TARJETAS
   ===================================================== */

.tarjeta {
    background: var(--bg-tarjeta);
    border: 1px solid var(--borde);
    border-radius: var(--radio-lg);
    padding: 24px;
    transition: box-shadow var(--transicion);
}

.tarjeta:hover {
    box-shadow: var(--sombra-md);
}

.tarjeta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tarjeta-titulo {
    font-family: var(--fuente-titulo);
    font-size: 18px;
    font-weight: 700;
    color: var(--texto-principal);
}

.tarjeta-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--texto-secundario);
    font-size: 13px;
    margin-top: 12px;
}

.tarjeta-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =====================================================
   GRILLA DE TARJETAS
   ===================================================== */

.grilla {
    display: grid;
    gap: 20px;
}

.grilla-2 { grid-template-columns: repeat(2, 1fr); }
.grilla-3 { grid-template-columns: repeat(3, 1fr); }
.grilla-4 { grid-template-columns: repeat(4, 1fr); }

/* =====================================================
   FORMULARIOS
   ===================================================== */

.form-grupo {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-principal);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--borde);
    border-radius: var(--radio-md);
    font-family: var(--fuente-principal);
    font-size: 14px;
    color: var(--texto-principal);
    background: var(--bg-tarjeta);
    transition: border-color var(--transicion);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--borde-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-error {
    color: var(--utn-rojo);
    font-size: 12px;
    margin-top: 4px;
}

/* =====================================================
   BADGES / ETIQUETAS
   ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-azul { background: #dbeafe; color: #1e40af; }
.badge-verde { background: #dcfce7; color: #166534; }
.badge-naranja { background: #ffedd5; color: #9a3412; }
.badge-rojo { background: #fee2e2; color: #991b1b; }
.badge-gris { background: #f1f5f9; color: #475569; }
.badge-docente { background: #ede9fe; color: #5b21b6; }

/* =====================================================
   MODALES
   ===================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    display: flex;
}

.modal-contenido {
    background: var(--bg-tarjeta);
    border-radius: var(--radio-xl);
    padding: 32px;
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--sombra-xl);
    animation: modalEntrar 0.25s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-titulo {
    font-family: var(--fuente-titulo);
    font-size: 20px;
    font-weight: 700;
}

.modal-cerrar {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--texto-secundario);
    transition: all var(--transicion);
}

.modal-cerrar:hover {
    background: var(--bg-hover);
    color: var(--texto-principal);
}

/* =====================================================
   NOTIFICACIONES / TOAST
   ===================================================== */

.toast-contenedor {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radio-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--sombra-lg);
    animation: toastEntrar 0.3s ease;
    max-width: 400px;
}

.toast-exito { background: #16a34a; color: white; }
.toast-error { background: #dc2626; color: white; }
.toast-info { background: #2563eb; color: white; }

@keyframes toastEntrar {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =====================================================
   ESTADOS VACÍOS
   ===================================================== */

.estado-vacio {
    text-align: center;
    padding: 60px 20px;
    color: var(--texto-secundario);
}

.estado-vacio .icono {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.estado-vacio h3 {
    font-size: 18px;
    color: var(--texto-principal);
    margin-bottom: 8px;
}

/* =====================================================
   SECCIONES DE LA HOME
   ===================================================== */

.hero-seccion {
    background: linear-gradient(135deg, var(--utn-azul) 0%, #1e3a5f 50%, #2563eb 100%);
    color: white;
    padding: 48px 40px;
    border-radius: var(--radio-xl);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.hero-seccion::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, transparent 70%);
    pointer-events: none;
}

.hero-titulo {
    font-family: var(--fuente-titulo);
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    position: relative;
}

.hero-descripcion {
    font-size: 16px;
    opacity: 0.85;
    max-width: 600px;
    position: relative;
}

.seccion-titulo {
    font-family: var(--fuente-titulo);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =====================================================
   SECCIÓN GAMIFICACIÓN - TARJETAS DE JUEGOS
   ===================================================== */

.juego-tarjeta {
    background: var(--bg-tarjeta);
    border: 1px solid var(--borde);
    border-radius: var(--radio-lg);
    overflow: hidden;
    transition: all var(--transicion);
    cursor: pointer;
}

.juego-tarjeta:hover {
    transform: translateY(-4px);
    box-shadow: var(--sombra-lg);
}

.juego-tarjeta .juego-imagen {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
}

.juego-tarjeta .juego-info {
    padding: 20px;
}

.juego-tarjeta .juego-nombre {
    font-family: var(--fuente-titulo);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.juego-tarjeta .juego-desc {
    font-size: 13px;
    color: var(--texto-secundario);
    line-height: 1.5;
}

.juego-tarjeta.en-construccion {
    opacity: 0.6;
    cursor: not-allowed;
}

.juego-tarjeta.en-construccion:hover {
    transform: none;
    box-shadow: none;
}

/* Colores para cada juego */
.juego-sopa .juego-imagen { background: linear-gradient(135deg, #818cf8, #6366f1); }
.juego-torneo .juego-imagen { background: linear-gradient(135deg, #f97316, #ea580c); }
.juego-escape .juego-imagen { background: linear-gradient(135deg, #10b981, #059669); }
.juego-ahorcado .juego-imagen { background: linear-gradient(135deg, #f43f5e, #e11d48); }

/* =====================================================
   SECCIÓN MATERIALES DOCENTES
   ===================================================== */

.material-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radio-md);
    width: fit-content;
}

.material-tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: var(--radio-sm);
    font-family: var(--fuente-principal);
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-secundario);
    cursor: pointer;
    transition: all var(--transicion);
}

.material-tab.activo {
    background: var(--bg-tarjeta);
    color: var(--texto-principal);
    box-shadow: var(--sombra-sm);
}

.material-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tarjeta);
    border: 1px solid var(--borde);
    border-radius: var(--radio-md);
    transition: all var(--transicion);
}

.material-item:hover {
    box-shadow: var(--sombra-sm);
}

.material-item .archivo-icono {
    width: 44px;
    height: 44px;
    border-radius: var(--radio-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.material-item .archivo-icono.pdf { background: #fee2e2; }
.material-item .archivo-icono.ppt { background: #ffedd5; }
.material-item .archivo-icono.video { background: #e0e7ff; }
.material-item .archivo-icono.doc { background: #dbeafe; }
.material-item .archivo-icono.otro { background: #f1f5f9; }

.material-item .material-info { flex: 1; min-width: 0; }
.material-item .material-nombre {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-item .material-detalle {
    font-size: 12px;
    color: var(--texto-secundario);
}

/* =====================================================
   PÁGINA DE LOGIN / REGISTRO
   ===================================================== */

.auth-pagina {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
    padding: 20px;
}

.auth-tarjeta {
    background: var(--bg-tarjeta);
    border-radius: var(--radio-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--sombra-xl);
}

.auth-tarjeta .auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-tarjeta .auth-logo h1 {
    font-family: var(--fuente-titulo);
    font-size: 28px;
    font-weight: 800;
    color: var(--utn-azul);
    margin-bottom: 4px;
}

.auth-tarjeta .auth-logo p {
    color: var(--texto-secundario);
    font-size: 14px;
}

.separador-o {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--texto-terciario);
    font-size: 13px;
}

.separador-o::before,
.separador-o::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--borde);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--borde);
    border-radius: var(--radio-md);
    background: white;
    font-family: var(--fuente-principal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transicion);
    color: var(--texto-principal);
}

.btn-google:hover {
    background: var(--bg-input);
    box-shadow: var(--sombra-sm);
}

/* =====================================================
   LOADING / SPINNER
   ===================================================== */

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--borde);
    border-top-color: var(--utn-azul-claro);
    border-radius: 50%;
    animation: girar 0.8s linear infinite;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

.cargando-pantalla {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    padding: 60px;
    color: var(--texto-secundario);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* Botón hamburguesa (solo visible en mobile) */
.btn-menu-mobile {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--texto-principal);
}

@media (max-width: 1024px) {
    .grilla-3 { grid-template-columns: repeat(2, 1fr); }
    .grilla-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.abierto {
        transform: translateX(0);
    }

    .contenido-principal {
        margin-left: 0;
    }

    .btn-menu-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pagina-contenido {
        padding: 16px;
    }

    .grilla-2,
    .grilla-3,
    .grilla-4 {
        grid-template-columns: 1fr;
    }

    .hero-seccion {
        padding: 28px 20px;
    }

    .hero-titulo {
        font-size: 24px;
    }

    .modal-contenido {
        width: 95%;
        padding: 24px;
    }

    .header-top {
        padding: 0 16px;
    }
}

/* =====================================================
   UTILIDADES
   ===================================================== */

.oculto { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--texto-secundario); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.lista-materiales { display: flex; flex-direction: column; gap: 12px; }
