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

body {
    font-family: 'Lexend', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-toggle {
    position: fixed;
    left: 0;
    top: 20px;
    background: rgba(255, 255, 255, 0.5);
    color: #333;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 0 25px 25px 0;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1001;
    backdrop-filter: blur(5px);
}

.sidebar-toggle.open {
    left: 320px;
    padding: 12px 15px;
    min-width: auto;
}

.sidebar-toggle .toggle-text {
    transition: opacity 0.2s ease, max-width 0.2s ease;
}

.sidebar-toggle.open .toggle-text {
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.7);
    padding-right: 25px;
}

.sidebar-toggle.open:hover {
    padding-right: 15px;
}

.sidebar-content {
    position: fixed;
    left: 0;
    top: 0;
    width: 320px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 20px;
    transition: transform 0.3s ease;
    z-index: 1000;
    transform: translateX(-100%);
}

.sidebar-content.sidebar-open {
    transform: translateX(0);
}

.sidebar-content h3 {
    margin-bottom: 20px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.language-group {
    margin-bottom: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    overflow: hidden;
}

.language-header {
    background: #f8f9fa;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #667eea;
    transition: background 0.2s ease;
}

.language-header:hover {
    background: #e9ecef;
}

.language-arrow {
    transition: transform 0.3s ease;
}

.language-group.collapsed .language-arrow {
    transform: rotate(-90deg);
}

.language-actions {
    padding: 10px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
}

.language-actions button {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 5px;
}

.language-actions button:hover {
    background: #5a6fd8;
}

.material-item {
    padding: 12px 15px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.material-item:hover {
    background: #f8f9fa;
}

.material-info {
    flex: 1;
}

.material-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.05em;
}

.material-meta {
    font-size: 12px;
    color: #666;
}

.material-actions {
    display: flex;
    gap: 5px;
}

.material-actions button {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.material-actions button:hover {
    background: #45b8b0;
}

.material-actions button.delete-btn {
    background: #ff6b6b;
}

.material-actions button.delete-btn:hover {
    background: #e55555;
}

.language-materials {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.language-group.collapsed .language-materials {
    max-height: 0;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    margin-top: 60px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

/* Text Input Section */
#text-input {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    resize: vertical;
    margin-bottom: 20px;
}

#text-input:focus {
    outline: none;
    border-color: #667eea;
}

.input-controls {
    display: flex;
    gap: 10px;
}

.input-controls button {
    flex: 1;
}

#process-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
    position: relative;
    overflow: hidden;
}

#process-btn:hover {
    background: #5a6fd8;
}

.btn-loading-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: rgba(0, 255, 255, 0.1);
    transition: width 3s ease;
    border-radius: 25px;
    z-index: 1;
}

.btn-text {
    position: relative;
    z-index: 2;
}

#save-materials-btn {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#save-materials-btn:hover {
    background: #45b8b0;
}

/* Progress Section */
.progress-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

#reset-progress {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 15px;
    cursor: pointer;
}

/* Flashcards Section */
.flashcards-container {
    perspective: 1000px;
    margin-bottom: 20px;
}

.flashcard {
    width: 300px;
    height: 200px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.flashcard-front {
    background: #667eea;
    color: white;
}

.flashcard-back {
    background: #4ecdc4;
    color: white;
    transform: rotateY(180deg);
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.flashcard-controls button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

/* Minigame Section */
#minigame-section {
    margin-bottom: 200px;
}

.game-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-weight: bold;
}

.game-question {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.2rem;
}

.game-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.option-btn:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.option-btn.correct {
    background: #4ecdc4;
    color: white;
    border-color: #4ecdc4;
}

.option-btn.incorrect {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.game-feedback {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: bold;
}

.game-feedback.correct {
    background: #d4edda;
    color: #155724;
}

.game-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

#next-question {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    margin: 0 auto;
    display: block;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    section {
        padding: 20px;
    }
    
    .game-options {
        grid-template-columns: 1fr;
    }
    
    .flashcard {
        width: 250px;
        height: 175px;
    }
}