/* ===========================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   =========================================== */
:root {
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1e40af;
    --white: #ffffff;
    --light-gray: #f8fafc;
    --gray: #e2e8f0;
    --dark-gray: #64748b;
    --text-dark: #1e293b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===========================================
   ANIMACIONES KEYFRAMES
   =========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ===========================================
   SISTEMA DE PÁGINAS
   =========================================== */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s var(--transition-normal);
}

/* ===========================================
   PÁGINA DE AUTENTICACIÓN
   =========================================== */
#authPage {
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 50%, #3b82f6 100%);
    background-size: 200% 200%;
    animation: gradient 15s ease infinite;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#authPage.active {
    display: flex;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    animation: fadeInScale 0.6s var(--transition-normal);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideInLeft 0.8s var(--transition-normal);
}

.logo-main {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 30px;
    box-shadow: var(--shadow-xl);
    animation: bounce 2s infinite;
}

.logo-text {
    font-size: 3.5em;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 10px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: -1px;
}

.tagline {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

.auth-box {
    background: var(--white);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideInRight 0.8s var(--transition-normal);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--light-gray);
    padding: 6px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--dark-gray);
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.auth-tab.active {
    background: var(--white);
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
    color: var(--text-dark);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s var(--transition-fast);
}

.form-notice {
    background: #eff6ff;
    border-left: 4px solid var(--primary-blue);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    animation: slideInLeft 0.4s var(--transition-normal);
}

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

.form-notice p {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.form-notice p:last-child {
    margin-bottom: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray);
    border-radius: 10px;
    font-size: 15px;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--gray);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    background: var(--danger);
    transition: all var(--transition-normal);
}

.strength-bar.weak {
    width: 33%;
    background: var(--danger);
}

.strength-bar.medium {
    width: 66%;
    background: var(--warning);
}

.strength-bar.strong {
    width: 100%;
    background: var(--success);
}

.btn-primary,
.btn-secondary,
.btn-google {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
    background: var(--primary-blue);
    color: var(--white);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border: 2px solid var(--danger);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 14px;
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-delete-classroom {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger);
    color: var(--danger);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 16px;
}

.btn-delete-classroom:hover {
    background: var(--danger);
    color: var(--white);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.btn-google {
    background: var(--white);
    color: var(--text-dark);
    border: 2px solid var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-google:hover {
    background: var(--light-gray);
    border-color: var(--dark-gray);
}

.btn-guest {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: var(--white);
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    box-shadow: var(--shadow-md);
}

.btn-guest:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.forgot-password-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 0.9em;
    cursor: pointer;
    padding: 5px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.forgot-password-btn:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

.btn-loader {
    display: none;
}

.btn-primary.loading .btn-text,
.btn-secondary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .btn-loader,
.btn-secondary.loading .btn-loader {
    display: block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.auth-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--gray);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.auth-divider span {
    background: var(--white);
    padding: 0 15px;
    color: var(--dark-gray);
    font-size: 14px;
    position: relative;
}

/* ===========================================
   NAVBAR
   =========================================== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideInLeft 0.5s var(--transition-normal);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand h2 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.8em;
    font-weight: 800;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.nav-item:hover {
    background: var(--light-gray);
    color: var(--primary-blue);
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: var(--white);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    padding: 20px;
    min-width: 250px;
    animation: fadeInScale 0.2s var(--transition-fast);
}

.user-dropdown.active {
    display: block;
}

.user-info {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray);
}

.user-info p {
    margin-bottom: 5px;
    font-weight: 600;
}

.text-small {
    font-size: 13px;
    color: var(--dark-gray);
    font-weight: 400;
}

.premium-badge {
    display: inline-block;
    background: var(--gradient-primary);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

.user-dropdown button {
    width: 100%;
    padding: 10px;
    background: var(--light-gray);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.user-dropdown button:hover {
    background: var(--gray);
}

/* ===========================================
   DASHBOARD
   =========================================== */
.dashboard-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeIn 0.6s var(--transition-normal);
}

.welcome-section h1 {
    font-size: 3em;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.welcome-section p {
    font-size: 1.3em;
    color: var(--dark-gray);
}

.chat-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.chat-option-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: fadeIn 0.8s var(--transition-normal);
}

.chat-option-card:nth-child(1) {
    animation-delay: 0.1s;
}

.chat-option-card:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-option-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.card-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.chat-option-card h3 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.chat-option-card p {
    color: var(--dark-gray);
    margin-bottom: 25px;
    line-height: 1.6;
}

.features-section {
    animation: fadeIn 1s var(--transition-normal);
}

.features-section h2 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
    color: var(--text-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-item {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    transition: all var(--transition-normal);
    animation: fadeInScale 0.6s var(--transition-normal);
}

.feature-item:nth-child(1) { animation-delay: 0.1s; }
.feature-item:nth-child(2) { animation-delay: 0.2s; }
.feature-item:nth-child(3) { animation-delay: 0.3s; }
.feature-item:nth-child(4) { animation-delay: 0.4s; }

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.feature-item h4 {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.feature-item p {
    color: var(--dark-gray);
    font-size: 0.95em;
}

/* ===========================================
   CHAT
   =========================================== */
.chat-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 2px solid var(--gray);
    margin-bottom: 20px;
    animation: slideInLeft 0.5s var(--transition-normal);
}

.btn-back {
    background: var(--light-gray);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-back:hover {
    background: var(--gray);
    transform: translateX(-5px);
}

.chat-header h2 {
    flex: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--white);
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.message {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    animation: slideInRight 0.3s var(--transition-normal);
}

.message.user-message {
    flex-direction: row-reverse;
}

.message.user-message .message-content {
    background: var(--gradient-primary);
    color: var(--white);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
}

.message-content {
    background: var(--light-gray);
    padding: 15px 20px;
    border-radius: 16px;
    max-width: 70%;
    line-height: 1.6;
}

.message-content p {
    margin-bottom: 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    background: var(--white);
    padding: 15px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.chat-input-container textarea {
    flex: 1;
    border: 2px solid var(--gray);
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: all var(--transition-normal);
    max-height: 150px;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-send {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.btn-send:active {
    transform: scale(0.95);
}

/* ===========================================
   AULAS
   =========================================== */
.classroom-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.classroom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid var(--gray);
    animation: slideInLeft 0.5s var(--transition-normal);
}

.classrooms-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.classroom-card {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: fadeInScale 0.5s var(--transition-normal);
}

.classroom-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.classroom-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.classroom-card h3 {
    font-size: 1.5em;
    color: var(--text-dark);
}

.classroom-stats {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-gray);
    font-size: 0.95em;
}

/* ===========================================
   MODALES
   =========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s var(--transition-fast);
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: fadeInScale 0.4s var(--transition-normal);
}

.modal-content.large {
    max-width: 900px;
}

.modal-content.fullscreen {
    max-width: 95%;
    max-height: 95vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 30px;
    border-bottom: 2px solid var(--gray);
}

.modal-header h2 {
    font-size: 1.8em;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--dark-gray);
    cursor: pointer;
    transition: all var(--transition-normal);
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.modal-close:hover {
    background: var(--light-gray);
    color: var(--text-dark);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    border-top: 2px solid var(--gray);
    justify-content: flex-end;
}

.students-input {
    margin: 20px 0;
}

#studentsList {
    margin-bottom: 15px;
}

.student-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    animation: slideInLeft 0.3s var(--transition-normal);
}

.student-input-row input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--gray);
    border-radius: 8px;
    font-size: 15px;
}

.student-input-row button {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.student-input-row button:hover {
    background: #dc2626;
}

/* ===========================================
   DETALLE DE AULA
   =========================================== */
.classroom-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.classroom-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 2px solid var(--gray);
    margin-bottom: 20px;
}

.classroom-detail-header h2 {
    flex: 1;
}

.classroom-content {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.classroom-sidebar {
    width: 280px;
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
}

.classroom-sidebar h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.students-sidebar {
    margin-bottom: 20px;
}

.student-item {
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.student-item:hover {
    background: var(--gray);
    transform: translateX(5px);
}

.full-width {
    width: 100%;
}

.classroom-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

/* ===========================================
   PASAR LISTA - MEJORADO
   =========================================== */
.attendance-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: var(--dark-gray);
    font-weight: 600;
}

.attendance-list {
    max-height: 400px;
    overflow-y: auto;
}

.attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: var(--light-gray);
    border-radius: 12px;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.attendance-item.present {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

.attendance-item.absent {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.attendance-item.pending {
    background: var(--light-gray);
}

.student-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.student-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
}

.student-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-dark);
}

.attendance-buttons {
    display: flex;
    gap: 10px;
}

.attendance-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid var(--gray);
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
}

.attendance-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.attendance-btn.present {
    border-color: var(--success);
    color: var(--success);
}

.attendance-btn.present.active {
    background: var(--success);
    color: var(--white);
}

.attendance-btn.absent {
    border-color: var(--danger);
    color: var(--danger);
}

.attendance-btn.absent.active {
    background: var(--danger);
    color: var(--white);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-size: 0.95em;
}

/* ===========================================
   SOCIOGRAMA
   =========================================== */
.sociogram-canvas {
    width: 100%;
    height: 600px;
    background: var(--light-gray);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.sociogram-node {
    position: absolute;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: move;
    transition: all var(--transition-normal);
    z-index: 5;
    user-select: none;
}

.sociogram-node:hover {
    transform: scale(1.15);
    z-index: 10;
}

.sociogram-node.node-selected {
    animation: pulse 1s infinite;
}

.node-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 5px;
    transition: all var(--transition-normal);
}

.sociogram-node:hover .node-avatar {
    box-shadow: var(--shadow-xl);
    transform: scale(1.1);
}

.node-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.95);
    padding: 3px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sociogram-legend {
    margin-top: 20px;
    padding: 20px;
    background: var(--light-gray);
    border-radius: 12px;
}

.sociogram-legend h4 {
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.line {
    width: 50px;
    height: 3px;
    border-radius: 2px;
}

.line.friendship {
    background: var(--success);
}

.line.relationship {
    background: #ec4899;
}

.line.conflict {
    background: var(--danger);
}

/* Connection Dialog */
.connection-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s var(--transition-normal);
}

.connection-dialog-content {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s var(--transition-normal);
}

.connection-dialog-content h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.connection-dialog-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.connection-types {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.connection-type-btn {
    flex: 1;
    padding: 15px 20px;
    border: 3px solid;
    background: var(--white);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all var(--transition-normal);
    min-width: 120px;
}

.connection-type-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Student Definitions */
.student-definition-card {
    background: var(--white);
    border: 2px solid var(--gray);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all var(--transition-normal);
}

.student-definition-card:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
}

.student-definition-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
}

.student-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    box-shadow: var(--shadow-md);
}

.student-definition-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.student-definition-fields {
    display: grid;
    gap: 15px;
}

.definition-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.definition-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: all var(--transition-normal);
}

.definition-field textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.definition-field textarea::placeholder {
    color: var(--dark-gray);
    font-style: italic;
}

/* Interactive Schema */
.schema-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 12px;
    flex-wrap: wrap;
}

.schema-canvas {
    flex: 1;
    background: var(--white);
    border: 2px dashed var(--gray);
    border-radius: 12px;
    min-height: 500px;
    position: relative;
    overflow: auto;
}

.schema-students-panel {
    width: 250px;
    background: var(--light-gray);
    padding: 20px;
    border-radius: 12px;
    max-height: 600px;
    overflow-y: auto;
}

.schema-students-panel h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.schema-student-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: move;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.schema-student-item:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.student-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.premium-feature {
    position: relative;
}

.premium-feature::after {
    content: '⭐';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 14px;
}

.schema-desk {
    position: absolute;
    background: var(--white);
    border: 2px solid var(--gray);
    border-radius: 12px;
    padding: 15px;
    min-width: 200px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.schema-desk:hover {
    box-shadow: var(--shadow-lg);
}

.desk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--light-gray);
    font-weight: 600;
}

.desk-delete-btn {
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all var(--transition-normal);
}

.desk-delete-btn:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.desk-students {
    min-height: 60px;
}

.desk-student {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--light-gray);
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 14px;
}

/* ===========================================
   UTILIDADES
   =========================================== */
.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray) 0%, var(--light-gray) 50%, var(--gray) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
    .logo-text {
        font-size: 2.5em;
    }

    .auth-box {
        padding: 30px 20px;
    }

    .welcome-section h1 {
        font-size: 2em;
    }

    .welcome-section p {
        font-size: 1.1em;
    }

    .chat-options {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .classroom-content {
        flex-direction: column;
    }

    .classroom-sidebar {
        width: 100%;
        max-height: 200px;
    }

    .message-content {
        max-width: 85%;
    }

    .nav-menu {
        gap: 10px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 2em;
    }

    .tagline {
        font-size: 1em;
    }

    .auth-tabs {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
    }

    .classroom-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ===========================================
   SCROLLBAR PERSONALIZADO
   =========================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-gray);
}

/* ===========================================
   ANIMACIONES DE ENTRADA PERSONALIZADAS
   =========================================== */
.fade-in {
    animation: fadeIn 0.5s var(--transition-normal);
}

.slide-in-right {
    animation: slideInRight 0.5s var(--transition-normal);
}

.slide-in-left {
    animation: slideInLeft 0.5s var(--transition-normal);
}

.scale-in {
    animation: fadeInScale 0.5s var(--transition-normal);
}

/* ===========================================
   SELECTOR DE ROL
   =========================================== */
.role-selector-btn {
    background: var(--white);
    border: 3px solid var(--gray);
    border-radius: 16px;
    padding: 30px;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    width: 100%;
}

.role-selector-btn:hover {
    border-color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.role-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.role-selector-btn h3 {
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 1.5em;
}

.role-selector-btn p {
    color: var(--dark-gray);
    font-size: 0.9em;
    line-height: 1.5;
    margin: 0;
}

/* ===========================================
   SISTEMA DE NOTIFICACIONES
   =========================================== */
.notifications-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 400px;
    max-height: 500px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    overflow: hidden;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid var(--gray);
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.notifications-list {
    max-height: 420px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-item:hover {
    background: var(--light-gray);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--primary-blue);
}

.notification-item .notification-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.notification-item .notification-message {
    font-size: 0.9em;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.notification-item .notification-time {
    font-size: 0.75em;
    color: var(--dark-gray);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 0;
    font-size: 1em;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ===========================================
   HISTORIA DEL AULA
   =========================================== */
.history-block-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-block-btn {
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
    text-align: left;
}

.history-block-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.history-timeline {
    min-height: 400px;
}

.history-block-item {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 12px;
    border-left: 5px solid;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.history-block-item:hover {
    box-shadow: var(--shadow-md);
}

.history-block-item.activity {
    border-color: var(--primary-blue);
}

.history-block-item.achievement {
    border-color: var(--success);
}

.history-block-item.reinforcement {
    border-color: var(--warning);
}

.history-block-item.event {
    border-color: var(--secondary-blue);
}

.history-block-item.note {
    border-color: var(--dark-gray);
}

.history-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-block-type {
    font-weight: 600;
    font-size: 0.9em;
}

.history-block-content {
    margin-top: 10px;
}

.history-block-content textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 2px solid var(--gray);
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
}

/* ===========================================
   MENÚ COMPACTO DE ACCIONES DEL AULA
   =========================================== */
.classroom-actions-menu {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 12px;
    background: var(--white);
    border: 2px solid var(--gray);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 70px;
}

.action-btn:hover {
    background: var(--light-gray);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-btn.primary {
    background: var(--gradient-primary);
    border-color: var(--primary-blue);
    color: white;
}

.action-btn.primary:hover {
    background: var(--gradient-secondary);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 1.3em;
    display: block;
}

.action-label {
    font-size: 0.7em;
    font-weight: 600;
    white-space: nowrap;
}

.action-btn.primary .action-label {
    color: white;
}

.action-btn .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn {
    position: relative;
}

/* Responsive: En móviles, solo mostrar iconos */
@media (max-width: 768px) {
    .action-label {
        display: none;
    }

    .action-btn {
        min-width: 45px;
        padding: 8px;
    }

    .action-icon {
        font-size: 1.5em;
    }
}

/* Mejorar el botón de volver */
.btn-back {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    border-radius: 10px;
}