/* Multiplication App Specific Styles - Mobile First */

/* ===== MULTIPLICATION TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px 16px;
}

.multiplication-table {
    display: grid;
    grid-template-columns: repeat(14, minmax(32px, 1fr));
    gap: 2px;
    background: #e5e7eb;
    border-radius: 12px;
    padding: 2px;
    min-width: 480px;
}

.table-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    background: white;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 4px;
    user-select: none;
    min-height: 32px;
}

.table-cell:active {
    transform: scale(0.95);
}

/* Header cells */
.table-cell.header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 700;
    cursor: default;
}

.table-cell.header:active {
    transform: none;
}

.table-cell.corner {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    font-size: 1rem;
}

/* Mastery colors */
.table-cell.mastered {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.table-cell.learning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.table-cell.not-practiced {
    background: white;
    color: #374151;
}

.table-cell.selected {
    box-shadow: 0 0 0 3px #6366f1;
    transform: scale(1.1);
    z-index: 10;
}

/* ===== EQUATION DISPLAY ===== */
.equation-display {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e8ff 100%);
    border-radius: 16px;
    margin: 16px 0;
    color: #4338ca;
}

.equation-display .result {
    color: #22c55e;
}

/* ===== FILTER SECTION ===== */
.filter-section {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.filter-section h4 {
    margin-bottom: 12px;
    color: #374151;
    font-size: 0.9375rem;
    text-align: center;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.filter-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    background: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:active {
    transform: scale(0.95);
}

.filter-btn.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* ===== QUIZ MODE ===== */
.quiz-container {
    text-align: center;
    padding: 20px 0;
}

.quiz-problem {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quiz-problem .operator {
    color: #6366f1;
}

.quiz-problem .equals {
    color: #9ca3af;
}

.answer-section {
    margin: 24px 0;
}

.quiz-input {
    width: 120px;
    padding: 16px;
    font-size: 2rem;
    border: 4px solid #e5e7eb;
    border-radius: 16px;
}

.quiz-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.quiz-input.correct {
    border-color: #22c55e;
    background: #dcfce7;
}

.quiz-input.incorrect {
    border-color: #ef4444;
    background: #fee2e2;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ===== MULTIPLE CHOICE OPTIONS ===== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.option-btn {
    min-height: 60px;
    padding: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:active {
    transform: scale(0.95);
}

.option-btn.correct {
    border-color: #22c55e;
    background: #dcfce7;
    color: #166534;
}

.option-btn.incorrect {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

/* ===== SPEED CHALLENGE ===== */
.speed-container {
    text-align: center;
}

.speed-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.speed-stat {
    background: #f3f4f6;
    padding: 12px 20px;
    border-radius: 12px;
    min-width: 80px;
}

.speed-stat .label {
    font-size: 0.75rem;
    color: #6b7280;
    display: block;
}

.speed-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
}

.speed-stat.time .value {
    color: #f59e0b;
}

.start-btn {
    min-height: 56px;
    padding: 16px 40px;
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.start-btn:active {
    transform: scale(0.95);
}

/* ===== RESULTS SUMMARY ===== */
.results-summary {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-top: 24px;
}

.results-summary h2 {
    color: #166534;
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.result-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
}

.result-item .label {
    font-size: 0.75rem;
    color: #6b7280;
}

.result-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #166534;
}

/* ===== TABLET+ STYLES ===== */
@media (min-width: 481px) {
    .table-wrapper {
        margin: 0;
        padding: 0;
    }

    .multiplication-table {
        grid-template-columns: repeat(14, minmax(38px, 1fr));
        min-width: auto;
    }

    .table-cell {
        font-size: 0.875rem;
        min-height: 38px;
    }

    .table-cell:hover {
        transform: scale(1.1);
        z-index: 10;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .quiz-problem {
        font-size: 3rem;
    }

    .options-grid {
        max-width: 400px;
        gap: 16px;
    }

    .option-btn {
        min-height: 70px;
        font-size: 1.5rem;
    }

    .equation-display {
        font-size: 2rem;
    }
}

/* ===== DESKTOP STYLES ===== */
@media (min-width: 769px) {
    .multiplication-table {
        grid-template-columns: repeat(14, minmax(45px, 1fr));
    }

    .table-cell {
        font-size: 1rem;
        min-height: 45px;
    }

    .quiz-problem {
        font-size: 3.5rem;
    }

    .equation-display {
        font-size: 2.5rem;
        padding: 30px;
    }
}

/* ===== SMALL SCREENS ===== */
@media (max-width: 380px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .speed-header {
        flex-direction: column;
        gap: 10px;
    }
}
