/* Root variables */
:root {
    --primary-color: #1976D2;
    --secondary-color: #2196F3;
    --dark-text: #333;
    --light-text: #777;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --card-padding: 20px;
    --font-size-large: 18px;
    --font-size-xlarge: 24px;
    --correct-color: #4caf50;
    --incorrect-color: #f44336;
    --transition-speed: 0.3s;
    --progress-surface: #ffffff;
    --progress-surface-alt: #f1f4ff;
    --progress-border: rgba(0, 0, 0, 0.08);
    --progress-text: var(--dark-text);
    --progress-subtle-text: var(--light-text);
    --progress-chip-bg: #f1f4ff;
    --progress-chip-text: var(--dark-text);
}

/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: var(--dark-text);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

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

h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2rem;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.select-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: var(--font-size-large);
    cursor: pointer;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-large);
    transition: all 0.2s ease;
}

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

.primary-btn:hover {
    background-color: #1565C0;
}

.secondary-btn {
    background-color: #f0f0f0;
    color: var(--dark-text);
}

.secondary-btn:hover {
    background-color: #e0e0e0;
}

.audio-btn {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-btn:hover {
    background-color: #f0f7ff;
}

.audio-icon {
    font-size: 20px;
}

.hidden {
    display: none !important;
}

.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.hanzi-section {
    background-color: var(--primary-color);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.hanzi-section h2 {
    font-size: 60px;
    font-weight: normal;
}

.image-section {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
}

.vocabulary-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    object-fit: cover;
}

.details-section {
    padding: 25px;
}

#pinyin {
    font-size: var(--font-size-xlarge);
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.meanings {
    margin-bottom: 25px;
}

/* Fix for alignment and spacing issues */
.meanings p, .review-meanings p {
    margin-bottom: 10px !important;
    font-size: var(--font-size-large) !important;
    display: flex !important;
    align-items: center !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
    margin-left: 0 !important;
    white-space: normal !important;
}

/* Make all labels exactly the same */
.meanings p strong, .review-meanings p strong {
    min-width: 100px !important;
    display: inline-block !important;
    font-weight: bold !important;
    color: var(--primary-color) !important;
    text-align: left !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
}

/* Add the colon after the label, not within it */
.meanings p strong::after, .review-meanings p strong::after {
    content: ":" !important;
    margin-right: 5px !important;
}

/* Remove any colons that might be in the original text */
.meanings p strong, .review-meanings p strong {
    content: attr(data-text) !important;
}

/* Reset all spans to consistent styling */
.meanings p span, .review-meanings p span {
    margin-left: 5px !important;
    font-weight: normal !important;
    display: inline !important;
    color: var(--dark-text) !important;
}

/* Strong style consistency for Type, English, Indonesian */
.meanings p strong, .review-meanings p strong {
    min-width: 110px;
    display: inline-block;
    font-weight: bold !important;
    color: var(--primary-color) !important;
    text-align: left !important;
    padding-right: 10px !important;
}

/* Consistent spacing for all values */
.meanings p span, .review-meanings p span {
    margin-left: 5px;
}

/* Make all content paragraphs consistent */
.details-section > p:not(#pinyin), .review-details > p:not(#review-pinyin) {
    margin-bottom: 10px;
    font-size: var(--font-size-large);
}

.audio-player {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Sentence Audio Button */
.sentence-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.sentence-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d63031 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.sentence-btn:active {
    transform: translateY(0);
}


/* Quiz Audio Container Layout */
.quiz-audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.quiz-audio-container .audio-btn {
    margin: 0 5px;
}

/* Review Section Audio Layout */
.review-section .audio-btn {
    margin: 5px;
}

/* Dark theme compatibility */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    .meanings p, .details-section p, .review-details p {
        color: #ffffff;
    }
    
    .meanings strong, .details-section strong, .review-details strong {
        color: #ffffff;
    }
    
    .quiz-transition {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    .quiz-transition .card {
        background-color: #3d3d3d;
        color: #ffffff;
    }
    
    .detailed-results {
        background-color: #2d2d2d;
        color: #1976D2;
    }
    
    .detailed-results h3 {
        color: #1976D2;
    }
    
    .detailed-results p {
        color: #1976D2;
    }
    
    .detailed-results strong {
        color: #1976D2;
    }
    
    .detailed-results hr {
        background: #555555;
    }
}

.navigation {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.progress {
    text-align: center;
    color: var(--light-text);
    font-size: var(--font-size-large);
    margin-bottom: 15px;
}

#start-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    text-align: center;
}

.welcome-box {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 600px;
    width: 100%;
}

.welcome-box h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.welcome-box p {
    margin-bottom: 25px;
    font-size: var(--font-size-large);
}

.features {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 150px;
}

.feature-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.server-instructions {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 30px;
    text-align: left;
}

.server-instructions h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.server-instructions ol {
    padding-left: 20px;
}

.server-instructions li {
    margin-bottom: 10px;
}

.server-instructions code {
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* Play button styles */
.play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon {
    font-size: 20px;
}

/* Start test container at the bottom */
.start-test-container {
    margin-top: 30px;
    text-align: center;
}

#bottom-start-test {
    min-width: 200px;
    font-size: var(--font-size-large);
    padding: 15px 30px;
}

/* Quiz Section Styles */
#quiz-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.5s ease-in-out;
}

.quiz-card {
    max-width: 550px;
    width: 100%;
    margin: 0 auto 30px;
}

.quiz-header {
    background-color: var(--secondary-color);
    color: white;
    padding: 15px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    text-align: center;
}

.quiz-progress {
    font-size: var(--font-size-large);
    font-weight: bold;
}

.quiz-content {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    animation: slideUp 0.4s ease-out;
}

.quiz-audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.quiz-instruction {
    color: var(--light-text);
    font-style: italic;
    text-align: center;
}

.quiz-question-text {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.quiz-question-text h3 {
    font-size: var(--font-size-xlarge);
    margin-bottom: 10px;
    color: var(--dark-text);
}

#quiz-word {
    font-weight: bold;
    color: var(--primary-color);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.quiz-option-btn {
    background-color: white;
    color: var(--dark-text);
    border: 1px solid #ddd;
    transition: all 0.25s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px 10px;
    position: relative;
    overflow: hidden;
}

.quiz-option-btn:hover {
    background-color: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.quiz-option-btn.selected {
    background-color: #e3f2fd;
    border-color: var(--secondary-color);
}

.quiz-option-btn.correct {
    background-color: rgba(76, 175, 80, 0.15);
    border-color: var(--correct-color);
    color: var(--correct-color);
    font-weight: bold;
    animation: correctPulse 0.6s ease-in-out;
}

.quiz-option-btn.correct::before {
    content: '✓';
    position: absolute;
    right: 10px;
    font-size: 18px;
}

.quiz-option-btn.incorrect {
    background-color: rgba(244, 67, 54, 0.15);
    border-color: var(--incorrect-color);
    color: var(--incorrect-color);
    animation: incorrectShake 0.5s ease-in-out;
}

.quiz-option-btn.incorrect::before {
    content: '✗';
    position: absolute;
    right: 10px;
    font-size: 18px;
}

.quiz-feedback {
    margin-top: 20px;
    padding: 0 20px;
    animation: fadeIn 0.4s ease;
}

.feedback-message {
    padding: 15px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-large);
    display: flex;
    align-items: center;
    gap: 10px;
}

.feedback-message.correct {
    background-color: rgba(76, 175, 80, 0.15);
    color: var(--correct-color);
    animation: slideInFromBottom 0.5s ease;
}

.feedback-message.incorrect {
    background-color: rgba(244, 67, 54, 0.15);
    color: var(--incorrect-color);
    animation: slideInFromBottom 0.5s ease;
}

.feedback-icon {
    font-size: var(--font-size-xlarge);
    font-weight: bold;
}

.quiz-navigation {
    display: flex;
    justify-content: center;
    margin: 0 auto 20px;
    width: 100%;
}

.quiz-navigation .btn {
    min-width: 180px;
    position: relative;
    overflow: hidden;
}

.quiz-navigation .btn:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 2s linear;
}

.quiz-navigation .btn:not(:disabled):after {
    transform: scaleX(1);
    transform-origin: left;
}

.quiz-results {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    margin: 20px auto;
    animation: scaleIn 0.5s ease;
}

.quiz-results h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.quiz-results p {
    font-size: var(--font-size-xlarge);
    margin-bottom: 20px;
}

/* Quiz Transition */
.quiz-transition {
    text-align: center;
    padding: 40px 20px;
}

.quiz-transition .card {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.quiz-transition h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

.quiz-transition h3 {
    margin: 20px 0 10px 0;
    font-size: 20px;
}

.quiz-transition hr {
    border: none;
    height: 1px;
    background: rgba(255,255,255,0.3);
    margin: 20px 0;
}

.quiz-transition .btn {
    margin-top: 20px;
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 12px 24px;
    font-weight: bold;
}

.quiz-transition .btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

/* Detailed Results */
.detailed-results {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: left;
}

.detailed-results h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.detailed-results hr {
    border: none;
    height: 1px;
    background: #dee2e6;
    margin: 15px 0;
}

.review-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Student progress tracker */
.student-progress-card {
    padding: 24px;
    background-color: var(--progress-surface);
    color: var(--progress-text);
}

.student-progress-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.student-progress-updated {
    font-size: 0.95rem;
    color: var(--light-text);
}

.student-progress-status {
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--light-text);
}

.student-progress-status[data-state="loading"] {
    color: var(--primary-color);
}

.student-progress-status[data-state="empty"] {
    color: var(--light-text);
}

.student-progress-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.student-progress-description {
    color: var(--progress-subtle-text);
}

.student-progress-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.student-progress-table-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.student-progress-table-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.student-progress-table-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.student-progress-total {
    font-size: 0.95rem;
    color: var(--progress-subtle-text);
}

.student-progress-table-container {
    overflow-x: auto;
}

.student-progress-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    font-size: 0.95rem;
}

.student-progress-table th,
.student-progress-table td {
    border: 1px solid var(--progress-border);
    padding: 8px 10px;
    text-align: center;
    color: var(--progress-chip-text);
}

.student-progress-table th {
    background-color: var(--progress-surface-alt);
    color: var(--progress-text);
    font-weight: 600;
}

.student-progress-table td {
    background-color: var(--progress-surface);
}

.student-progress-table td:nth-child(odd) {
    background-color: var(--progress-surface-alt);
}

.student-progress-table .sticky-column {
    position: sticky;
    left: 0;
    background-color: var(--progress-surface-alt);
    z-index: 1;
}

.student-progress-mobile-grid {
    display: none;
    gap: 10px;
}

.student-progress-mobile-item {
    background-color: var(--progress-chip-bg);
    border: 1px solid var(--progress-border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--progress-chip-text);
    font-variant-numeric: tabular-nums;
}

.student-progress-mobile-chapter {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.8;
}

.student-progress-mobile-total {
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .student-progress-table {
        min-width: 100%;
        font-size: 0.85rem;
    }

    .student-progress-card {
        padding: 18px;
    }

    .student-progress-table-container {
        display: none;
    }

    .student-progress-mobile-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --progress-surface: rgba(255, 255, 255, 0.06);
        --progress-surface-alt: rgba(255, 255, 255, 0.12);
        --progress-border: rgba(255, 255, 255, 0.16);
        --progress-text: #f4f6fb;
        --progress-subtle-text: rgba(244, 246, 255, 0.72);
        --progress-chip-bg: rgba(255, 255, 255, 0.12);
        --progress-chip-text: #f4f6fb;
    }

    .student-progress-card {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    }

    .student-progress-mobile-item {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

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

.quiz-btn:hover {
    background-color: #1565C0;
}

/* Question transition animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Responsive adjustments */
@media (min-width: 600px) {
    :root {
        --font-size-large: 18px;
        --font-size-xlarge: 28px;
    }
    
    .controls {
        flex-wrap: nowrap;
    }
    
    .card {
        margin-bottom: 40px;
    }
    
    #vocabulary-card {
        max-width: 650px;
        margin: 0 auto;
    }
    
    .hanzi-section h2 {
        font-size: 80px;
    }
    
    .welcome-box {
        padding: 50px 40px;
    }

    .quiz-options {
        grid-template-columns: 1fr 1fr;
    }
    
    .quiz-content {
        padding: 40px 30px;
    }
}

@media (max-width: 599px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .select-group {
        flex-direction: column;
    }
    
    .welcome-box {
        padding: 25px 15px;
    }
    
    .hanzi-section h2 {
        font-size: 50px;
    }
    
    .hanzi-section {
        padding: 25px 15px;
    }
    
    .details-section {
        padding: 15px 10px;
    }

    .quiz-options {
        grid-template-columns: 1fr 1fr; /* Maintain 2x2 grid on mobile */
        gap: 10px;
    }
    
    .quiz-option-btn {
        width: 100%;
        min-height: 55px;
        font-size: 0.95rem;
        padding: 8px 5px;
    }
    
    .quiz-navigation .btn {
        width: 100%;
    }
    
    .quiz-results {
        padding: 20px;
    }
    
    .quiz-question-text h3 {
        font-size: 1.2rem;
    }
    
    .feedback-message {
        padding: 10px;
        font-size: 0.9rem;
    }
} 

/* Dark Mode Support - Optional */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
    }
    
    .welcome-box, .card, .quiz-results, .quiz-card {
        background-color: #1e1e1e;
        color: #f0f0f0;
    }
    
    .quiz-option-btn {
        background-color: #2d2d2d;
        border-color: #444;
        color: #f0f0f0;
    }
    
    .quiz-option-btn:hover {
        background-color: #3a3a3a;
    }
    
    .secondary-btn {
        background-color: #333;
        color: #f0f0f0;
    }
    
    .secondary-btn:hover {
        background-color: #444;
    }
    
    .server-instructions {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    .server-instructions code {
        background-color: #333;
        color: #e0e0e0;
    }
    
    select {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    :root {
        --dark-text: #e0e0e0;
        --light-text: #aaa;
    }
} 

/* Review Card for Wrong Answers */
.review-card {
    max-width: 550px;
    width: 100%;
    margin: 20px auto 30px;
    animation: slideInFromBottom 0.5s ease-out;
    border: 2px solid var(--incorrect-color);
}

.review-card-header {
    background-color: rgba(244, 67, 54, 0.15);
    color: var(--incorrect-color);
    padding: 12px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    text-align: center;
    font-weight: bold;
}

.review-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.review-hanzi {
    text-align: center;
    margin-bottom: 10px;
}

.review-hanzi h2 {
    font-size: 48px;
    color: var(--dark-text);
}

.review-image-section {
    text-align: center;
    padding: 15px;
    background-color: #f8f9fa;
}

.review-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#review-pinyin {
    font-size: var(--font-size-large);
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.review-meanings {
    margin-bottom: 15px;
    text-align: center;
}

.review-meanings p {
    margin-bottom: 8px;
} 

/* Highlight incorrect answers in review card */
.highlight {
    color: #e74c3c !important;
    font-weight: bold;
    text-decoration: underline;
}

/* Two-part quiz styling - preserve existing properties */
.quiz-part {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 4px;
} 

/* Additional styling specifically for type field */
#word-type, #review-word-type {
    color: inherit !important;
    font-weight: normal !important;
    display: inline-block !important;
    margin-left: 5px !important;
} 