@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --font-family: 'Inter', sans-serif;
    
    --light-bg: #f4f7fa;
    --light-surface: #ffffff;
    --light-text: #1a202c;
    --light-text-secondary: #718096;
    --light-border: #e2e8f0;
    --light-primary: #3498db;
    --light-primary-hover: #2980b9;

    --dark-bg: #1a202c;
    --dark-surface: #2d3748;
    --dark-text: #e2e8f0;
    --dark-text-secondary: #a0aec0;
    --dark-border: #4a5568;
    --dark-primary: #4299e1;
    --dark-primary-hover: #2b6cb0;
    
    --bg-color: var(--light-bg);
    --surface-color: var(--light-surface);
    --text-color: var(--light-text);
    --text-secondary-color: var(--light-text-secondary);
    --border-color: var(--light-border);
    --primary-color: var(--light-primary);
    --primary-hover-color: var(--light-primary-hover);
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 8px;
    --transition-speed: 0.3s ease;
}

/* --- Splash Screen --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a202c, #4a0e97);
    z-index: 10001;
    transition: opacity 0.7s ease-out;
}

.splash-logo-container {
    position: relative;
    overflow: hidden; /* To contain the shine effect */
    border-radius: 16px; /* Soft corners for the container */
    margin-bottom: 1.5rem;
}

.splash-logo {
    width: 150px;
    height: auto;
    display: block;
}

.splash-logo-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 75%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: shine 3s infinite ease-in-out;
}

@keyframes shine {
    0% { left: -150%; }
    50% { left: 150%; }
    100% { left: 150%; }
}

.splash-title {
    font-size: 3.5rem;
    color: white;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    margin-bottom: 2rem;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.splash-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #4299e1, #9f7aea, #ed64a6, #4299e1);
    background-size: 400% 100%;
    animation: loading-gradient 2s linear infinite;
}

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

.splash-loading-text {
    position: absolute;
    bottom: 30px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    letter-spacing: 1px;
}

body.dark-mode {
    --bg-color: var(--dark-bg);
    --surface-color: var(--dark-surface);
    --text-color: var(--dark-text);
    --text-secondary-color: var(--dark-text-secondary);
    --border-color: var(--dark-border);
    --primary-color: var(--dark-primary);
    --primary-hover-color: var(--dark-primary-hover);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

#app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
#sidebar {
    width: 250px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    transition: all var(--transition-speed);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.logo {
    width: 40px;
    height: 40px;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin-bottom: 0.5rem;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-item img {
    width: 24px;
    height: 24px;
}

.nav-item.active img {
    filter: brightness(0) invert(1);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* --- Main Content --- */
#main-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    animation: fadeIn 0.5s ease-in-out;
}

.user-profile span {
    font-weight: 500;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-profile img:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px var(--primary-color);
}

/* --- Components --- */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

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

.btn:disabled {
    background-color: var(--text-secondary-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
     background-color: var(--bg-color);
}

.card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width var(--transition-speed);
}

.badges-container {
    display: flex;
    gap: 1rem;
    font-size: 1.5rem;
    flex-wrap: wrap;
}

.badges-container p {
    font-size: 1rem;
    color: var(--text-secondary-color);
}

.badge-icon {
    width: 50px;
    height: 50px;
    transition: transform var(--transition-speed);
}

.badge-icon:hover {
    transform: scale(1.1);
}

/* --- Social Promo Section --- */
.social-promo {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1.5rem;
}

.social-promo h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 500;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: var(--border-radius);
    color: white;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.youtube-btn {
    background-color: #FF0000;
}

.youtube-btn:hover {
    background-color: #cc0000;
    color: white;
}

.tiktok-btn {
    background: #010101;
    color: white;
    position: relative;
    overflow: hidden;
}

.tiktok-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20%;
    width: 25px;
    height: 150%;
    background: #25f4ee;
    transform: translateY(-50%) rotate(45deg);
    transition: all 0.3s;
}

.tiktok-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20%;
    width: 25px;
    height: 150%;
    background: #fe2c55;
    transform: translateY(-50%) rotate(45deg);
    transition: all 0.3s;
}

.tiktok-btn:hover::before {
    left: -15%;
}
.tiktok-btn:hover::after {
    right: -15%;
}

.tiktok-btn:hover {
    background: #010101; /* Mantener color de fondo */
    color: white;
}

.tiktok-btn svg, .tiktok-btn span {
    z-index: 1;
}

/* --- Dashboard --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

#current-level-name {
    color: var(--primary-color);
}

.progress-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.toggle-arrow {
    transition: transform var(--transition-speed);
}
.toggle-arrow.open {
    transform: rotate(180deg);
}

.detailed-progress-container {
    margin-top: 1.5rem;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.5s;
}

.detailed-progress-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.detailed-progress-item .label-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}
.detailed-progress-item .label-container .level-name {
    font-weight: bold;
}
.detailed-progress-item .label-container .level-status {
    color: var(--text-secondary-color);
}
.detailed-progress-item .progress-bar {
    margin-top: 0;
}


/* --- Lessons --- */
.level-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.level-tab {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: var(--text-secondary-color);
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-speed);
}

.level-tab:hover {
    color: var(--text-color);
}

.level-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.level-tab.locked {
    color: var(--text-secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.lessons-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.lesson-category-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.lessons-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.lesson-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.lesson-card.level-locked {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-color);
    border-left: 4px solid var(--border-color);
    pointer-events: none; /* Disables click */
}

.lesson-card.level-locked:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.lesson-card.completed {
    border-left: 4px solid var(--primary-color);
    opacity: 0.8;
}

.lesson-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-color);
    border-left: 4px solid var(--border-color);
}

.lesson-card.locked .lesson-card-header h4 {
    color: var(--text-secondary-color);
}

.lesson-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.lesson-card-header h3 {
    color: var(--primary-color);
    margin-bottom: 0;
}

.lesson-card-header h4 {
    color: var(--primary-color);
    margin-bottom: 0;
    margin-right: 1rem;
}

.completed-check {
    color: var(--primary-color);
    font-weight: bold;
}

.lesson-card p {
    color: var(--text-secondary-color);
    font-size: 0.9rem;
}

/* --- Guide --- */
.guide-toolbar {
    margin-bottom: 1.5rem;
}

#guide-search {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    font-size: 1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.tag-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.tag-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tag-card-header h3 {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
}

.tag-card-header span {
    background-color: var(--bg-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-card h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary-color);
}

.tag-card pre {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.9rem;
    font-family: 'Courier New', Courier, monospace;
}

body.dark-mode .tag-card pre {
    background-color: #1e2533;
}

/* --- Exams --- */
#exams-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.exam-category-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.exam-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    text-align: center;
}

.exam-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-color);
}

.exam-card:not(.disabled):hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.exam-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.exam-card p {
    color: var(--text-secondary-color);
    margin-bottom: 1rem;
}

.exam-status {
    font-weight: bold;
    color: var(--primary-color);
}

.exam-card.disabled .exam-status {
    color: var(--text-secondary-color);
}

#exam-selection h3 {
    margin-bottom: 2rem;
}

#question-container {
    margin: 2rem 0;
}
.question-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.option {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
}
.option:hover {
    background-color: var(--bg-color);
}
.option input {
    margin-right: 0.5rem;
}
.exam-navigation {
    text-align: right;
}

#exam-results h3 {
    margin-bottom: 1rem;
}

#exam-results p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.result-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* --- AI Chat --- */
.ai-chat-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    height: calc(100vh - 10rem);
}

.chat-area, .library-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#ai-chat-window {
    flex-grow: 1;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-message, .ai-message {
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    max-width: 80%;
    line-height: 1.5;
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
}

.ai-message {
    background-color: var(--bg-color);
    align-self: flex-start;
}

.ai-message em {
    font-style: italic;
    color: var(--text-secondary-color);
}

.ai-message b, .ai-message strong {
    color: var(--primary-color);
}

.ai-message code {
    background-color: var(--border-color);
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 6px;
}

.ai-message pre {
     background-color: #e2e8f0;
     color: #1a202c;
     padding: 1rem;
     border-radius: var(--border-radius);
     margin-top: 0.5rem;
     white-space: pre-wrap;
     word-break: break-all;
     font-family: 'Courier New', Courier, monospace;
}

body.dark-mode .ai-message pre {
    background-color: #1e2533;
    color: var(--dark-text);
}

.ai-message .btn {
    margin-top: 0.5rem;
    display: block;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

#ai-chat-form {
    display: flex;
    gap: 1rem;
}

#ai-chat-input {
    flex-grow: 1;
    padding: 0.8rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
}

.library-area {
    padding: 1.5rem;
    overflow-y: auto;
}

.library-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.library-item p {
    margin-bottom: 0.5rem;
}

.library-answer {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
}

.library-answer .btn {
    display: none; /* Hide save button in library view */
}

/* --- Lesson View & Practice --- */
.lesson-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 12rem);
}
.lesson-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}
#lesson-theory {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-y: auto;
    flex-grow: 1;
}

#lesson-evaluation-area {
    padding: 1.5rem;
    flex-shrink: 0; /* Prevent it from shrinking */
}
#lesson-evaluation-area h3 {
    margin-bottom: 1rem;
}
#lesson-evaluation-area .evaluation-question {
    margin-bottom: 1rem;
}
.reward-claim-container {
    text-align: center;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    border: 2px dashed var(--primary-color);
}
.reward-claim-container .reward-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    animation: glow 2s infinite ease-in-out;
}
.reward-claim-container .reward-icon.claimed {
    animation: none;
    filter: grayscale(80%);
}
@keyframes glow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--primary-color)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 15px var(--primary-color)); }
}

.lesson-evaluation-area .options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lesson-evaluation-area .option {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
}
.lesson-evaluation-area .option:hover {
    background-color: var(--bg-color);
}
.lesson-evaluation-area .option.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}
.lesson-evaluation-area .option.correct {
    border-color: #38a169;
    background-color: #38a169;
    color: white;
}
.lesson-evaluation-area .option.incorrect {
    border-color: #e53e3e;
    background-color: #e53e3e;
    color: white;
}
.lesson-evaluation-area .option.incorrect-selection {
    border-color: #e53e3e;
    background-color: transparent;
    color: var(--dark-text);
}

.lesson-practice-area {
    display: flex;
    flex-direction: column;
}

.lesson-practice-area, .editor-area, .preview-area {
    display: flex;
    flex-direction: column;
}

.lesson-actions {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0;
}

.preview-container {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: var(--surface-color);
}

.CodeMirror {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    height: auto;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.editor-toolbar span {
    font-weight: 500;
}

/* --- Felipe AI Assistant (Practice Section) --- */
.felipe-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

.felipe-chat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.felipe-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.felipe-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.felipe-intro h3 {
    margin-bottom: 0.25rem;
}
.felipe-intro p {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
}

.felipe-message-box {
    flex-grow: 1;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    font-size: 0.9rem;
    line-height: 1.6;
}
.felipe-message-box .loading {
    color: var(--primary-color);
}
.felipe-message-box .error {
    color: #e53e3e;
}
.felipe-message-box .success {
    color: #38a169;
}

.felipe-form-card {
    display: flex;
    flex-direction: column;
}

.felipe-form-card .form-group {
    margin-bottom: 1rem;
}
.felipe-form-card textarea {
    width: 100%;
    padding: 0.6rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
}

.file-selection-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.file-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.file-checkbox input {
    width: 16px;
    height: 16px;
}

.felipe-form-card .usage-limit {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary-color);
    text-align: center;
    background-color: var(--bg-color);
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

/* --- Warehouse Page --- */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

#warehouse-upload-card {
    text-align: center;
}
#warehouse-upload-card p {
    margin-bottom: 1rem;
    color: var(--text-secondary-color);
}

.storage-details {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
#storage-used {
    color: var(--primary-color);
}

.file-list-container {
    margin-top: 2rem;
}

#file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.file-item {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform var(--transition-speed);
}
.file-item:hover {
    transform: translateY(-3px);
}

.file-thumbnail {
    width: 100%;
    height: 120px;
    border-radius: 4px;
    background-color: var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    overflow: hidden;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumbnail .video-icon {
    width: 50px;
    height: 50px;
    color: var(--text-secondary-color);
}

.file-info h4 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-info p {
    font-size: 0.8rem;
    color: var(--text-secondary-color);
}

.file-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.file-actions .btn-small {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
}

.file-actions .delete-btn {
    background-color: #e53e3e;
    color: white;
}
.file-actions .delete-btn:hover {
    background-color: #c53030;
}

/* --- Settings Page --- */
.form-group {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.form-group-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding: 0.8rem;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
}
.form-group-toggle label {
    font-weight: 500;
}
.form-group-toggle input {
    margin: 0 0.5rem 0 1rem;
}
.form-group input {
    padding: 0.6rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}
.input-with-button input {
    flex-grow: 1;
}

.form-group button {
    align-self: flex-start;
}

.profile-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-badges {
    justify-content: flex-start;
}

.settings-badges .badge-icon {
    width: 60px;
    height: 60px;
}

.settings-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.settings-progress-card {
    border-left: 4px solid var(--primary-color);
}
.settings-progress-card.locked {
    border-left-color: var(--border-color);
    opacity: 0.7;
}
.settings-progress-card h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}
.settings-progress-card p {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
}
.settings-progress-card .progress-bar {
    margin: 0.75rem 0 0.5rem;
}
.settings-progress-card span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- Toast Notification --- */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -100px);
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2000;
    opacity: 0;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
    font-weight: 500;
}
.toast-notification.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast-notification.success {
    background-color: #4caf50;
    color: white;
}

body.dark-mode .toast-notification.success {
    background-color: #38a169;
}

/* --- Onboarding Tutorial --- */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998; /* Under the highlighted element and bubble */
    background-color: rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease;
}

#tutorial-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.tutorial-highlight {
    position: relative;
    z-index: 9999;
    box-shadow: 0 0 0 4px var(--primary-color), 0 0 20px 4px var(--primary-color);
    border-radius: var(--border-radius);
    transition: box-shadow 0.3s ease-in-out;
}

#tutorial-bubble {
    position: fixed;
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 10000;
    width: 300px;
    max-width: 90vw;
    transition: all 0.4s ease-in-out;
}

#tutorial-bubble h3 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

#tutorial-bubble p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.tutorial-nav-steps {
    display: flex;
    gap: 0.5rem;
}

#tutorial-hand {
    position: fixed;
    font-size: 30px;
    z-index: 10000;
    transform: rotate(-45deg);
    animation: pointAnimation 1.5s infinite ease-in-out;
    transition: all 0.4s ease-in-out;
}

@keyframes pointAnimation {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-5px); }
}

/* --- Welcome Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex; /* Always flex for centering */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
    text-align: center;
    animation: fadeInSlideUp 0.4s ease-out;
}

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

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary-color);
    margin-bottom: 1.5rem;
}

.modal-content .form-group {
    align-items: center;
}
.modal-content .form-group input {
    width: 100%;
    text-align: center;
}

.saved-accounts-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    max-height: 300px;
    overflow-y: auto;
}

.saved-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
}

.saved-profile:hover {
    background-color: var(--bg-color);
}

.saved-profile img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}

.saved-profile span {
    font-weight: 500;
}

#show-new-account-form-btn {
    margin-top: 1rem;
}

.avatar-selection {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}
.avatar-selection p {
    margin-bottom: 1rem;
}
.avatar-choices {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.avatar-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color var(--transition-speed);
    object-fit: cover;
}
.avatar-option:hover {
    border-color: var(--text-secondary-color);
}
.avatar-option.selected {
    border-color: var(--primary-color);
}
.upload-label {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    background-color: var(--bg-color);
    color: var(--text-secondary-color);
}
.upload-label:hover {
     background-color: var(--border-color);
}

#logout-btn {
    background-color: #e53e3e;
    color: white;
    border: none;
}

#logout-btn:hover {
    background-color: #c53030;
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
}
.btn-danger:hover {
    background-color: #c53030;
}
body.dark-mode .btn-danger {
    background-color: #c53030;
}
body.dark-mode .btn-danger:hover {
    background-color: #9b2c2c;
}

body.dark-mode #logout-btn {
    background-color: #c53030;
}
body.dark-mode #logout-btn:hover {
    background-color: #9b2c2c;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .interactive-practice-container {
        grid-template-columns: 1fr;
    }
    .lesson-content-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

@media (max-width: 768px) {
    #app-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar-header h1, .nav-item span {
        display: none;
    }

    .sidebar-header {
        margin: 0;
    }

    .nav-menu {
        display: flex;
        flex-grow: 0;
        gap: 0.5rem;
    }

    .nav-item {
        padding: 0.5rem;
        margin: 0;
    }

    .sidebar-footer {
        display: flex;
        gap: 0.5rem;
        padding-top: 0;
        border-top: none;
    }

    #main-content {
        padding: 1rem;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .dashboard-grid, .guide-grid, .exams-grid, .settings-progress-grid, #file-list {
        grid-template-columns: 1fr;
    }

    .lesson-content-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .practice-container {
        height: calc(100vh - 10rem);
    }
    
    .ai-chat-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .library-area {
        margin-top: 2rem;
        height: 300px;
    }
    .felipe-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}