/* =================================================================
   PICTURE MATCH MODULE STYLES
   Version 3.1 - November 2025
   ================================================================= */

.module-match {
    animation: fadeIn 0.3s ease;
}

.mode-buttons {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
}

.mode-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: var(--gray-100);
}

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

.review-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.review-settings label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.review-settings input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
}

.progress-section {
    margin: 20px 0;
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.matching-container {
    display: flex;
    gap: 24px;
    position: relative;
    min-height: 400px;
    margin: 24px 0;
}

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

.item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.item.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.item img,
.item video {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.item .word {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Picture-only mode (single large picture) - Match module specific */
.module-match .matching-container-sound {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    min-height: 400px;
    margin: 24px 0;
    align-items: center;
}

.module-match .pictures-row {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.module-match .pictures-row .item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    position: relative;
}

.module-match .pictures-row .item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.module-match .pictures-row .item .word {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.module-match .pictures-row .item .dot {
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    transition: all 0.2s;
}

.module-match .pictures-row .item .dot.selected {
    background: var(--primary);
    border-color: var(--primary);
}

.module-match .pictures-row .item .dot.matched {
    background: var(--success);
    border-color: var(--success);
}

.module-match .audio-section {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.module-match .picture-only {
    cursor: default;
    width: 100%;
    max-width: 400px;
    height: 400px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.module-match .picture-only img,
.module-match .picture-only video {
    border-radius: 8px;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 120px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.feedback.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.feedback.correct {
    color: var(--success);
}

.feedback.incorrect {
    color: var(--error);
}

.review-container {
    display: none;
}

.review-header {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.score-display {
    text-align: center;
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.score-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.review-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.review-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.review-word {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.selected-word {
    font-size: 14px;
    color: var(--text-secondary);
}

.match-mark {
    font-size: 18px;
    margin-left: 8px;
}

.match-mark.correct {
    color: var(--success);
}

.match-mark.incorrect {
    color: var(--error);
}

/* =================================================================
   MOBILE RESPONSIVE
   ================================================================= */

body.mobile-phone .matching-container {
    flex-direction: column;
    gap: 16px;
    min-height: auto;
}

body.mobile-phone .column {
    width: 100%;
}

body.mobile-phone .item {
    min-height: 60px;
    padding: 12px;
}

body.mobile-phone .item img,
body.mobile-phone .item video {
    max-height: 80px;
}

body.mobile-phone .item .word {
    font-size: 16px;
}

body.mobile-phone .controls {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

body.mobile-phone .mode-buttons {
    width: 100%;
}

body.mobile-phone .mode-btn {
    flex: 1;
    font-size: 14px;
    padding: 12px;
}

body.mobile-phone .review-settings {
    width: 100%;
    justify-content: center;
    padding: 10px;
}

body.mobile-phone .review-settings label {
    font-size: 13px;
}

body.mobile-phone .review-settings input[type="number"] {
    width: 50px;
    font-size: 13px;
}

body.mobile-phone .progress-section {
    font-size: 14px;
}

body.mobile-phone .review-grid,
body.mobile-tablet .review-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

body.mobile-phone .review-item {
    padding: 12px;
}

body.mobile-phone .score-value {
    font-size: 36px;
}

body.mobile-phone .module-match .picture-only {
    max-width: 280px;
    height: 280px;
}

body.mobile-phone .module-match .audio-section {
    max-width: 280px;
}

@media (max-width: 768px) {
    .module-match .picture-only {
        max-width: 300px;
        height: 300px;
    }

    .module-match .audio-section {
        max-width: 300px;
    }

    .matching-container {
        flex-direction: column;
    }
    
    .review-grid {
        grid-template-columns: 1fr;
    }
}
