/* CodeStreak - Estilos principales */

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

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --accent-color: #FF9800;
    --error-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 8px rgba(0,0,0,0.15);
}

/* Pantallas */
.screen {
    display: none;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

.screen.active {
    display: block;
}

/* Autenticación */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto 15px;
    display: block;
    border-radius: 12px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
}

.logo p {
    color: var(--text-light);
    font-size: 0.9em;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: var(--text-light);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--error-color);
    margin-top: 10px;
    font-size: 0.9em;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--success-color);
    margin-top: 10px;
    font-size: 0.9em;
    display: none;
}

.success-message.show {
    display: block;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-back:hover {
    transform: translateX(-3px);
}

/* Header Minimalista */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    min-height: 60px;
}


.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.3em;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.header h2 {
    color: #212121;
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.user-stats-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 0;
}

.btn-ranking {
    background: transparent;
    color: #ff9800;
    border: 1.5px solid #ff9800;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-ranking:hover {
    background: #ff9800;
    color: white;
    transform: translateY(-1px);
}

.btn-ranking i {
    font-size: 0.95em;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    background: transparent;
    border-radius: 6px;
    min-width: 50px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: #f5f5f5;
}

.stat-label {
    font-size: 0.7em;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 2px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.stat-value {
    font-size: 1em;
    font-weight: 600;
    color: #212121;
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.stat-item.lives {
    background: transparent;
    border: 1.5px solid #ffc107;
    border-radius: 8px;
    padding: 6px 10px;
    position: relative;
}

.stat-item.lives .stat-label {
    color: #f57c00;
}

.stat-item.lives .stat-value {
    color: #f57c00;
}

.life-timer {
    font-size: 0.65em;
    color: #f57c00;
    margin-top: 2px;
    font-weight: 500;
    display: block;
    min-height: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.life-timer.hidden {
    display: none;
}

.stat-item.lives.lose-life-animation {
    animation: loseLife 0.6s ease;
}

@keyframes loseLife {
    0% {
        transform: scale(1);
        background-color: #fff3cd;
    }
    25% {
        transform: scale(1.1);
        background-color: #ffebee;
    }
    50% {
        transform: scale(0.95);
        background-color: #ffcdd2;
    }
    75% {
        transform: scale(1.05);
        background-color: #ffcdd2;
    }
    100% {
        transform: scale(1);
        background-color: #fff3cd;
    }
}


.logout-icon {
    font-size: 1em;
}

.logout-text {
    font-weight: 500;
}

/* Menú desplegable de usuario */
.user-menu {
    display: flex;
    align-items: center;
    padding-left: 12px;
    border-left: 1px solid #e0e0e0;
    position: relative;
}

.user-profile-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
}

.user-info:hover {
    background: #f5f5f5;
    border-color: #e0e0e0;
}

.user-info.active {
    background: #f0f0f0;
    border-color: var(--primary-color);
}

.dropdown-arrow {
    font-size: 0.7em;
    color: #9e9e9e;
    transition: transform 0.2s ease;
    margin-left: 4px;
}

.user-info.active .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.user-icon,
.user-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.username-text {
    font-weight: 500;
    color: #212121;
    font-size: 0.9em;
    letter-spacing: -0.2px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Menú desplegable */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    padding: 4px 0;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    color: #212121;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item:active {
    background: #eeeeee;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    color: #757575;
    font-size: 0.95em;
    flex-shrink: 0;
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-item span {
    flex: 1;
}

/* Separador antes del último item (logout) */
.dropdown-item:last-child {
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
    padding-top: 12px;
    color: #f44336;
}

.dropdown-item:last-child:hover {
    background: #ffebee;
    color: #d32f2f;
}

.dropdown-item:last-child i {
    color: #f44336;
}

.dropdown-item:last-child:hover i {
    color: #d32f2f;
}

/* Contenido principal */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Módulos */
.modules-section {
    margin-bottom: 40px;
}

.modules-section h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Camino de módulos estilo Duolingo */
.modules-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 30px;
    padding: 20px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.path-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
}

.path-node {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.path-item:not(.locked) .path-node:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.path-item.locked .path-node {
    background: #f5f5f5;
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
}

.path-item.completed .path-node {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid var(--success-color);
}

.path-item.in-progress .path-node {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid var(--primary-color);
}

.path-icon {
    font-size: 3em;
    min-width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.path-item.locked .path-icon {
    background: #e0e0e0;
    filter: grayscale(100%);
}

.path-item.completed .path-icon {
    background: var(--success-color);
    color: white;
}

.path-item.in-progress .path-icon {
    background: var(--primary-color);
    color: white;
}

.path-content {
    flex: 1;
    text-align: left;
}

.path-title {
    color: var(--text-color);
    font-size: 1.4em;
    margin-bottom: 8px;
    font-weight: 600;
}

.path-item.locked .path-title {
    color: #999;
}

.path-description {
    color: var(--text-light);
    font-size: 0.95em;
    margin-bottom: 12px;
    line-height: 1.5;
}

.path-locked-text {
    color: #999;
    font-size: 0.9em;
    font-style: italic;
    margin: 0;
}

.path-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.path-progress-bar {
    flex: 1;
    background: var(--bg-color);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.path-progress-fill {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.path-item.completed .path-progress-fill {
    background: var(--success-color);
}

.path-progress-text {
    font-size: 0.85em;
    color: var(--text-light);
    font-weight: 500;
    min-width: 50px;
    text-align: right;
}

/* Conector entre módulos */
.path-connector {
    width: 4px;
    height: 40px;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color));
    margin: -2px 0;
    position: relative;
    z-index: 1;
}

.path-item.locked ~ .path-connector,
.path-item.locked + .path-item .path-connector {
    background: linear-gradient(to bottom, #ddd, #ddd);
}

/* Animación para módulos desbloqueados */
@keyframes unlockModule {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.path-item:not(.locked) {
    animation: unlockModule 0.5s ease;
}

/* Camino de ejercicios estilo Duolingo */
.exercises-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 20px;
    padding: 20px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.exercise-path-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
}

.exercise-path-node {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.exercise-path-item:not(.locked) .exercise-path-node:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.exercise-path-item.locked .exercise-path-node {
    background: #f5f5f5;
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
}

.exercise-path-item.completed .exercise-path-node {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid var(--success-color);
}

.exercise-path-item.current .exercise-path-node {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid var(--accent-color);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.exercise-path-icon {
    font-size: 2em;
    min-width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.exercise-path-item.locked .exercise-path-icon {
    background: #e0e0e0;
    filter: grayscale(100%);
}

.exercise-path-item.completed .exercise-path-icon {
    background: var(--success-color);
    color: white;
}

.exercise-path-item.current .exercise-path-icon {
    background: var(--accent-color);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.exercise-path-content {
    flex: 1;
    text-align: left;
}

.exercise-path-title {
    color: var(--text-color);
    font-size: 1.1em;
    margin-bottom: 5px;
    font-weight: 600;
}

.exercise-path-item.locked .exercise-path-title {
    color: #999;
}

.exercise-path-description {
    color: var(--text-light);
    font-size: 0.85em;
    margin: 0;
    line-height: 1.4;
}

.exercise-path-locked-text {
    color: #999;
    font-size: 0.85em;
    font-style: italic;
    margin: 0;
}

.exercise-path-connector {
    width: 3px;
    height: 30px;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color));
    margin: -2px 0;
    position: relative;
    z-index: 1;
}

.exercise-path-item.locked ~ .exercise-path-connector,
.exercise-path-item.locked + .exercise-path-item .exercise-path-connector {
    background: linear-gradient(to bottom, #ddd, #ddd);
}

/* Ejercicios */
.exercise-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.exercise-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.exercise-tabs .tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1em;
    color: var(--text-light);
    transition: all 0.3s;
    margin-bottom: -2px;
}

.exercise-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.exercise-tab-content {
    display: none !important;
}

.exercise-tab-content.active {
    display: block !important;
}

.exercise-progress {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.progress-bar {
    background: var(--bg-color);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.3s;
}

.exercise-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 100%;
    box-sizing: border-box;
}

.exercise-title {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--text-color);
}

.exercise-description {
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.8;
}

.exercise-instruction {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary-color);
}

.exercise-instruction strong {
    color: var(--secondary-color);
}

.code-editor-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    display: inline-block;
}

.code-editor {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    resize: vertical;
    background: #ffffff;
    position: relative;
    z-index: 2;
    color: #333;
    caret-color: #333;
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary-color);
}

.code-highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
    display: none;
    overflow: auto;
    overflow-x: hidden;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    border: none;
    color: transparent;
    user-select: none;
}

.code-highlight-overlay div {
    margin: 0;
    padding: 0;
    line-height: inherit;
    width: 100%;
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-highlight-overlay div {
    margin: 0;
    padding: 0;
    line-height: inherit;
    width: 100%;
    display: block;
}

/* Múltiple opción y Verdadero/Falso */
.multiple-choice-container,
.true-false-container {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.choice-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.choice-option:hover {
    border-color: var(--primary-color);
    background: #f0f8f0;
    transform: translateX(5px);
}

.choice-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 20px;
    height: 20px;
    min-width: 20px;
    accent-color: var(--primary-color);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.choice-text {
    font-size: 1em;
    color: var(--text-color);
    cursor: pointer;
    flex: 1;
    display: block;
    line-height: 1.5;
    user-select: none;
    visibility: visible;
    opacity: 1;
    position: relative;
    z-index: 1;
}

.choice-option input[type="radio"]:checked + .choice-text {
    font-weight: bold;
    color: var(--primary-color);
}

.choice-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: #e8f5e9;
}

/* Lecciones */
.lessons-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lesson-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 2px solid transparent;
}

.lesson-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.lesson-card.read {
    background: #f0f8f0;
    border-color: var(--success-color);
}

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

.lesson-header h3 {
    color: var(--primary-color);
    font-size: 1.3em;
    margin: 0;
}

.lesson-badge {
    background: var(--success-color);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
}

.lesson-content-preview {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 15px;
}

.btn-read-lesson {
    background-color: var(--secondary-color);
    color: white;
}

.btn-read-lesson:hover {
    background-color: #1976d2;
}

.modal-lesson {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.lesson-view {
    padding: 10px;
}

.lesson-view h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8em;
}

.lesson-body {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 25px;
}

.lesson-body h2,
.lesson-body h3 {
    color: var(--text-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.lesson-body p {
    margin-bottom: 15px;
}

.lesson-body ul,
.lesson-body ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.lesson-body li {
    margin-bottom: 8px;
}

.lesson-body pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    margin: 15px 0;
}

.lesson-body code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.lesson-body strong {
    color: var(--text-color);
    font-weight: 600;
}

.lesson-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.no-lessons {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: 10px;
    color: var(--text-light);
}

.exercise-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Botón de pista */
.btn-hint {
    background-color: #ff9800;
    color: white;
    margin-bottom: 15px;
    font-size: 0.9em;
    padding: 10px 20px;
}

.btn-hint:hover {
    background-color: #f57c00;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-hint.active {
    background-color: #f57c00;
}

/* Contenedor de pista */
.hint-container {
    margin: 15px 0;
    padding: 15px;
    background: #fff3cd;
    border-left: 4px solid #ff9800;
    border-radius: 5px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hint-content {
    color: #856404;
}

.hint-content strong {
    color: #f57c00;
    display: block;
    margin-bottom: 8px;
}

.hint-content p {
    margin: 0;
    line-height: 1.6;
}

.hint-content #hint-text {
    margin-top: 8px;
    line-height: 1.6;
}

.hint-content #hint-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.hint-content #hint-text h1,
.hint-content #hint-text h2,
.hint-content #hint-text h3 {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.hint-content #hint-text ul,
.hint-content #hint-text ol {
    margin-left: 20px;
    margin-top: 5px;
    margin-bottom: 5px;
}

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

.btn-success:hover {
    background-color: #45a049;
}

/* Ranking */
/* Ranking Page Styles - Minimalista y Profesional */
.ranking-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.ranking-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 40px;
    border-bottom: 1px solid #e0e0e0;
    justify-content: center;
    background: transparent;
}

.ranking-tabs .tab-btn {
    padding: 14px 32px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #757575;
    transition: all 0.3s ease;
    margin-bottom: -2px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.3px;
}

.ranking-tabs .tab-btn:hover {
    color: var(--primary-color);
}

.ranking-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.ranking-list {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Tabla de Ranking Minimalista */
.ranking-table {
    width: 100%;
}

.ranking-table-header {
    display: grid;
    grid-template-columns: 80px 1fr 300px;
    padding: 20px 24px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #757575;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ranking-table-row {
    display: grid;
    grid-template-columns: 80px 1fr 300px;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    align-items: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ranking-table-row:last-child {
    border-bottom: none;
}

.ranking-table-row:hover {
    background: #fafafa;
}

.ranking-table-row.current-user {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.08) 0%, rgba(76, 175, 80, 0.03) 100%);
    border-left: 3px solid var(--primary-color);
}

.ranking-table-row.top-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.03) 100%);
}

.ranking-table-row.top-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, rgba(192, 192, 192, 0.03) 100%);
}

.ranking-table-row.top-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, rgba(205, 127, 50, 0.03) 100%);
}

/* Columna de Posición */
.rank-col {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.medal {
    font-size: 2em;
    line-height: 1;
}

.position-number {
    font-size: 1.1em;
    color: #9e9e9e;
    font-weight: 500;
}

/* Columna de Usuario */
.user-col {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-left: 16px;
}

.user-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1em;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ranking-table-row.current-user .user-avatar-circle {
    background: linear-gradient(135deg, var(--primary-color) 0%, #66bb6a 100%);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.username-text {
    font-size: 1em;
    font-weight: 500;
    color: #212121;
    letter-spacing: -0.2px;
}

.ranking-table-row.current-user .username-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* Separador para posición del usuario fuera del top 25 */
.ranking-separator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 24px;
    margin: 10px 0;
    border-top: 2px dashed #e0e0e0;
    border-bottom: 2px dashed #e0e0e0;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
}

.separator-text {
    color: var(--text-light);
    font-size: 0.9em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Estilo para usuario fuera del top 25 */
.ranking-table-row.user-outside-top {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.12) 0%, rgba(76, 175, 80, 0.05) 100%);
    border-left: 4px solid var(--primary-color);
    border-top: 1px solid rgba(76, 175, 80, 0.2);
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
    font-weight: 500;
}

.ranking-table-row.user-outside-top .position-number {
    font-weight: 600;
    color: var(--primary-color);
}

.you-indicator {
    font-size: 0.75em;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Columna de Estadísticas */
.stats-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: center;
}

.stat-header {
    text-align: center;
    font-size: 0.7em;
    color: #9e9e9e;
}

.stat-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label-mobile {
    display: none;
    font-size: 0.7em;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 1.1em;
    font-weight: 600;
    color: #212121;
    letter-spacing: -0.3px;
}

.xp-value .stat-number {
    color: #2e7d32;
}

.level-value .stat-number {
    color: #1565c0;
}

.streak-value .stat-number {
    color: #e65100;
}

/* Loading y Estados */
.loading-spinner {
    text-align: center;
    padding: 80px 20px;
    color: #9e9e9e;
    font-size: 0.95em;
}

.no-ranking {
    text-align: center;
    padding: 80px 20px;
    color: #9e9e9e;
    font-size: 0.95em;
}

.error-message {
    text-align: center;
    padding: 24px;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    border: 1px solid #ef5350;
    font-size: 0.9em;
}

/* Responsive para ranking */
@media (max-width: 768px) {
    .ranking-container {
        padding: 20px 15px;
    }
    
    .ranking-table-header,
    .ranking-table-row {
        grid-template-columns: 60px 1fr;
        padding: 16px;
    }
    
    .stats-col {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, 1fr);
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
    
    .stat-header {
        display: none;
    }
    
    .stat-label-mobile {
        display: block;
    }
    
    .stat-value {
        align-items: flex-start;
    }
    
    .user-col {
        padding-left: 0;
    }
    
    .user-avatar-circle {
        width: 40px;
        height: 40px;
        font-size: 0.95em;
    }
    
    .medal {
        font-size: 1.5em;
    }
    
    .position-number {
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .ranking-tabs .tab-btn {
        padding: 12px 20px;
        font-size: 0.85em;
    }
    
    .stats-col {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-value {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    width: 500px;
    text-align: center;
    animation: modalSlideIn 0.3s;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.feedback-success {
    color: var(--success-color);
    font-size: 3em;
    margin-bottom: 20px;
}

.feedback-error {
    color: var(--error-color);
    font-size: 3em;
    margin-bottom: 20px;
}

.feedback-message {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.feedback-xp {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.5em;
    margin: 10px 0;
}

.feedback-lives-lost {
    color: var(--error-color);
    font-weight: bold;
    font-size: 1.3em;
    margin: 10px 0;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

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

.bounce {
    animation: bounce 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s;
}

/* Panel de Administración */
.admin-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.admin-tabs .tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1em;
    color: var(--text-light);
    transition: all 0.3s;
    margin-bottom: -2px;
}

.admin-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* Reportes de bugs */
.bug-report-item {
    margin-bottom: 20px;
}

.bug-report-item .admin-item-content {
    flex: 1;
}

.bug-reports-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.bug-reports-filters .filter-select {
    min-width: 200px;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

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

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-item {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.admin-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.admin-item-content {
    flex: 1;
}

.admin-item-content h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.2em;
}

.admin-item-content p {
    color: var(--text-light);
    margin-bottom: 10px;
}

.admin-item-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--text-light);
}

.admin-item-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Dashboard Stats */
.dashboard-stats {
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
}

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

.stat-icon {
    font-size: 3em;
    line-height: 1;
}

.stat-info h3 {
    font-size: 2em;
    color: var(--primary-color);
    margin: 0;
    font-weight: bold;
}

.stat-info p {
    color: var(--text-light);
    margin: 5px 0 0 0;
    font-size: 0.9em;
}

.period-selector {
    display: flex;
    gap: 10px;
}

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

.top-modules-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.top-modules-section h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.module-stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.module-rank {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2em;
    min-width: 40px;
}

.module-name {
    flex: 1;
    color: var(--text-color);
    font-weight: 500;
}

.module-count {
    color: var(--text-light);
    font-size: 0.9em;
}

/* Ejercicios agrupados por módulo */
.module-exercises-section {
    margin-bottom: 30px;
}

.module-section-title {
    color: var(--primary-color);
    font-size: 1.3em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

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

.badge-hint {
    background-color: #ff9800;
    color: white;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.85em;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Filtros de administración */
.admin-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 180px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: var(--text-light);
    font-size: 0.9em;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pagination-page {
    color: var(--text-color);
    font-weight: 500;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pantalla de Configuración */
.settings-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.settings-tabs .tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1em;
    color: var(--text-light);
    transition: all 0.3s;
    margin-bottom: -2px;
}

.settings-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

/* Sección Premium */
.premium-section {
    max-width: 1000px;
    margin: 0 auto;
}

.premium-description {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1em;
    margin-bottom: 30px;
}

.premium-status-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.premium-status-active {
    display: flex;
    align-items: center;
    gap: 20px;
}

.premium-status-active i {
    font-size: 3em;
    color: #ffd700;
}

.premium-status-active h3 {
    color: var(--primary-color);
    margin: 0 0 5px 0;
}

.premium-status-active p {
    color: var(--text-light);
    margin: 0;
}

.premium-status-inactive {
    display: flex;
    align-items: center;
    gap: 20px;
}

.premium-status-inactive i {
    font-size: 3em;
    color: var(--text-light);
}

.premium-status-inactive h3 {
    color: var(--text-color);
    margin: 0 0 5px 0;
}

.premium-status-inactive p {
    color: var(--text-light);
    margin: 0;
}

.premium-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.plan-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.plan-card.plan-featured {
    border-color: var(--primary-color);
    border-width: 3px;
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.plan-header {
    text-align: center;
    margin-bottom: 25px;
}

.plan-header h3 {
    color: var(--text-color);
    margin: 0 0 15px 0;
    font-size: 1.5em;
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}

.price-amount {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.price-period {
    font-size: 1em;
    color: var(--text-light);
}

.plan-savings {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.9em;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
}

.plan-features li {
    padding: 10px 0;
    color: var(--text-color);
    border-bottom: 1px solid #f0f0f0;
}

.plan-features li:last-child {
    border-bottom: none;
}

.plan-select-btn {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-weight: 600;
}

.premium-note {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9em;
}

/* Sección Privacidad */
.privacy-section {
    max-width: 900px;
    margin: 0 auto;
}

.privacy-section h2 {
    color: var(--text-color);
    margin-bottom: 30px;
}

.privacy-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.privacy-content section {
    margin-bottom: 30px;
}

.privacy-content section:last-child {
    margin-bottom: 0;
}

.privacy-content h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.privacy-content p {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 10px;
}

.privacy-content ul {
    margin: 15px 0;
    padding-left: 25px;
}

.privacy-content li {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 8px;
}

.privacy-date {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    font-size: 0.9em;
}

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

.btn-edit:hover {
    background-color: #1976d2;
}

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

.btn-delete:hover {
    background-color: #d32f2f;
}

.role-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
}

.premium-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 5px;
}

.modal-large {
    max-width: 950px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-large #admin-form-content {
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
    max-height: calc(90vh - 120px);
}

.modal-large #admin-form-content::-webkit-scrollbar {
    width: 8px;
}

.modal-large #admin-form-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-large #admin-form-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-large #admin-form-content::-webkit-scrollbar-thumb:hover {
    background: #1976d2;
}

.modal-large .form-actions {
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    .screen,
    .dashboard-container,
    .exercise-container,
    .exercise-content,
    .auth-container,
    .modal-content,
    .ranking-container {
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 16px;
        align-items: center;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .header-left {
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-start;
    }
    
    .header-right {
        flex: 1 1 auto;
        flex-direction: row;
        gap: 8px;
        justify-content: flex-end;
        align-items: center;
        min-width: 0;
    }
    
    .user-stats-header {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 6px;
        flex: 0 0 auto;
        order: 1;
    }
    
    /* Ocultar nivel en móvil para que el XP no quede cortado */
    .user-stats-header .stat-item:nth-child(2) {
        display: none;
    }
    
    .header-actions {
        order: 2;
        flex: 0 0 auto;
    }
    
    .user-menu {
        order: 3;
        flex: 0 0 auto;
        padding-left: 8px;
        border-left: 1px solid #e0e0e0;
    }
    
    .user-profile-dropdown {
        width: auto;
    }
    
    .dropdown-menu {
        right: 0;
        left: auto;
        width: auto;
        min-width: 200px;
    }
    
    /* En móvil muy pequeño, hacer el header más compacto */
    @media (max-width: 480px) {
        .header {
            padding: 8px 12px;
        }
        
        .header h1 {
            font-size: 1em;
        }
        
        .header-logo {
            width: 28px;
            height: 28px;
        }
        
        .stat-item {
            padding: 4px 6px;
            min-width: 35px;
        }
        
        .stat-label {
            font-size: 0.6em;
        }
        
        .stat-value {
            font-size: 0.85em;
        }
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .auth-container {
        margin: 50px 20px;
        padding: 30px 20px;
    }
    
    .admin-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-item-actions {
        width: 100%;
        margin-top: 15px;
        flex-wrap: wrap;
    }
    
    .admin-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* Ejercicios tablet */
    .exercise-content {
        padding: 20px 15px;
    }
    
    .exercise-header {
        margin-bottom: 20px;
    }
    
    .exercise-header h2 {
        font-size: 1.3em;
    }
    
    .code-editor {
        font-size: 15px;
    }
    
    /* Dashboard tablet */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Modal tablet */
    .modal-content {
        width: 90%;
        padding: 30px;
    }
    
    .modal-large {
        width: 90%;
        padding: 30px;
    }
    
    /* Lecciones tablet */
    .lesson-view {
        padding: 15px;
    }
    
    /* Botones de navegación */
    .btn-back {
        font-size: 0.9em;
        padding: 8px 14px;
    }
    
    /* Tabs móvil */
    .exercise-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .exercise-tabs .tab-btn {
        padding: 10px 18px;
        font-size: 0.9em;
        white-space: nowrap;
    }
    
    /* Admin tabs móvil - scroll horizontal */
    .admin-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin-bottom: 20px;
    }
    
    .admin-tabs .tab-btn {
        padding: 10px 16px;
        font-size: 0.85em;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Dropdown menu móvil - asegurar que no se salga */
    .dropdown-menu {
        max-width: calc(100vw - 24px);
        right: 12px !important;
        left: auto !important;
        width: auto;
        min-width: auto;
    }
    
    /* Si el dropdown está en el header, ajustar posición */
    .header .dropdown-menu {
        right: 12px !important;
        left: auto !important;
        max-width: calc(100vw - 24px);
        transform-origin: top right;
    }
}

@media (max-width: 480px) {
    .user-menu {
        flex-direction: column;
        gap: 10px;
    }
    
    .user-profile-dropdown {
        width: 100%;
    }
    
    .dropdown-menu {
        width: calc(100vw - 24px);
        max-width: 300px;
        right: 12px !important;
        left: auto !important;
    }
    
    /* Admin tabs móvil pequeño - scroll más suave */
    .admin-tabs {
        gap: 5px;
    }
    
    .admin-tabs .tab-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }
    
    /* Header móvil mejorado */
    .header h1 {
        font-size: 1.1em;
    }
    
    .header-logo {
        width: 32px;
        height: 32px;
    }
    
    .stat-item {
        padding: 4px 8px;
        min-width: 40px;
    }
    
    /* Ocultar nivel en móvil pequeño para que el XP no quede cortado */
    .user-stats-header .stat-item:nth-child(2) {
        display: none;
    }
    
    .stat-label {
        font-size: 0.65em;
    }
    
    .stat-value {
        font-size: 0.9em;
    }
    
    /* Ocultar nivel en móvil para que el XP no quede cortado */
    .stat-item:has(.stat-label:contains("Nivel")) {
        display: none;
    }
    
    /* Alternativa más compatible: ocultar el segundo stat-item (nivel) */
    .user-stats-header .stat-item:nth-child(2) {
        display: none;
    }
    
    /* Ejercicios móvil */
    .exercise-container {
        padding: 15px;
    }
    
    .exercise-header h2 {
        font-size: 1.2em;
    }
    
    .code-editor {
        font-size: 14px;
        padding: 12px;
    }
    
    .exercise-instruction {
        font-size: 0.95em;
        padding: 12px;
    }
    
    .exercise-actions {
        flex-direction: column;
    }
    
    .exercise-actions .btn {
        width: 100%;
    }
    
    /* Módulos móvil */
    .module-card {
        padding: 15px;
    }
    
    .module-card h3 {
        font-size: 1.1em;
    }
    
    /* Dashboard móvil */
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    /* Modal móvil */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .modal-large {
        width: 95%;
        max-width: 95%;
        padding: 20px;
    }
    
    /* Lecciones móvil */
    .lesson-view h2 {
        font-size: 1.4em;
    }
    
    .lesson-body {
        font-size: 0.95em;
    }
    
    .lesson-body pre {
        font-size: 0.85em;
        padding: 10px;
    }
    
    /* Camino de ejercicios móvil */
    .exercises-path {
        padding: 15px 10px;
    }
    
    .exercise-path-node {
        padding: 12px 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .exercise-path-title {
        font-size: 0.9em;
        margin-top: 8px;
    }
    
    /* Botones móvil */
    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .btn-small {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    /* Formularios móvil */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9em;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 10px;
    }
    
    /* Feedback móvil */
    .feedback-message {
        font-size: 0.9em;
        padding: 12px;
    }
    
    /* Pistas móvil */
    .hint-content {
        font-size: 0.9em;
        padding: 12px;
    }
    
}

/* Estilos adicionales para animaciones */
.level-up-message {
    animation: pulse 0.5s ease-in-out 3;
    font-size: 1.2em !important;
    margin-top: 10px;
}

.feedback-xp {
    animation: fadeInScale 0.5s ease-out;
}

