:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --bg-body: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-long {
    background: #d1fae5;
    color: #065f46;
}

.badge-short {
    background: #fee2e2;
    color: #991b1b;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fed7aa;
    color: #92400e;
    border: 1px solid #fdba74;
}

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.auth-header {
    margin-bottom: 24px;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.auth-title {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Navbar */
.navbar-container {
    background: white;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-top-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-emoji {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.brand-badge {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: bold;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-role-admin {
    color: var(--danger);
}

.btn-logout {
    background: #fff1f2;
    color: #e11d48;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: #ffe4e6;
}

.nav-bottom-line {
    padding: 0 24px;
    background: #fcfdfe;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.nav-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 8px;
}

.ai-highlight {
    color: #7c3aed;
    font-weight: 600;
}

.teacher-badge {
    background: #f5f3ff;
    color: #7c3aed;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Footer */
.footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-content p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-small {
    font-size: 0.7rem;
    margin-top: 8px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: white;
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--info);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility */
.text-up {
    color: var(--success);
}

.text-down {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.d-none {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-grid {
        grid-template-columns: 1fr;
    }
    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    .nav-top-line {
        flex-direction: column;
        gap: 12px;
    }
    .nav-menu {
        justify-content: center;
    }
    .nav-item {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- CORRECCIONES DE INTERFAZ --- */
.hint-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

.chart-container {
    height: 450px;
    width: 100%;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.stat-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- ESTILOS DE BILLETERA SPOT --- */
.assets-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.2s;
}
.asset-item:hover {
    transform: translateX(4px);
    border-color: var(--primary);
}
.asset-symbol {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    width: 30%;
}
.asset-amount {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-main);
    width: 40%;
    text-align: right;
}
.asset-value {
    font-weight: 600;
    color: var(--success);
    width: 30%;
    text-align: right;
}
/* Overlay de la Tutoría IA */
.tutor-alert-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}

.tutor-alert-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 450px;
    text-align: center;
    border-top: 5px solid var(--primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.tutor-avatar {
    font-size: 50px;
    margin-bottom: 15px;
}
/* Estilos para el Modo Docente */
.teacher-table {
    width: 100%;
    border-collapse: collapse;
}
.teacher-table th { padding: 12px; text-align: left; background: #f8fafc; color: var(--text-muted); font-size: 0.8rem; }
.teacher-table td { padding: 15px 12px; border-bottom: 1px solid var(--border); }

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.timeline-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #fcfdfe;
    border-radius: 8px;
}
