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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-button {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #4a5568;
}

.back-button:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title h1 {
    font-size: 1.3em;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

@media (min-width: 768px) {
    .app-header {
        padding: 20px 40px;
    }
    
    .app-title h1 {
        font-size: 1.5em;
    }
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
}

.content-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.vocab-content {
    padding: 0;
}

@media (min-width: 768px) {
    .container {
        padding: 32px 40px;
    }

    .content-card {
        padding: 32px;
        border-radius: 24px;
    }
}

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

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

@media (min-width: 768px) {
    .form-group {
        margin-bottom: 25px;
    }

    label {
        font-size: 1em;
    }
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.results {
    margin-top: 30px;
    display: none;
}

.results.show {
    display: block;
    animation: fadeIn 0.5s;
}

.vocab-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.vocab-card:hover {
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    .vocab-card {
        padding: 20px;
        margin-bottom: 20px;
    }
}

.vocab-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
}

.vocab-image-container {
    text-align: center;
    margin: 15px 0;
}

.vocab-word {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    position: relative;
}

@media (min-width: 768px) {
    .vocab-word {
        font-size: 1.5em;
    }
}

.vocab-word:hover {
    color: #764ba2;
    transform: scale(1.05);
}

.vocab-word::after {
    content: ' 🎯';
    font-size: 0.6em;
    opacity: 0.7;
}

.quiz-hint {
    font-size: 0.7em;
    color: #999;
    font-weight: normal;
    display: block;
    margin-top: 5px;
}

.vocab-definition {
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.vocab-arabic {
    background: #e8f5e9;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-right: 3px solid #4caf50;
    direction: rtl;
    text-align: right;
}

.vocab-arabic-label {
    font-weight: bold;
    color: #2e7d32;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.vocab-arabic-text {
    color: #1b5e20;
    font-size: 1.1em;
}

.arabic-example {
    background: #fff3e0;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    border-right: 3px solid #ff9800;
    direction: rtl;
    text-align: right;
}

.arabic-example-label {
    font-weight: bold;
    color: #e65100;
    font-size: 0.85em;
    margin-bottom: 5px;
    display: block;
}

.difficulty-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 15px;
}

.difficulty-intermediate {
    background: #ffd93d;
    color: #333;
}

.difficulty-advanced {
    background: #ff6b6b;
    color: white;
}

.example-sentence {
    background: #f5f5f5;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    border-left: 3px solid #764ba2;
}

.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #ff6b6b;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}

.error-message.show {
    display: block;
    animation: fadeIn 0.5s;
}

.info-box {
    background: #ebf4ff;
    border-left: 4px solid #4299e1;
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 12px;
    font-size: 0.95em;
}

.info-box p {
    margin: 5px 0;
    color: #2c5282;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .info-box {
        padding: 15px;
        margin-bottom: 25px;
        font-size: 1em;
    }
}

/* Quiz Modal Styles */
.quiz-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.quiz-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.quiz-container {
    background: white;
    border-radius: 10px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUp 0.3s;
    margin: 0 10px;
}

@media (min-width: 768px) {
    .quiz-container {
        border-radius: 15px;
        margin: 0;
    }
}

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

.quiz-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-header h2 {
    margin: 0;
    font-size: 1.3em;
}

@media (min-width: 768px) {
    .quiz-header {
        padding: 25px;
        border-radius: 15px 15px 0 0;
    }

    .quiz-header h2 {
        font-size: 1.8em;
    }
}

.close-quiz {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.close-quiz:hover {
    background: rgba(255,255,255,0.3);
}

.quiz-content {
    padding: 15px;
}

@media (min-width: 768px) {
    .quiz-content {
        padding: 30px;
    }
}

.quiz-question {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

.quiz-question h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    background: white;
    border: 2px solid #ddd;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.quiz-option:hover {
    border-color: #667eea;
    background: #f5f5ff;
}

.quiz-option.selected {
    border-color: #667eea;
    background: #e8eaf6;
}

.quiz-option.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.quiz-option.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

.option-label {
    font-weight: bold;
    margin-right: 10px;
    color: #667eea;
}

.quiz-explanation {
    background: #fff9e6;
    border-left: 4px solid #ffd93d;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    display: none;
}

.quiz-explanation.show {
    display: block;
    animation: fadeIn 0.5s;
}

.quiz-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

@media (min-width: 768px) {
    .quiz-footer {
        padding: 20px 30px;
        flex-wrap: nowrap;
    }
}

.quiz-score {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.quiz-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.quiz-btn:hover {
    transform: translateY(-2px);
}

.quiz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
