* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Calibri', sans-serif;
    background: #f3f3f3;
    min-height: 100vh;
    padding: 20px;
    color: #2d2d2d;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-card {
    background: #ffffff;
    width: 95%;
    max-width: 420px;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: fadeInUp 0.3s ease;
}

.auth-tabs {
    display: flex;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
}

.auth-tab {
    flex: 1;
    padding: 14px 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.auth-forms {
    padding: 24px 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form label {
    font-weight: 600;
    color: #0d47a1;
}

.auth-form input {
    padding: 12px 14px;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    font-size: 1em;
}

.auth-form button {
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.auth-form button:hover {
    transform: translateY(-2px);
}

.link-button {
    background: none !important;
    color: #1565c0 !important;
    text-align: left;
    padding: 0;
}

.auth-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    display: none;
    font-size: 0.9em;
}

.auth-message.success {
    background: #e8f5e9;
    color: #1b5e20;
}

.auth-message.error {
    background: #ffebee;
    color: #c62828;
}

.hidden {
    display: none;
}

.small-info {
    font-size: 0.85em;
    color: #6c757d;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: linear-gradient(180deg, #fdfdfd 0%, #f7f7f7 60%, #f3f3f3 100%);
    border-radius: 18px;
    border: 1px solid #d0d0d0;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
}

header {
    text-align: left;
    color: white;
    margin-bottom: 0;
    padding: 28px 40px 20px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    border-radius: 18px 18px 0 0;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
}

/* Mensaje del Día */
.daily-message-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 248, 255, 0.95) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    display: none;
}

.daily-message-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.daily-message-icon {
    font-size: 1.5em;
    flex-shrink: 0;
    animation: messagePulse 2s ease-in-out infinite;
}

@keyframes messagePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.daily-message-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.daily-message-label {
    font-size: 0.85em;
    color: #0b5f32;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#dailyMessageText {
    font-size: 0.95em;
    color: #2d2d2d;
    line-height: 1.4;
    font-weight: 500;
}

.daily-message-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2em;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.daily-message-close:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    transform: scale(1.1);
}

.daily-message-close:active {
    transform: scale(0.95);
}

/* Botones de instructor */
#instructorModeBtn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: 2px solid #495057;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

#instructorModeBtn:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

#instructorMessageBtn {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border: 2px solid #ff9800;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
}

#instructorMessageBtn:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 12px;
    gap: 20px;
}

.header-datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.datetime-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#currentDateTime {
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 2.4em;
    margin: 0;
    font-weight: 600;
}

.help-btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #0b5f32;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.help-btn:hover {
    background: #0b5f32;
    color: #ffffff;
    border-color: #0b5f32;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.25);
}

.help-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 124, 65, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    margin-bottom: 18px;
}

.header-stats {
    display: flex;
    justify-content: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.12);
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.85;
    margin-right: 6px;
    letter-spacing: 0.3px;
}

.stat-value {
    font-weight: 600;
    font-size: 1.15em;
}

.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    padding: 30px 40px 40px;
}

.exercises-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 0;
    border: 1px solid #d9d9d9;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.exercises-panel > h2,
.exercises-panel > div:not(.panel-tabs) {
    padding: 0 20px 20px;
}

.exercises-panel h2 {
    margin-bottom: 18px;
    color: #0b5f32;
    font-size: 1.4em;
    font-weight: 600;
}

.panel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    background: #f3f3f3;
    padding: 8px 8px 0 8px;
    border-bottom: 1px solid #c5c5c5;
    border-radius: 8px 8px 0 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    /* Mejorar scroll en móviles */
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.panel-tabs::-webkit-scrollbar {
    height: 4px;
}

.panel-tabs::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 2px;
}

.tab-btn {
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 220px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-bottom: none;
    background: linear-gradient(180deg, #f5f5f5 0%, #eaeaea 100%);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    color: #2f2f2f;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: visible;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    /* Mejorar experiencia táctil */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(16, 124, 65, 0.15);
    user-select: none;
    -webkit-user-select: none;
}

.tab-btn:hover {
    background: linear-gradient(180deg, #e8e8e8 0%, #dcdcdc 100%);
    color: #0b5f32;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.tab-btn.active {
    color: #ffffff;
    background: linear-gradient(180deg, #107c41 0%, #0b5f32 100%);
    border-color: #0b5f32;
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 600;
    z-index: 2;
    transform: translateY(-2px);
}

.tab-btn.active::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 3px 3px 0 0;
}

.tab-btn.active:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(16, 124, 65, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Iconos y etiquetas de pestañas */
.tab-icon {
    font-size: 1.2em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.tab-btn:hover .tab-icon {
    transform: scale(1.1);
}

.tab-btn.active .tab-icon {
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
    transform: scale(1.15);
}

.tab-label {
    flex: 1;
    text-align: center;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    color: inherit;
    margin-left: 4px;
    transition: all 0.2s ease;
}

.tab-btn.active .tab-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.tab-btn:hover .tab-badge {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.tab-btn.active:hover .tab-badge {
    background: rgba(255, 255, 255, 0.35);
}

/* Badge de notificación (punto rojo) */
.tab-badge.notification-badge {
    min-width: 8px;
    height: 8px;
    padding: 0;
    background: #dc3545;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 8px;
    box-shadow: 0 0 0 2px #ffffff;
    animation: pulse-notification 2s ease-in-out infinite;
}

.tab-badge.notification-badge.has-content {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.7em;
    color: #ffffff;
    top: 6px;
    right: 6px;
}

@keyframes pulse-notification {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.exercise-filters {
    margin-bottom: 15px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 500;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: #2f2f2f;
}

.search-input:hover {
    border-color: #0b5f32;
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.15);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.search-input:focus {
    outline: none;
    border-color: #0b5f32;
    box-shadow: 0 0 0 3px rgba(16, 124, 65, 0.15), 0 4px 12px rgba(16, 124, 65, 0.25);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.search-input::placeholder {
    color: #999;
    font-weight: 400;
}

/* Icono de búsqueda */
.search-box::after {
    content: '🔍';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 1.1em;
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

.search-box:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.search-input:focus ~ .search-box::after,
.search-box:focus-within::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.filter-select {
    width: 200px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230b5f32' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.filter-select:hover {
    border-color: #0b5f32;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.filter-select:focus {
    outline: none;
    border-color: #0b5f32;
    box-shadow: 0 0 0 3px rgba(16, 124, 65, 0.15), 0 4px 12px rgba(16, 124, 65, 0.25);
    transform: translateY(-2px);
}

.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.exercise-item {
    padding: 18px 18px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fdfdfd 60%, #f7f7f7 100%);
    border-left: 4px solid transparent;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e6e6e6;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.exercise-item:first-of-type {
    border-top: 1px solid #e6e6e6;
}

.exercise-item:hover:not(.locked) {
    background: linear-gradient(180deg, #f6fff9 0%, #f0fff4 100%);
    border-left-color: #107c41;
    box-shadow: inset 0 0 0 1px rgba(16, 124, 65, 0.15);
}

/* Ejercicio bloqueado */
.exercise-item.locked {
    background: linear-gradient(180deg, #f5f5f5 0%, #eeeeee 60%, #e8e8e8 100%);
    opacity: 0.7;
    cursor: not-allowed;
}

.exercise-item.locked:hover {
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 60%, #e0e0e0 100%);
    border-left-color: #999999;
}

.exercise-item.locked h3 {
    color: #999999;
}

.exercise-item.locked p {
    color: #aaaaaa;
}

.exercise-item.locked small {
    color: #bbbbbb;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.exercise-header h3 {
    flex: 1;
    margin: 0;
}

.lock-badge {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.lock-message {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 0.85em;
    color: #856404;
    font-style: italic;
}

.exercise-completion-date {
    margin-top: 8px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 3px solid #28a745;
    border-radius: 4px;
    font-size: 0.8em;
    color: #155724;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Estilos para controles solo de instructor */
.instructor-only {
    transition: all 0.3s ease;
}

.instructor-only:not([style*="display: none"]) {
    border-left: 3px solid #ffc107;
    position: relative;
}

.instructor-only:not([style*="display: none"])::before {
    content: '🔒';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.7em;
    background: #ffc107;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.exercise-item h3 {
    font-size: 1.05em;
    margin-bottom: 0;
    color: #0b5f32;
    font-weight: 600;
}

.exercise-item p {
    font-size: 0.92em;
    color: #4a4a4a;
}

.exercise-item small {
    font-size: 0.82em;
    color: #6b6b6b;
}

.exercise-item.completed {
    border-left-color: #107c41;
    background: linear-gradient(180deg, #ecfff3 0%, #e2ffe9 100%);
    position: relative;
}

.exercise-item.completed::after {
    content: "✓";
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 1.1em;
    color: #107c41;
    font-weight: 700;
}

.exercise-meta {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge.basic {
    background: #d4edda;
    color: #155724;
}

.badge.intermediate {
    background: #fff3cd;
    color: #856404;
}

.badge.advanced {
    background: #f8d7da;
    color: #721c24;
}

.badge.points {
    background: #d1ecf1;
    color: #0c5460;
}

.completion-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    background: #28a745;
    color: white;
    font-weight: 600;
}

.btn-info {
    background: linear-gradient(135deg, #0a6fb4 0%, #075795 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(10, 111, 180, 0.3);
}

.btn-info:hover {
    background: linear-gradient(135deg, #095f99 0%, #064676 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(10, 111, 180, 0.4);
}

.btn-info:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(10, 111, 180, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea87a 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.btn-success:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.chart-container {
    background: #f7faf7;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #d9e8dd;
}

.chart-container h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.chart-container canvas {
    max-height: 400px;
}

.achievements-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.achievements-section h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.achievement-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: default;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #ffc107;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    transform: scale(1.05);
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.achievement-item .achievement-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.achievement-item .achievement-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.achievement-item.unlocked .achievement-name {
    color: #856404;
}

/* Help Modal */
.help-modal-content {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h3 {
    color: #0b5f32;
    font-size: 1.5em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-section h4 {
    color: #145a32;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

.help-section ul, .help-section ol {
    margin-left: 25px;
    line-height: 1.8;
}

.help-section li {
    margin-bottom: 8px;
}

.help-section code {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
    font-size: 0.9em;
}

.help-section .help-icon {
    font-size: 1.3em;
}

.help-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.help-tab {
    padding: 12px 18px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95em;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.help-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.help-tab:hover::before {
    opacity: 1;
}

.help-tab:hover {
    color: #0b5f32;
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.help-tab.active {
    color: #ffffff;
    background: linear-gradient(180deg, #107c41 0%, #0b5f32 100%);
    box-shadow: 0 4px 15px rgba(16, 124, 65, 0.35);
    transform: translateY(-2px);
}

.help-tab.active::before {
    opacity: 0;
}

.help-tab.active:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.help-tab-content {
    display: none;
}

.help-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.help-feature-box {
    background: #f7faf7;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #0b5f32;
}

.help-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 5px 0;
}

.help-shortcut-key {
    background: #ffffff;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    color: #0b5f32;
    border: 1px solid #d9d9d9;
}

/* Welcome Modal */
.welcome-modal-content {
    max-width: 500px;
    text-align: center;
}

.welcome-header h2 {
    color: #0b5f32;
    margin-bottom: 10px;
    font-size: 2em;
}

.welcome-header p {
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.welcome-form {
    margin: 30px 0;
}

.welcome-form input {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.welcome-form input:focus {
    outline: none;
    border-color: #0b5f32;
    box-shadow: 0 0 0 3px rgba(16, 124, 65, 0.12);
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
    width: 100%;
}

.welcome-note {
    color: #6c757d;
    font-size: 0.9em;
    margin-top: 20px;
}

/* User Greeting */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #0b5f32;
}

.user-greeting strong {
    color: #0b5f32;
    font-weight: 600;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Profile Modal */
.profile-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-section h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.profile-stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
}

.profile-stat-card .stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #0b5f32;
    margin-bottom: 5px;
}

.profile-stat-card .stat-label {
    color: #6c757d;
    font-size: 0.9em;
}

.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.profile-actions button {
    flex: 1;
}

.exercise-history-item {
    background: #fdfdfd;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #107c41;
}

.exercise-history-item .exercise-name {
    font-weight: 600;
    color: #0b5f32;
}

.exercise-history-item .exercise-date {
    color: #6c757d;
    font-size: 0.9em;
}

.exercise-history-item .exercise-points {
    background: #107c41;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.workspace {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px 32px 32px;
    border: 1px solid #d9d9d9;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.09);
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.workspace-header h2 {
    color: #0b5f32;
    font-size: 1.6em;
    font-weight: 600;
}

.workspace-controls {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 124, 65, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0c6a37 0%, #094d27 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 124, 65, 0.45);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 124, 65, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.btn-secondary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

/* ========== BOTONES DE ACCIONES DE PROGRESO ========== */
.progress-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.progress-actions .btn,
.progress-actions button {
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 124, 65, 0.3);
    border: none;
}

.progress-actions .btn:hover,
.progress-actions button:hover {
    background: linear-gradient(135deg, #0c6a37 0%, #094d27 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 124, 65, 0.45);
}

.progress-actions .btn:active,
.progress-actions button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 124, 65, 0.3);
}

.instructions {
    background: #f7faf7;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #0b5f32;
}

.instructions h3 {
    color: #0b5f32;
    margin-bottom: 10px;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.8;
}

.instructions li {
    margin-bottom: 8px;
}

.tutorial-panel {
    background: #e7f3ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #17a2b8;
}

.tutorial-panel h3 {
    color: #17a2b8;
    margin-bottom: 15px;
}

.tutorial-step {
    display: none;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
}

.tutorial-step.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tutorial-step h4 {
    color: #17a2b8;
    margin-bottom: 10px;
}

.tutorial-step code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
}

.tutorial-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

#stepCounter {
    font-weight: 600;
    color: #17a2b8;
}

.progress-details {
    margin-top: 15px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #107c41, #0b5f32);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    font-weight: 600;
}

.spreadsheet-container {
    margin-bottom: 24px;
    border: 1px solid #b8c4b9;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f9faf9 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#feedback {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
    background: #f7faf7;
    border: 1px solid #d9e8dd;
}
.feedback.success {
    background: #e8f5eb;
    color: #0b5f32;
    border: 1px solid #c5e0cd;
    display: block;
}

.feedback.error {
    background: #fbeaea;
    color: #7c1010;
    border: 1px solid #f0c0c0;
    display: block;
}

.feedback.info {
    background: #e7f2fb;
    color: #0b4d6b;
    border: 1px solid #c0d9ee;
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto 2.5%;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.25);
    max-height: 92vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: #000;
}

#modalBody {
    margin-top: 20px;
}

#modalBody h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.5em;
}

#modalBody p {
    line-height: 1.8;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 1200px) {
    .container {
        padding: 0 15px;
    }

    .main-content {
        gap: 20px;
        padding: 25px 30px 35px;
    }

    .workspace {
        padding: 25px;
    }

    .spreadsheet-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 25px 30px;
    }

    .exercises-panel {
        position: relative;
        top: 0;
        width: 100%;
        order: 1;
    }

    .workspace {
        order: 2;
        padding: 20px;
    }

    .panel-tabs {
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        padding: 8px 8px 0 8px;
    }

    .panel-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 130px;
        max-width: 180px;
        font-size: 0.88em;
        padding: 11px 16px;
        gap: 7px;
        touch-action: manipulation;
    }
    
    .tab-icon {
        font-size: 1.15em;
        flex-shrink: 0;
    }
    
    .tab-label {
        font-size: 0.88em;
        white-space: nowrap;
    }
    
    .tab-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.72em;
        flex-shrink: 0;
    }

    .chart-container canvas {
        max-height: 320px;
    }

    .spreadsheet-container {
        overflow-x: auto;
        overflow-y: auto;
        max-height: 500px;
        -webkit-overflow-scrolling: touch;
    }

    #spreadsheet {
        min-width: 600px;
    }

    .workspace-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .workspace-controls {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        border-radius: 15px;
    }

    header {
        padding: 18px 15px;
        border-radius: 15px 15px 0 0;
    }
    
    .daily-message-container {
        padding: 10px 12px;
        margin-bottom: 12px;
    }
    
    .daily-message-content {
        gap: 10px;
    }
    
    .daily-message-icon {
        font-size: 1.3em;
    }
    
    .daily-message-label {
        font-size: 0.8em;
    }
    
    #dailyMessageText {
        font-size: 0.9em;
    }
    
    .daily-message-close {
        width: 24px;
        height: 24px;
        font-size: 1.1em;
    }

    header h1 {
        font-size: 1.6em;
        text-align: center;
        line-height: 1.2;
    }

    .header-top {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-stats {
        flex-direction: row;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .stat-item {
        padding: 8px 14px;
        font-size: 0.9em;
    }

    .user-greeting {
        width: 100%;
        justify-content: center;
        padding: 6px 12px;
    }

    .help-btn {
        width: auto;
        padding: 10px 20px;
        font-size: 0.95em;
    }

    .main-content {
        padding: 15px 18px 25px;
        gap: 18px;
    }

    .exercises-panel {
        padding: 15px;
    }

    .exercises-panel h2 {
        font-size: 1.3em;
    }

    .panel-tabs {
        padding: 6px;
        gap: 4px;
    }

    .panel-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 120px;
        max-width: 150px;
        padding: 11px 12px;
        font-size: 0.82em;
        text-align: center;
        gap: 6px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(16, 124, 65, 0.2);
    }
    
    .tab-icon {
        font-size: 1.05em;
        flex-shrink: 0;
    }
    
    .tab-label {
        font-size: 0.82em;
        white-space: nowrap;
    }
    
    .tab-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.68em;
        margin-left: 3px;
        flex-shrink: 0;
    }
    
    .tab-badge.notification-badge {
        min-width: 7px;
        height: 7px;
        top: 7px;
        right: 7px;
    }
    
    .tab-badge.notification-badge.has-content {
        min-width: 18px;
        height: 18px;
        top: 6px;
        right: 6px;
        font-size: 0.68em;
    }

    .exercise-item {
        padding: 15px;
    }

    .exercise-item h3 {
        font-size: 1em;
    }

    .exercise-item p {
        font-size: 0.88em;
    }

    .workspace {
        padding: 18px 15px;
    }

    .workspace-header h2 {
        font-size: 1.4em;
    }

    .instructions {
        padding: 15px;
        font-size: 0.95em;
    }

    .chart-container {
        padding: 15px;
    }

    .chart-container canvas {
        max-height: 280px;
    }

    .spreadsheet-container {
        overflow-x: auto;
        overflow-y: auto;
        max-height: 400px;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    #spreadsheet {
        min-width: 500px;
    }

    .workspace-controls {
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 8px;
        width: 100%;
    }

    .workspace-controls .btn,
    .workspace-controls .btn-info,
    .workspace-controls .btn-secondary,
    .workspace-controls .btn-primary,
    .workspace-controls .btn-success {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .workspace-controls #importFileInput {
        display: none;
    }

    .modal-content {
        width: 92%;
        margin: 2% auto 0;
        padding: 25px 20px;
        max-height: 95vh;
        overflow-y: auto;
    }

    .help-modal-content,
    .welcome-modal-content {
        max-width: 92%;
    }

    .tutorial-panel {
        padding: 15px;
    }

    .tutorial-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    .tutorial-controls .btn {
        flex: 1 1 calc(50% - 5px);
    }
}
@media (max-width: 576px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 12px;
    }

    header {
        padding: 15px 12px;
        border-radius: 12px 12px 0 0;
    }
    
    .daily-message-container {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .daily-message-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .daily-message-icon {
        font-size: 1.2em;
    }
    
    .daily-message-text {
        flex: 1 1 100%;
        min-width: 0;
    }
    
    .daily-message-label {
        font-size: 0.75em;
    }
    
    #dailyMessageText {
        font-size: 0.85em;
        word-wrap: break-word;
    }
    
    .daily-message-close {
        width: 22px;
        height: 22px;
        font-size: 1em;
        position: absolute;
        top: 0;
        right: 0;
    }

    header h1 {
        font-size: 1.4em;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.95em;
        margin-bottom: 12px;
    }

    .header-stats {
        gap: 8px;
    }

    .stat-item {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .stat-label {
        font-size: 0.8em;
    }

    .stat-value {
        font-size: 1em;
    }

    .main-content {
        padding: 12px 15px 20px;
        gap: 15px;
    }

    .exercises-panel {
        padding: 12px;
        border-radius: 10px;
    }

    .exercises-panel h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .panel-tabs {
        padding: 6px 4px 0 4px;
        gap: 3px;
        margin-bottom: 15px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #c5c5c5 transparent;
    }
    
    .panel-tabs::-webkit-scrollbar {
        height: 3px;
    }
    
    .panel-tabs::-webkit-scrollbar-thumb {
        background: #c5c5c5;
        border-radius: 2px;
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 85px;
        max-width: 120px;
        padding: 10px 8px;
        font-size: 0.75em;
        margin-bottom: 3px;
        gap: 4px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(16, 124, 65, 0.2);
    }
    
    .tab-icon {
        font-size: 0.95em;
        flex-shrink: 0;
    }
    
    .tab-label {
        font-size: 0.8em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .tab-badge {
        min-width: 14px;
        height: 14px;
        font-size: 0.6em;
        padding: 0 4px;
        margin-left: 2px;
        flex-shrink: 0;
    }
    
    .tab-badge.notification-badge {
        min-width: 5px;
        height: 5px;
        top: 5px;
        right: 5px;
    }
    
    .tab-badge.notification-badge.has-content {
        min-width: 14px;
        height: 14px;
        top: 4px;
        right: 4px;
        font-size: 0.6em;
        padding: 0 3px;
    }

    .filter-select {
        font-size: 0.9em;
        padding: 10px 12px;
    }

    .exercise-item {
        padding: 12px;
    }

    .exercise-item h3 {
        font-size: 0.95em;
        margin-bottom: 4px;
    }

    .exercise-item p {
        font-size: 0.85em;
    }

    .exercise-item small {
        font-size: 0.75em;
    }

    .workspace {
        padding: 15px 12px;
        border-radius: 10px;
    }

    .workspace-header {
        margin-bottom: 15px;
    }

    .workspace-header h2 {
        font-size: 1.3em;
        line-height: 1.3;
    }

    .exercise-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-top: 8px;
    }

    .instructions {
        padding: 12px;
        font-size: 0.9em;
    }

    .instructions h3 {
        font-size: 1.1em;
    }

    .instructions ol,
    .instructions ul {
        margin-left: 20px;
    }

    .spreadsheet-container {
        max-height: 350px;
        border-radius: 6px;
        margin-bottom: 15px;
    }

    #spreadsheet {
        min-width: 450px;
    }

    .chart-container {
        padding: 12px;
    }

    .chart-container h3 {
        font-size: 1.1em;
    }

    .chart-container canvas {
        max-height: 240px;
    }

    .workspace-controls {
        flex-direction: column;
        gap: 8px;
    }

    .workspace-controls .btn,
    .workspace-controls .btn-info,
    .workspace-controls .btn-secondary,
    .workspace-controls .btn-primary,
    .workspace-controls .btn-success {
        flex: 1 1 100%;
        width: 100%;
        min-width: auto;
        padding: 12px;
        font-size: 0.9em;
    }

    .tutorial-panel {
        padding: 12px;
    }

    .tutorial-step {
        padding: 12px;
    }

    .tutorial-controls {
        flex-direction: column;
    }

    .tutorial-controls .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 2% auto 0;
        padding: 20px 15px;
        max-height: 95vh;
        border-radius: 12px;
    }

    .help-modal-content,
    .welcome-modal-content {
        max-width: 95%;
    }

    .help-tabs {
        flex-direction: column;
        gap: 4px;
    }

    .help-tab {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    .help-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .help-section h3 {
        font-size: 1.3em;
    }

    .help-section h4 {
        font-size: 1.1em;
    }

    .help-feature-box {
        padding: 12px;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .profile-stat-card {
        padding: 12px;
    }

    .profile-stat-card .stat-value {
        font-size: 1.8em;
    }

    .exercise-history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px;
    }

    .exercise-history-item .exercise-points {
        align-self: flex-end;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .achievement-item {
        padding: 12px 8px;
    }

    .achievement-item .achievement-icon {
        font-size: 2em;
    }

    .achievement-item .achievement-name {
        font-size: 0.8em;
    }
}
/* Optimización para tablets en orientación horizontal */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .main-content {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }

    .spreadsheet-container {
        max-height: 450px;
    }

    #spreadsheet {
        min-width: 700px;
    }
}

/* ========== MODO OSCURO ========== */
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .container {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 60%, #1f1f1f 100%);
    border-color: #404040;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
}

body.dark-mode header {
    background: linear-gradient(135deg, #0d5a2f 0%, #083d20 100%);
}

body.dark-mode .exercises-panel {
    background: #2a2a2a;
    border-color: #404040;
}

body.dark-mode .workspace {
    background: #2a2a2a;
    border-color: #404040;
}

body.dark-mode .exercise-item {
    background: linear-gradient(180deg, #333333 0%, #2d2d2d 60%, #282828 100%);
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exercise-item:hover {
    background: linear-gradient(180deg, #3a3a3a 0%, #343434 60%, #2f2f2f 100%);
    border-left-color: #0b5f32;
}

body.dark-mode .search-input,
body.dark-mode .filter-select {
    background: linear-gradient(135deg, #333333 0%, #2d2d2d 100%);
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .search-input:hover {
    border-color: #0b5f32;
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.15);
    background: linear-gradient(135deg, #3a3a3a 0%, #343434 100%);
}

body.dark-mode .search-input:focus,
body.dark-mode .filter-select:focus {
    border-color: #0b5f32;
    background: linear-gradient(135deg, #3a3a3a 0%, #343434 100%);
}

body.dark-mode .search-input::placeholder {
    color: #999;
}

body.dark-mode .tab-btn {
    background: linear-gradient(135deg, #333333 0%, #2d2d2d 100%);
    color: #e0e0e0;
    border-color: #404040;
}

body.dark-mode .tab-btn.active {
    background: linear-gradient(135deg, #0b5f32 0%, #083d20 100%);
    color: white;
}

body.dark-mode .btn {
    background: linear-gradient(135deg, #0b5f32 0%, #083d20 100%);
    color: white;
}

body.dark-mode .btn:hover {
    background: linear-gradient(135deg, #0d6a38 0%, #094a26 100%);
}

body.dark-mode .modal-content {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #404040;
}

body.dark-mode .help-modal-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .help-section {
    background: #333333;
    border-color: #404040;
}

body.dark-mode .help-tab {
    background: #333333;
    color: #e0e0e0;
    border-color: #404040;
}

body.dark-mode .help-tab.active {
    background: linear-gradient(135deg, #0b5f32 0%, #083d20 100%);
    color: white;
}

body.dark-mode #darkModeToggle {
    background: #333333;
    border-color: #404040;
}

body.dark-mode #darkModeToggle:hover {
    background: #3a3a3a;
}

/* Animaciones suaves */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exercise-item {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.modal-content {
    animation: slideIn 0.3s ease-out;
}

/* ========== ESTADÍSTICAS AVANZADAS ========== */
.advanced-stats {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.advanced-stats h3 {
    margin-bottom: 20px;
    color: #0b5f32;
    font-size: 1.4em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-chart-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}

.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}

body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

#errorDetails {
    color: #856404;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Vista previa de solución */
.solution-preview {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.solution-preview h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

#solutionDetails {
    color: #0c5460;
    margin-bottom: 15px;
    line-height: 1.6;
}

#solutionDetails code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Notas personales */
.exercise-notes {
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.exercise-notes h4 {
    color: #495057;
    margin-bottom: 15px;
}

#notesTextarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
}

.notes-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Desafío diario */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.daily-challenge h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#challengeDescription {
    margin-bottom: 15px;
    line-height: 1.6;
}

#challengeProgress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Racha de días */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    text-align: center;
}

.streak-display h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.streak-number {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1.1em;
    margin-top: 5px;
}

.streak-message {
    font-size: 1em;
    opacity: 0.95;
    margin-top: 10px;
}

/* Modo alto contraste */
body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast header {
    background: #000000;
    border-bottom: 3px solid #ffffff;
}

body.high-contrast .exercises-panel,
body.high-contrast .workspace {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast .btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .btn:hover {
    background: #ffff00;
    color: #000000;
}

body.high-contrast .exercise-item {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.high-contrast .exercise-item:hover {
    background: #333333;
}
/* Modo oscuro para controles */
body.dark-mode .workspace-controls {
    background: transparent;
}

body.dark-mode .controls-group {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

body.dark-mode .btn-favorite {
    background: linear-gradient(135deg, #3d2f00 0%, #664d03 100%);
    border-color: #ffc107;
    color: #ffd700;
}

body.dark-mode .btn-favorite:hover {
    background: linear-gradient(135deg, #664d03 0%, #856404 100%);
}

body.dark-mode .btn-favorite.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d2d2d;
}

body.dark-mode .btn-note {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    border-color: #2196f3;
    color: #90caf9;
}

body.dark-mode .btn-note:hover {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #bbdefb;
}

/* Indicador de favoritos en lista */
.exercise-item.favorite::before {
    content: "⭐ ";
    margin-right: 5px;
}

/* Responsive para controles del workspace */
@media (max-width: 992px) {
    .workspace-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 0;
        justify-content: center;
    }
    
    .controls-group:last-child {
        border-bottom: none;
    }
    
    .btn-favorite, .btn-note {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .workspace-controls {
        gap: 8px;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-favorite, .btn-note {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .btn-icon-large {
        font-size: 1.3em;
    }
    
    .btn-label {
        font-size: 0.8em;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.filter-select:focus,
.search-input:focus {
    outline: 3px solid #107c41;
    outline-offset: 2px;
}

/* Animación para botones */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-icon:active {
    animation: pulse 0.3s ease;
}

/* Optimización para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .main-content {
        padding: 10px 12px 18px;
    }

    .exercises-panel,
    .workspace {
        padding: 10px;
    }

    .spreadsheet-container {
        max-height: 300px;
    }

    #spreadsheet {
        min-width: 400px;
    }

    .modal-content {
        width: 98%;
        padding: 15px 12px;
    }
}

/* ========== SISTEMA DE NOTIFICACIONES TOAST ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.toast.success {
    border-color: #28a745;
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.toast.error {
    border-color: #dc3545;
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.toast.info {
    border-color: #17a2b8;
    color: #0c5460;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.toast.warning {
    border-color: #ffc107;
    color: #856404;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
}

.toast-message {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Modo oscuro para toasts */
body.dark-mode .toast {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #555;
}

body.dark-mode .toast.success {
    border-color: #28a745;
    color: #90ee90;
    background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

body.dark-mode .toast.error {
    border-color: #dc3545;
    color: #ff6b6b;
    background: linear-gradient(135deg, #3a1e1e 0%, #4a2d2d 100%);
}

body.dark-mode .toast.info {
    border-color: #17a2b8;
    color: #87ceeb;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3a4a 100%);
}

body.dark-mode .toast.warning {
    border-color: #ffc107;
    color: #ffd700;
    background: linear-gradient(135deg, #3a2e1e 0%, #4a3d2d 100%);
}

/* Responsive para toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ========== ESTILOS PARA VALIDACIÓN DE FÓRMULAS ========== */
.formula-error {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
}

.formula-valid {
    background-color: #e6ffe6 !important;
    border: 1px solid #44ff44 !important;
}

/* Indicador de validación en tiempo real */
.formula-validation-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.formula-validation-indicator.error {
    background-color: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.formula-validation-indicator.valid {
    background-color: #44ff44;
    box-shadow: 0 0 4px rgba(68, 255, 68, 0.6);
}

/* ========== HISTORIAL DE EJERCICIOS RECIENTES ========== */
.recent-exercises, .review-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.recent-exercises h3, .review-mode h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.recent-exercises-list, .review-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-exercise-item, .review-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.recent-exercise-item:hover, .review-exercise-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recent-exercise-info, .review-exercise-info {
    flex: 1;
}

.recent-exercise-info h4, .review-exercise-info h4 {
    margin: 0 0 5px 0;
    color: #2d2d2d;
    font-size: 1em;
}

.recent-exercise-info p, .review-exercise-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Modo oscuro para ejercicios recientes */
body.dark-mode .recent-exercises,
body.dark-mode .review-mode {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
}

body.dark-mode .recent-exercise-item,
body.dark-mode .review-exercise-item {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .recent-exercise-info h4,
body.dark-mode .review-exercise-info h4 {
    color: #e0e0e0;
}
body.dark-mode .recent-exercise-info p,
body.dark-mode .review-exercise-info p {
    color: #a0a0a0;
}

/* ========== SUGERENCIAS DE EJERCICIOS ========== */
.exercise-suggestions {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    margin-bottom: 20px;
}

.exercise-suggestions h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #81c784;
    transition: all 0.2s;
}

.suggestion-item:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.suggestion-info {
    flex: 1;
}

.suggestion-info h4 {
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-size: 1.05em;
}

.suggestion-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

.suggestion-info .badge {
    margin-right: 8px;
}

/* Modo oscuro para sugerencias */
body.dark-mode .exercise-suggestions {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-color: #4caf50;
}

body.dark-mode .suggestion-item {
    background: #2d2d2d;
    border-color: #4caf50;
}

body.dark-mode .suggestion-info h4 {
    color: #e0e0e0;
}

body.dark-mode .suggestion-info p {
    color: #a0a0a0;
}

/* ========== RUTA DE APRENDIZAJE GUIADA ========== */
.learning-path {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    margin-bottom: 20px;
}

.learning-path h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-recommendation {
    color: #2d2d2d;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Modo oscuro para ruta de aprendizaje */
body.dark-mode .learning-path {
    background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
    border-color: #ff9800;
}

body.dark-mode .path-recommendation {
    color: #e0e0e0;
}

/* ========== ANIMACIONES DE TRANSICIÓN ========== */
.exercise-item, .workspace, .spreadsheet-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exercise-item.fade-in {
    animation: fadeInSlide 0.4s ease-out;
}

.workspace.fade-in {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación al cambiar de ejercicio */
.exercise-transition {
    animation: exerciseTransition 0.4s ease-out;
}

@keyframes exerciseTransition {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicador de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(11, 95, 50, 0.3);
    border-radius: 50%;
    border-top-color: #0b5f32;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
}

body.dark-mode .loading-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* ========== COMPARACIÓN DE SOLUCIONES ========== */
.solution-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-column {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.comparison-column h5 {
    margin: 0 0 15px 0;
    color: #0b5f32;
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #0b5f32;
}

.comparison-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.solution-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.solution-item strong {
    color: #2d2d2d;
    display: block;
    margin-bottom: 5px;
}

.solution-item .formula {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin: 5px 0;
}

.solution-item .value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 5px;
}

.solution-item .value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.solution-item .value.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modo oscuro para comparación */
body.dark-mode .comparison-column {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .comparison-column h5 {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

body.dark-mode .solution-item {
    background: #1a1a1a;
    border-left-color: #555;
}

body.dark-mode .solution-item strong {
    color: #e0e0e0;
}

body.dark-mode .solution-item .formula {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .solution-item .value.correct {
    background: #1e3a1e;
    color: #90ee90;
    border-color: #2d4a2d;
}

body.dark-mode .solution-item .value.incorrect {
    background: #3a1e1e;
    color: #ff6b6b;
    border-color: #4a2d2d;
}

@media (max-width: 768px) {
    .solution-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== CORRECCIÓN GRÁFICO DE CALOR ========== */
.heatmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
    min-width: max-content;
    width: fit-content;
    max-width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
    grid-template-columns: repeat(30, minmax(16px, 1fr)) !important;
    gap: 2px !important;
}
.heatmap-day {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    font-size: 0.55em !important;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(15px, 1fr)) !important;
        gap: 2px !important;
    }
    
    .heatmap-day {
        min-width: 15px !important;
        min-height: 15px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        font-size: 0.55em !important;
    }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(12px, 1fr)) !important;
        gap: 1px !important;
    }
    
    .heatmap-day {
        min-width: 12px !important;
        min-height: 12px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.5em !important;
    }
}

/* ========== ESTADÍSTICAS AVANZADAS - CORRECCIÓN DE DESBORDAMIENTO ========== */
.advanced-stats {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.advanced-stats h3 {
    color: #0b5f32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-chart-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}

.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}

body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}
.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

#errorDetails {
    color: #856404;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Vista previa de solución */
.solution-preview {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.solution-preview h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

#solutionDetails {
    color: #0c5460;
    margin-bottom: 15px;
    line-height: 1.6;
}

#solutionDetails code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Notas personales */
.exercise-notes {
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.exercise-notes h4 {
    color: #495057;
    margin-bottom: 15px;
}

#notesTextarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
}

.notes-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Desafío diario */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.daily-challenge h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#challengeDescription {
    margin-bottom: 15px;
    line-height: 1.6;
}

#challengeProgress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Racha de días */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    text-align: center;
}

.streak-display h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.streak-number {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1.1em;
    margin-top: 5px;
}

.streak-message {
    font-size: 1em;
    opacity: 0.95;
    margin-top: 10px;
}

/* Modo alto contraste */
body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast header {
    background: #000000;
    border-bottom: 3px solid #ffffff;
}

body.high-contrast .exercises-panel,
body.high-contrast .workspace {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast .btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .btn:hover {
    background: #ffff00;
    color: #000000;
}

body.high-contrast .exercise-item {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.high-contrast .exercise-item:hover {
    background: #333333;
}

/* Modo oscuro para controles */
body.dark-mode .workspace-controls {
    background: transparent;
}

body.dark-mode .controls-group {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

body.dark-mode .btn-favorite {
    background: linear-gradient(135deg, #3d2f00 0%, #664d03 100%);
    border-color: #ffc107;
    color: #ffd700;
}

body.dark-mode .btn-favorite:hover {
    background: linear-gradient(135deg, #664d03 0%, #856404 100%);
}

body.dark-mode .btn-favorite.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d2d2d;
}

body.dark-mode .btn-note {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    border-color: #2196f3;
    color: #90caf9;
}

body.dark-mode .btn-note:hover {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #bbdefb;
}

/* Indicador de favoritos en lista */
.exercise-item.favorite::before {
    content: "⭐ ";
    margin-right: 5px;
}

/* Responsive para controles del workspace */
@media (max-width: 992px) {
    .workspace-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 0;
        justify-content: center;
    }
    
    .controls-group:last-child {
        border-bottom: none;
    }
    
    .btn-favorite, .btn-note {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .workspace-controls {
        gap: 8px;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-favorite, .btn-note {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .btn-icon-large {
        font-size: 1.3em;
    }
    
    .btn-label {
        font-size: 0.8em;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.filter-select:focus,
.search-input:focus {
    outline: 3px solid #107c41;
    outline-offset: 2px;
}

/* Animación para botones */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-icon:active {
    animation: pulse 0.3s ease;
}
/* Optimización para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .main-content {
        padding: 10px 12px 18px;
    }

    .exercises-panel,
    .workspace {
        padding: 10px;
    }

    .spreadsheet-container {
        max-height: 300px;
    }

    #spreadsheet {
        min-width: 400px;
    }

    .modal-content {
        width: 98%;
        padding: 15px 12px;
    }
}

/* ========== SISTEMA DE NOTIFICACIONES TOAST ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.toast.success {
    border-color: #28a745;
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.toast.error {
    border-color: #dc3545;
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.toast.info {
    border-color: #17a2b8;
    color: #0c5460;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.toast.warning {
    border-color: #ffc107;
    color: #856404;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
}

.toast-message {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Modo oscuro para toasts */
body.dark-mode .toast {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #555;
}

body.dark-mode .toast.success {
    border-color: #28a745;
    color: #90ee90;
    background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

body.dark-mode .toast.error {
    border-color: #dc3545;
    color: #ff6b6b;
    background: linear-gradient(135deg, #3a1e1e 0%, #4a2d2d 100%);
}

body.dark-mode .toast.info {
    border-color: #17a2b8;
    color: #87ceeb;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3a4a 100%);
}

body.dark-mode .toast.warning {
    border-color: #ffc107;
    color: #ffd700;
    background: linear-gradient(135deg, #3a2e1e 0%, #4a3d2d 100%);
}

/* Responsive para toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ========== ESTILOS PARA VALIDACIÓN DE FÓRMULAS ========== */
.formula-error {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
}

.formula-valid {
    background-color: #e6ffe6 !important;
    border: 1px solid #44ff44 !important;
}

/* Indicador de validación en tiempo real */
.formula-validation-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.formula-validation-indicator.error {
    background-color: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.formula-validation-indicator.valid {
    background-color: #44ff44;
    box-shadow: 0 0 4px rgba(68, 255, 68, 0.6);
}

/* ========== HISTORIAL DE EJERCICIOS RECIENTES ========== */
.recent-exercises, .review-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.recent-exercises h3, .review-mode h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.recent-exercises-list, .review-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-exercise-item, .review-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.recent-exercise-item:hover, .review-exercise-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recent-exercise-info, .review-exercise-info {
    flex: 1;
}

.recent-exercise-info h4, .review-exercise-info h4 {
    margin: 0 0 5px 0;
    color: #2d2d2d;
    font-size: 1em;
}

.recent-exercise-info p, .review-exercise-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Modo oscuro para ejercicios recientes */
body.dark-mode .recent-exercises,
body.dark-mode .review-mode {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
}

body.dark-mode .recent-exercise-item,
body.dark-mode .review-exercise-item {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .recent-exercise-info h4,
body.dark-mode .review-exercise-info h4 {
    color: #e0e0e0;
}

body.dark-mode .recent-exercise-info p,
body.dark-mode .review-exercise-info p {
    color: #a0a0a0;
}

/* ========== SUGERENCIAS DE EJERCICIOS ========== */
.exercise-suggestions {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    margin-bottom: 20px;
}

.exercise-suggestions h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #81c784;
    transition: all 0.2s;
}

.suggestion-item:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.suggestion-info {
    flex: 1;
}

.suggestion-info h4 {
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-size: 1.05em;
}

.suggestion-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

.suggestion-info .badge {
    margin-right: 8px;
}

/* Modo oscuro para sugerencias */
body.dark-mode .exercise-suggestions {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-color: #4caf50;
}

body.dark-mode .suggestion-item {
    background: #2d2d2d;
    border-color: #4caf50;
}

body.dark-mode .suggestion-info h4 {
    color: #e0e0e0;
}

body.dark-mode .suggestion-info p {
    color: #a0a0a0;
}

/* ========== RUTA DE APRENDIZAJE GUIADA ========== */
.learning-path {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    margin-bottom: 20px;
}

.learning-path h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-recommendation {
    color: #2d2d2d;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Modo oscuro para ruta de aprendizaje */
body.dark-mode .learning-path {
    background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
    border-color: #ff9800;
}

body.dark-mode .path-recommendation {
    color: #e0e0e0;
}
/* ========== ANIMACIONES DE TRANSICIÓN ========== */
.exercise-item, .workspace, .spreadsheet-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exercise-item.fade-in {
    animation: fadeInSlide 0.4s ease-out;
}

.workspace.fade-in {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación al cambiar de ejercicio */
.exercise-transition {
    animation: exerciseTransition 0.4s ease-out;
}

@keyframes exerciseTransition {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicador de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(11, 95, 50, 0.3);
    border-radius: 50%;
    border-top-color: #0b5f32;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
}

body.dark-mode .loading-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* ========== COMPARACIÓN DE SOLUCIONES ========== */
.solution-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-column {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.comparison-column h5 {
    margin: 0 0 15px 0;
    color: #0b5f32;
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #0b5f32;
}

.comparison-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.solution-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.solution-item strong {
    color: #2d2d2d;
    display: block;
    margin-bottom: 5px;
}

.solution-item .formula {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin: 5px 0;
}

.solution-item .value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 5px;
}

.solution-item .value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.solution-item .value.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modo oscuro para comparación */
body.dark-mode .comparison-column {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .comparison-column h5 {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

body.dark-mode .solution-item {
    background: #1a1a1a;
    border-left-color: #555;
}

body.dark-mode .solution-item strong {
    color: #e0e0e0;
}

body.dark-mode .solution-item .formula {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .solution-item .value.correct {
    background: #1e3a1e;
    color: #90ee90;
    border-color: #2d4a2d;
}

body.dark-mode .solution-item .value.incorrect {
    background: #3a1e1e;
    color: #ff6b6b;
    border-color: #4a2d2d;
}

@media (max-width: 768px) {
    .solution-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== CORRECCIÓN GRÁFICO DE CALOR ========== */
.heatmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
    min-width: max-content;
    width: fit-content;
    max-width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
    grid-template-columns: repeat(30, minmax(16px, 1fr)) !important;
    gap: 2px !important;
}

.heatmap-day {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    font-size: 0.55em !important;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(15px, 1fr)) !important;
        gap: 2px !important;
    }
    
    .heatmap-day {
        min-width: 15px !important;
        min-height: 15px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        font-size: 0.55em !important;
    }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(12px, 1fr)) !important;
        gap: 1px !important;
    }
    
    .heatmap-day {
        min-width: 12px !important;
        min-height: 12px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.5em !important;
    }
}

/* ========== ESTADÍSTICAS AVANZADAS - CORRECCIÓN DE DESBORDAMIENTO ========== */
.advanced-stats {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.advanced-stats h3 {
    color: #0b5f32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-chart-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}
.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}

body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

#errorDetails {
    color: #856404;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Vista previa de solución */
.solution-preview {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.solution-preview h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

#solutionDetails {
    color: #0c5460;
    margin-bottom: 15px;
    line-height: 1.6;
}

#solutionDetails code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Notas personales */
.exercise-notes {
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.exercise-notes h4 {
    color: #495057;
    margin-bottom: 15px;
}
#notesTextarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
}

.notes-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Desafío diario */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.daily-challenge h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#challengeDescription {
    margin-bottom: 15px;
    line-height: 1.6;
}

#challengeProgress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Racha de días */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    text-align: center;
}

.streak-display h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.streak-number {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1.1em;
    margin-top: 5px;
}

.streak-message {
    font-size: 1em;
    opacity: 0.95;
    margin-top: 10px;
}

/* Modo alto contraste */
body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast header {
    background: #000000;
    border-bottom: 3px solid #ffffff;
}

body.high-contrast .exercises-panel,
body.high-contrast .workspace {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast .btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .btn:hover {
    background: #ffff00;
    color: #000000;
}

body.high-contrast .exercise-item {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.high-contrast .exercise-item:hover {
    background: #333333;
}

/* Modo oscuro para controles */
body.dark-mode .workspace-controls {
    background: transparent;
}

body.dark-mode .controls-group {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

body.dark-mode .btn-favorite {
    background: linear-gradient(135deg, #3d2f00 0%, #664d03 100%);
    border-color: #ffc107;
    color: #ffd700;
}

body.dark-mode .btn-favorite:hover {
    background: linear-gradient(135deg, #664d03 0%, #856404 100%);
}

body.dark-mode .btn-favorite.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d2d2d;
}

body.dark-mode .btn-note {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    border-color: #2196f3;
    color: #90caf9;
}

body.dark-mode .btn-note:hover {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #bbdefb;
}

/* Indicador de favoritos en lista */
.exercise-item.favorite::before {
    content: "⭐ ";
    margin-right: 5px;
}

/* Responsive para controles del workspace */
@media (max-width: 992px) {
    .workspace-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 0;
        justify-content: center;
    }
    
    .controls-group:last-child {
        border-bottom: none;
    }
    
    .btn-favorite, .btn-note {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .workspace-controls {
        gap: 8px;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-favorite, .btn-note {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .btn-icon-large {
        font-size: 1.3em;
    }
    
    .btn-label {
        font-size: 0.8em;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.filter-select:focus,
.search-input:focus {
    outline: 3px solid #107c41;
    outline-offset: 2px;
}

/* Animación para botones */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-icon:active {
    animation: pulse 0.3s ease;
}

/* Optimización para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .main-content {
        padding: 10px 12px 18px;
    }

    .exercises-panel,
    .workspace {
        padding: 10px;
    }

    .spreadsheet-container {
        max-height: 300px;
    }

    #spreadsheet {
        min-width: 400px;
    }

    .modal-content {
        width: 98%;
        padding: 15px 12px;
    }
}

/* ========== SISTEMA DE NOTIFICACIONES TOAST ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.toast.success {
    border-color: #28a745;
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.toast.error {
    border-color: #dc3545;
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.toast.info {
    border-color: #17a2b8;
    color: #0c5460;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.toast.warning {
    border-color: #ffc107;
    color: #856404;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
}

.toast-message {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}
.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Modo oscuro para toasts */
body.dark-mode .toast {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #555;
}

body.dark-mode .toast.success {
    border-color: #28a745;
    color: #90ee90;
    background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

body.dark-mode .toast.error {
    border-color: #dc3545;
    color: #ff6b6b;
    background: linear-gradient(135deg, #3a1e1e 0%, #4a2d2d 100%);
}

body.dark-mode .toast.info {
    border-color: #17a2b8;
    color: #87ceeb;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3a4a 100%);
}

body.dark-mode .toast.warning {
    border-color: #ffc107;
    color: #ffd700;
    background: linear-gradient(135deg, #3a2e1e 0%, #4a3d2d 100%);
}

/* Responsive para toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ========== ESTILOS PARA VALIDACIÓN DE FÓRMULAS ========== */
.formula-error {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
}

.formula-valid {
    background-color: #e6ffe6 !important;
    border: 1px solid #44ff44 !important;
}

/* Indicador de validación en tiempo real */
.formula-validation-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.formula-validation-indicator.error {
    background-color: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.formula-validation-indicator.valid {
    background-color: #44ff44;
    box-shadow: 0 0 4px rgba(68, 255, 68, 0.6);
}

/* ========== HISTORIAL DE EJERCICIOS RECIENTES ========== */
.recent-exercises, .review-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.recent-exercises h3, .review-mode h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.recent-exercises-list, .review-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-exercise-item, .review-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.recent-exercise-item:hover, .review-exercise-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recent-exercise-info, .review-exercise-info {
    flex: 1;
}

.recent-exercise-info h4, .review-exercise-info h4 {
    margin: 0 0 5px 0;
    color: #2d2d2d;
    font-size: 1em;
}

.recent-exercise-info p, .review-exercise-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Modo oscuro para ejercicios recientes */
body.dark-mode .recent-exercises,
body.dark-mode .review-mode {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
}

body.dark-mode .recent-exercise-item,
body.dark-mode .review-exercise-item {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .recent-exercise-info h4,
body.dark-mode .review-exercise-info h4 {
    color: #e0e0e0;
}

body.dark-mode .recent-exercise-info p,
body.dark-mode .review-exercise-info p {
    color: #a0a0a0;
}

/* ========== SUGERENCIAS DE EJERCICIOS ========== */
.exercise-suggestions {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    margin-bottom: 20px;
}

.exercise-suggestions h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #81c784;
    transition: all 0.2s;
}

.suggestion-item:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.suggestion-info {
    flex: 1;
}

.suggestion-info h4 {
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-size: 1.05em;
}

.suggestion-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

.suggestion-info .badge {
    margin-right: 8px;
}

/* Modo oscuro para sugerencias */
body.dark-mode .exercise-suggestions {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-color: #4caf50;
}

body.dark-mode .suggestion-item {
    background: #2d2d2d;
    border-color: #4caf50;
}

body.dark-mode .suggestion-info h4 {
    color: #e0e0e0;
}

body.dark-mode .suggestion-info p {
    color: #a0a0a0;
}

/* ========== RUTA DE APRENDIZAJE GUIADA ========== */
.learning-path {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    margin-bottom: 20px;
}

.learning-path h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-recommendation {
    color: #2d2d2d;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Modo oscuro para ruta de aprendizaje */
body.dark-mode .learning-path {
    background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
    border-color: #ff9800;
}

body.dark-mode .path-recommendation {
    color: #e0e0e0;
}

/* ========== ANIMACIONES DE TRANSICIÓN ========== */
.exercise-item, .workspace, .spreadsheet-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exercise-item.fade-in {
    animation: fadeInSlide 0.4s ease-out;
}

.workspace.fade-in {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación al cambiar de ejercicio */
.exercise-transition {
    animation: exerciseTransition 0.4s ease-out;
}

@keyframes exerciseTransition {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicador de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(11, 95, 50, 0.3);
    border-radius: 50%;
    border-top-color: #0b5f32;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
}

body.dark-mode .loading-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* ========== COMPARACIÓN DE SOLUCIONES ========== */
.solution-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-column {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}
.comparison-column h5 {
    margin: 0 0 15px 0;
    color: #0b5f32;
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #0b5f32;
}

.comparison-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.solution-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.solution-item strong {
    color: #2d2d2d;
    display: block;
    margin-bottom: 5px;
}

.solution-item .formula {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin: 5px 0;
}

.solution-item .value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 5px;
}

.solution-item .value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.solution-item .value.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modo oscuro para comparación */
body.dark-mode .comparison-column {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .comparison-column h5 {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

body.dark-mode .solution-item {
    background: #1a1a1a;
    border-left-color: #555;
}

body.dark-mode .solution-item strong {
    color: #e0e0e0;
}

body.dark-mode .solution-item .formula {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .solution-item .value.correct {
    background: #1e3a1e;
    color: #90ee90;
    border-color: #2d4a2d;
}

body.dark-mode .solution-item .value.incorrect {
    background: #3a1e1e;
    color: #ff6b6b;
    border-color: #4a2d2d;
}

@media (max-width: 768px) {
    .solution-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== CORRECCIÓN GRÁFICO DE CALOR ========== */
.heatmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
    min-width: max-content;
    width: fit-content;
    max-width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
    grid-template-columns: repeat(30, minmax(16px, 1fr)) !important;
    gap: 2px !important;
}

.heatmap-day {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    font-size: 0.55em !important;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(15px, 1fr)) !important;
        gap: 2px !important;
    }
    
    .heatmap-day {
        min-width: 15px !important;
        min-height: 15px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        font-size: 0.55em !important;
    }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(12px, 1fr)) !important;
        gap: 1px !important;
    }
    
    .heatmap-day {
        min-width: 12px !important;
        min-height: 12px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.5em !important;
    }
}

/* ========== ESTADÍSTICAS AVANZADAS - CORRECCIÓN DE DESBORDAMIENTO ========== */
.advanced-stats {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.advanced-stats h3 {
    color: #0b5f32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-chart-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}

.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}
body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

#errorDetails {
    color: #856404;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Vista previa de solución */
.solution-preview {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.solution-preview h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

#solutionDetails {
    color: #0c5460;
    margin-bottom: 15px;
    line-height: 1.6;
}

#solutionDetails code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Notas personales */
.exercise-notes {
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.exercise-notes h4 {
    color: #495057;
    margin-bottom: 15px;
}

#notesTextarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
}

.notes-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Desafío diario */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.daily-challenge h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#challengeDescription {
    margin-bottom: 15px;
    line-height: 1.6;
}

#challengeProgress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Racha de días */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    text-align: center;
}

.streak-display h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.streak-number {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1.1em;
    margin-top: 5px;
}

.streak-message {
    font-size: 1em;
    opacity: 0.95;
    margin-top: 10px;
}

/* Modo alto contraste */
body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast header {
    background: #000000;
    border-bottom: 3px solid #ffffff;
}

body.high-contrast .exercises-panel,
body.high-contrast .workspace {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast .btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .btn:hover {
    background: #ffff00;
    color: #000000;
}
body.high-contrast .exercise-item {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.high-contrast .exercise-item:hover {
    background: #333333;
}

/* Modo oscuro para controles */
body.dark-mode .workspace-controls {
    background: transparent;
}

body.dark-mode .controls-group {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

body.dark-mode .btn-favorite {
    background: linear-gradient(135deg, #3d2f00 0%, #664d03 100%);
    border-color: #ffc107;
    color: #ffd700;
}

body.dark-mode .btn-favorite:hover {
    background: linear-gradient(135deg, #664d03 0%, #856404 100%);
}

body.dark-mode .btn-favorite.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d2d2d;
}

body.dark-mode .btn-note {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    border-color: #2196f3;
    color: #90caf9;
}

body.dark-mode .btn-note:hover {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #bbdefb;
}

/* Indicador de favoritos en lista */
.exercise-item.favorite::before {
    content: "⭐ ";
    margin-right: 5px;
}

/* Responsive para controles del workspace */
@media (max-width: 992px) {
    .workspace-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 0;
        justify-content: center;
    }
    
    .controls-group:last-child {
        border-bottom: none;
    }
    
    .btn-favorite, .btn-note {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .workspace-controls {
        gap: 8px;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-favorite, .btn-note {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .btn-icon-large {
        font-size: 1.3em;
    }
    
    .btn-label {
        font-size: 0.8em;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.filter-select:focus,
.search-input:focus {
    outline: 3px solid #107c41;
    outline-offset: 2px;
}

/* Animación para botones */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-icon:active {
    animation: pulse 0.3s ease;
}

/* Optimización para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .main-content {
        padding: 10px 12px 18px;
    }

    .exercises-panel,
    .workspace {
        padding: 10px;
    }

    .spreadsheet-container {
        max-height: 300px;
    }

    #spreadsheet {
        min-width: 400px;
    }

    .modal-content {
        width: 98%;
        padding: 15px 12px;
    }
}

/* ========== SISTEMA DE NOTIFICACIONES TOAST ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.toast.success {
    border-color: #28a745;
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.toast.error {
    border-color: #dc3545;
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.toast.info {
    border-color: #17a2b8;
    color: #0c5460;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.toast.warning {
    border-color: #ffc107;
    color: #856404;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
}

.toast-message {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Modo oscuro para toasts */
body.dark-mode .toast {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #555;
}

body.dark-mode .toast.success {
    border-color: #28a745;
    color: #90ee90;
    background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

body.dark-mode .toast.error {
    border-color: #dc3545;
    color: #ff6b6b;
    background: linear-gradient(135deg, #3a1e1e 0%, #4a2d2d 100%);
}

body.dark-mode .toast.info {
    border-color: #17a2b8;
    color: #87ceeb;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3a4a 100%);
}

body.dark-mode .toast.warning {
    border-color: #ffc107;
    color: #ffd700;
    background: linear-gradient(135deg, #3a2e1e 0%, #4a3d2d 100%);
}

/* Responsive para toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ========== ESTILOS PARA VALIDACIÓN DE FÓRMULAS ========== */
.formula-error {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
}

.formula-valid {
    background-color: #e6ffe6 !important;
    border: 1px solid #44ff44 !important;
}

/* Indicador de validación en tiempo real */
.formula-validation-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.formula-validation-indicator.error {
    background-color: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.formula-validation-indicator.valid {
    background-color: #44ff44;
    box-shadow: 0 0 4px rgba(68, 255, 68, 0.6);
}
/* ========== HISTORIAL DE EJERCICIOS RECIENTES ========== */
.recent-exercises, .review-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.recent-exercises h3, .review-mode h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.recent-exercises-list, .review-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-exercise-item, .review-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.recent-exercise-item:hover, .review-exercise-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recent-exercise-info, .review-exercise-info {
    flex: 1;
}

.recent-exercise-info h4, .review-exercise-info h4 {
    margin: 0 0 5px 0;
    color: #2d2d2d;
    font-size: 1em;
}

.recent-exercise-info p, .review-exercise-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Modo oscuro para ejercicios recientes */
body.dark-mode .recent-exercises,
body.dark-mode .review-mode {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
}

body.dark-mode .recent-exercise-item,
body.dark-mode .review-exercise-item {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .recent-exercise-info h4,
body.dark-mode .review-exercise-info h4 {
    color: #e0e0e0;
}

body.dark-mode .recent-exercise-info p,
body.dark-mode .review-exercise-info p {
    color: #a0a0a0;
}

/* ========== SUGERENCIAS DE EJERCICIOS ========== */
.exercise-suggestions {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    margin-bottom: 20px;
}

.exercise-suggestions h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #81c784;
    transition: all 0.2s;
}

.suggestion-item:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.suggestion-info {
    flex: 1;
}

.suggestion-info h4 {
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-size: 1.05em;
}

.suggestion-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

.suggestion-info .badge {
    margin-right: 8px;
}

/* Modo oscuro para sugerencias */
body.dark-mode .exercise-suggestions {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-color: #4caf50;
}

body.dark-mode .suggestion-item {
    background: #2d2d2d;
    border-color: #4caf50;
}

body.dark-mode .suggestion-info h4 {
    color: #e0e0e0;
}

body.dark-mode .suggestion-info p {
    color: #a0a0a0;
}

/* ========== RUTA DE APRENDIZAJE GUIADA ========== */
.learning-path {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    margin-bottom: 20px;
}

.learning-path h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-recommendation {
    color: #2d2d2d;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Modo oscuro para ruta de aprendizaje */
body.dark-mode .learning-path {
    background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
    border-color: #ff9800;
}

body.dark-mode .path-recommendation {
    color: #e0e0e0;
}

/* ========== ANIMACIONES DE TRANSICIÓN ========== */
.exercise-item, .workspace, .spreadsheet-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exercise-item.fade-in {
    animation: fadeInSlide 0.4s ease-out;
}

.workspace.fade-in {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación al cambiar de ejercicio */
.exercise-transition {
    animation: exerciseTransition 0.4s ease-out;
}

@keyframes exerciseTransition {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicador de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(11, 95, 50, 0.3);
    border-radius: 50%;
    border-top-color: #0b5f32;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
}

body.dark-mode .loading-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* ========== COMPARACIÓN DE SOLUCIONES ========== */
.solution-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-column {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.comparison-column h5 {
    margin: 0 0 15px 0;
    color: #0b5f32;
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #0b5f32;
}

.comparison-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.solution-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.solution-item strong {
    color: #2d2d2d;
    display: block;
    margin-bottom: 5px;
}

.solution-item .formula {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin: 5px 0;
}

.solution-item .value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 5px;
}

.solution-item .value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.solution-item .value.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modo oscuro para comparación */
body.dark-mode .comparison-column {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .comparison-column h5 {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

body.dark-mode .solution-item {
    background: #1a1a1a;
    border-left-color: #555;
}

body.dark-mode .solution-item strong {
    color: #e0e0e0;
}

body.dark-mode .solution-item .formula {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .solution-item .value.correct {
    background: #1e3a1e;
    color: #90ee90;
    border-color: #2d4a2d;
}

body.dark-mode .solution-item .value.incorrect {
    background: #3a1e1e;
    color: #ff6b6b;
    border-color: #4a2d2d;
}

@media (max-width: 768px) {
    .solution-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== CORRECCIÓN GRÁFICO DE CALOR ========== */
.heatmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}
.heatmap-grid {
    min-width: max-content;
    width: fit-content;
    max-width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
    grid-template-columns: repeat(30, minmax(16px, 1fr)) !important;
    gap: 2px !important;
}

.heatmap-day {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    font-size: 0.55em !important;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(15px, 1fr)) !important;
        gap: 2px !important;
    }
    
    .heatmap-day {
        min-width: 15px !important;
        min-height: 15px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        font-size: 0.55em !important;
    }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(12px, 1fr)) !important;
        gap: 1px !important;
    }
    
    .heatmap-day {
        min-width: 12px !important;
        min-height: 12px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.5em !important;
    }
}

/* ========== ESTADÍSTICAS AVANZADAS - CORRECCIÓN DE DESBORDAMIENTO ========== */
.advanced-stats {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.advanced-stats h3 {
    color: #0b5f32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-chart-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}

.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}

body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

#errorDetails {
    color: #856404;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Vista previa de solución */
.solution-preview {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.solution-preview h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

#solutionDetails {
    color: #0c5460;
    margin-bottom: 15px;
    line-height: 1.6;
}

#solutionDetails code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Notas personales */
.exercise-notes {
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.exercise-notes h4 {
    color: #495057;
    margin-bottom: 15px;
}

#notesTextarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
}

.notes-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Desafío diario */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.daily-challenge h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#challengeDescription {
    margin-bottom: 15px;
    line-height: 1.6;
}

#challengeProgress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Racha de días */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    text-align: center;
}

.streak-display h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.streak-number {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1.1em;
    margin-top: 5px;
}

.streak-message {
    font-size: 1em;
    opacity: 0.95;
    margin-top: 10px;
}

/* Modo alto contraste */
body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast header {
    background: #000000;
    border-bottom: 3px solid #ffffff;
}

body.high-contrast .exercises-panel,
body.high-contrast .workspace {
    background: #000000;
    border-color: #ffffff;
}

body.high-contrast .btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .btn:hover {
    background: #ffff00;
    color: #000000;
}

body.high-contrast .exercise-item {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.high-contrast .exercise-item:hover {
    background: #333333;
}

/* Modo oscuro para controles */
body.dark-mode .workspace-controls {
    background: transparent;
}

body.dark-mode .controls-group {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

body.dark-mode .btn-favorite {
    background: linear-gradient(135deg, #3d2f00 0%, #664d03 100%);
    border-color: #ffc107;
    color: #ffd700;
}

body.dark-mode .btn-favorite:hover {
    background: linear-gradient(135deg, #664d03 0%, #856404 100%);
}

body.dark-mode .btn-favorite.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d2d2d;
}

body.dark-mode .btn-note {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    border-color: #2196f3;
    color: #90caf9;
}

body.dark-mode .btn-note:hover {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #bbdefb;
}

/* Indicador de favoritos en lista */
.exercise-item.favorite::before {
    content: "⭐ ";
    margin-right: 5px;
}

/* Responsive para controles del workspace */
@media (max-width: 992px) {
    .workspace-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 0;
        justify-content: center;
    }
    
    .controls-group:last-child {
        border-bottom: none;
    }
    
    .btn-favorite, .btn-note {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .workspace-controls {
        gap: 8px;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-favorite, .btn-note {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .btn-icon-large {
        font-size: 1.3em;
    }
    
    .btn-label {
        font-size: 0.8em;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.filter-select:focus,
.search-input:focus {
    outline: 3px solid #107c41;
    outline-offset: 2px;
}
/* Animación para botones */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-icon:active {
    animation: pulse 0.3s ease;
}

/* Optimización para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .main-content {
        padding: 10px 12px 18px;
    }

    .exercises-panel,
    .workspace {
        padding: 10px;
    }

    .spreadsheet-container {
        max-height: 300px;
    }

    #spreadsheet {
        min-width: 400px;
    }

    .modal-content {
        width: 98%;
        padding: 15px 12px;
    }
}

/* ========== SISTEMA DE NOTIFICACIONES TOAST ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.toast.success {
    border-color: #28a745;
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.toast.error {
    border-color: #dc3545;
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.toast.info {
    border-color: #17a2b8;
    color: #0c5460;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.toast.warning {
    border-color: #ffc107;
    color: #856404;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
}

.toast-message {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Modo oscuro para toasts */
body.dark-mode .toast {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #555;
}

body.dark-mode .toast.success {
    border-color: #28a745;
    color: #90ee90;
    background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

body.dark-mode .toast.error {
    border-color: #dc3545;
    color: #ff6b6b;
    background: linear-gradient(135deg, #3a1e1e 0%, #4a2d2d 100%);
}

body.dark-mode .toast.info {
    border-color: #17a2b8;
    color: #87ceeb;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3a4a 100%);
}

body.dark-mode .toast.warning {
    border-color: #ffc107;
    color: #ffd700;
    background: linear-gradient(135deg, #3a2e1e 0%, #4a3d2d 100%);
}

/* Responsive para toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ========== ESTILOS PARA VALIDACIÓN DE FÓRMULAS ========== */
.formula-error {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
}

.formula-valid {
    background-color: #e6ffe6 !important;
    border: 1px solid #44ff44 !important;
}

/* Indicador de validación en tiempo real */
.formula-validation-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.formula-validation-indicator.error {
    background-color: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.formula-validation-indicator.valid {
    background-color: #44ff44;
    box-shadow: 0 0 4px rgba(68, 255, 68, 0.6);
}

/* ========== HISTORIAL DE EJERCICIOS RECIENTES ========== */
.recent-exercises, .review-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.recent-exercises h3, .review-mode h3 {
    color: #0b5f32;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.recent-exercises-list, .review-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-exercise-item, .review-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.recent-exercise-item:hover, .review-exercise-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recent-exercise-info, .review-exercise-info {
    flex: 1;
}

.recent-exercise-info h4, .review-exercise-info h4 {
    margin: 0 0 5px 0;
    color: #2d2d2d;
    font-size: 1em;
}

.recent-exercise-info p, .review-exercise-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Modo oscuro para ejercicios recientes */
body.dark-mode .recent-exercises,
body.dark-mode .review-mode {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
}

body.dark-mode .recent-exercise-item,
body.dark-mode .review-exercise-item {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .recent-exercise-info h4,
body.dark-mode .review-exercise-info h4 {
    color: #e0e0e0;
}

body.dark-mode .recent-exercise-info p,
body.dark-mode .review-exercise-info p {
    color: #a0a0a0;
}

/* ========== SUGERENCIAS DE EJERCICIOS ========== */
.exercise-suggestions {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    margin-bottom: 20px;
}

.exercise-suggestions h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #81c784;
    transition: all 0.2s;
}

.suggestion-item:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}
.suggestion-info {
    flex: 1;
}

.suggestion-info h4 {
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-size: 1.05em;
}

.suggestion-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

.suggestion-info .badge {
    margin-right: 8px;
}

/* Modo oscuro para sugerencias */
body.dark-mode .exercise-suggestions {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-color: #4caf50;
}

body.dark-mode .suggestion-item {
    background: #2d2d2d;
    border-color: #4caf50;
}

body.dark-mode .suggestion-info h4 {
    color: #e0e0e0;
}

body.dark-mode .suggestion-info p {
    color: #a0a0a0;
}

/* ========== RUTA DE APRENDIZAJE GUIADA ========== */
.learning-path {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    margin-bottom: 20px;
}

.learning-path h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-recommendation {
    color: #2d2d2d;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Modo oscuro para ruta de aprendizaje */
body.dark-mode .learning-path {
    background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
    border-color: #ff9800;
}

body.dark-mode .path-recommendation {
    color: #e0e0e0;
}

/* ========== ANIMACIONES DE TRANSICIÓN ========== */
.exercise-item, .workspace, .spreadsheet-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exercise-item.fade-in {
    animation: fadeInSlide 0.4s ease-out;
}

.workspace.fade-in {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación al cambiar de ejercicio */
.exercise-transition {
    animation: exerciseTransition 0.4s ease-out;
}

@keyframes exerciseTransition {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicador de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(11, 95, 50, 0.3);
    border-radius: 50%;
    border-top-color: #0b5f32;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
}

body.dark-mode .loading-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* ========== COMPARACIÓN DE SOLUCIONES ========== */
.solution-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-column {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.comparison-column h5 {
    margin: 0 0 15px 0;
    color: #0b5f32;
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #0b5f32;
}

.comparison-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.solution-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.solution-item strong {
    color: #2d2d2d;
    display: block;
    margin-bottom: 5px;
}

.solution-item .formula {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin: 5px 0;
}

.solution-item .value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 5px;
}

.solution-item .value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.solution-item .value.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modo oscuro para comparación */
body.dark-mode .comparison-column {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .comparison-column h5 {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

body.dark-mode .solution-item {
    background: #1a1a1a;
    border-left-color: #555;
}

body.dark-mode .solution-item strong {
    color: #e0e0e0;
}

body.dark-mode .solution-item .formula {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .solution-item .value.correct {
    background: #1e3a1e;
    color: #90ee90;
    border-color: #2d4a2d;
}

body.dark-mode .solution-item .value.incorrect {
    background: #3a1e1e;
    color: #ff6b6b;
    border-color: #4a2d2d;
}

@media (max-width: 768px) {
    .solution-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== CORRECCIÓN GRÁFICO DE CALOR ========== */
.heatmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
    min-width: max-content;
    width: fit-content;
    max-width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
    grid-template-columns: repeat(30, minmax(16px, 1fr)) !important;
    gap: 2px !important;
}

.heatmap-day {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    font-size: 0.55em !important;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(15px, 1fr)) !important;
        gap: 2px !important;
    }
    
    .heatmap-day {
        min-width: 15px !important;
        min-height: 15px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        font-size: 0.55em !important;
    }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: repeat(30, minmax(12px, 1fr)) !important;
        gap: 1px !important;
    }
    
    .heatmap-day {
        min-width: 12px !important;
        min-height: 12px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.5em !important;
    }
}

/* ========== ESTADÍSTICAS AVANZADAS - CORRECCIÓN DE DESBORDAMIENTO ========== */
.advanced-stats {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.advanced-stats h3 {
    color: #0b5f32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-chart-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.stat-chart-container h4 {
    margin-bottom: 15px;
    color: #2f2f2f;
    font-size: 1.1em;
    text-align: center;
}

.stat-chart-container canvas {
    max-height: 250px;
}

.progress-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.progress-actions .btn {
    flex: 1;
    min-width: 150px;
}
/* ========== MODO EXAMEN ========== */
.exam-info {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.exam-info ul {
    margin: 15px 0;
    padding-left: 25px;
}

.exam-info li {
    margin: 8px 0;
    color: #2f2f2f;
}

.exam-settings {
    margin: 20px 0;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
}

.exam-settings label {
    display: block;
    margin-bottom: 10px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
}

.timer-label {
    font-size: 0.9em;
}

#timerDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* ========== CERTIFICADO ========== */
.certificate-modal {
    max-width: 800px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border: 3px solid #0b5f32;
}

.certificate-content {
    text-align: center;
    padding: 40px;
    background: white;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
}

.certificate-header {
    border-bottom: 3px solid #0b5f32;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #0b5f32;
    font-size: 2.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.certificate-body {
    margin: 30px 0;
}

.certificate-body h3 {
    color: #2f2f2f;
    font-size: 1.8em;
    margin: 20px 0;
}

.certificate-level {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, #107c41 0%, #0b5f32 100%);
    color: white;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    margin: 15px 0;
}

.certificate-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
    font-size: 0.9em;
}

/* ========== MODO OSCURO - ESTADÍSTICAS ========== */
body.dark-mode .advanced-stats {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .stat-chart-container {
    background: #333333;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .exam-info {
    background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%);
    border-color: #404040;
}

body.dark-mode .exam-settings {
    background: #333333;
}

body.dark-mode .certificate-content {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* ========== NUEVAS MEJORAS ========== */

/* Barra de progreso del ejercicio */
.exercise-progress-bar {
    width: 220px;
    height: 32px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 2px solid #d0d0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107c41 0%, #0b5f32 50%, #107c41 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    animation: progressShine 2s linear infinite;
    box-shadow: 0 0 10px rgba(16, 124, 65, 0.5);
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #2d2d2d;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Navegación entre ejercicios */
#prevExerciseBtn, #nextExerciseBtn {
    margin: 0;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#prevExerciseBtn:hover, #nextExerciseBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Organización del menú de controles */
.workspace-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
    border-right: 2px solid #e9ecef;
}

.controls-group:last-child {
    border-right: none;
    padding-right: 0;
}

.controls-group:first-child {
    padding-left: 0;
}

.controls-group.controls-timer {
    border-right: none;
    padding-right: 15px;
    margin-right: 5px;
    border-right: 2px solid #e9ecef;
}

/* Botones de favoritos y notas mejorados */
.btn-favorite, .btn-note {
    min-width: 120px;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2.5px solid;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-large {
    font-size: 1.8em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.btn-label {
    font-size: 0.85em;
    font-weight: 700;
}

/* Botón de Favorito */
.btn-favorite {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #6c5ce7;
    box-shadow: 0 3px 10px rgba(253, 203, 110, 0.3);
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
    color: #5f3dc4;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.5);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-favorite.active:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.7);
    transform: translateY(-3px) scale(1.03);
}

.btn-favorite.active .btn-icon-large {
    animation: pulse-star 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

@keyframes pulse-star {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.15) rotate(-5deg); 
    }
    50% { 
        transform: scale(1.2) rotate(0deg); 
    }
    75% { 
        transform: scale(1.15) rotate(5deg); 
    }
}

/* Botón de Notas */
.btn-note {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(96, 165, 250, 0.3);
}

.btn-note:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.btn-note:active {
    transform: translateY(-1px) scale(1);
}

.btn-note .btn-icon-large {
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.4));
}

/* Tooltip mejorado para botones */
.btn-favorite[title]:hover::after,
.btn-note[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

.btn-favorite[title]:hover::before,
.btn-note[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d2d2d;
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Explicación de errores */
.error-explanation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.error-explanation h4 {
    color: #85640