/* Subtraction Practice - SIMPLIFIED CSS */
.subtraction-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dual-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

@media (max-width: 768px) {
    .dual-container {
        grid-template-columns: 1fr;
    }
}

/* Main Grid - SIMPLIFIED */
.main-problem-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.problem-grid {
    display: grid;
    grid-template-columns: 40px repeat(3, 80px);
    grid-template-rows: repeat(4, 80px);
    gap: 4px;
    margin: 20px auto;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    position: relative;
    background: white;
}

/* Specific cell types */
.empty-cell {
    background: transparent;
    border: none;
}

.borrow-cell {
    background-color: #fff8e1;
    border-color: #ffd54f;
}

.borrow-indicator {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff5252;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.minuend-cell {
    background-color: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.minus-cell {
    font-size: 3rem;
    color: #f44336;
    font-weight: bold;
    border: none;
}

.subtrahend-cell {
    background-color: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.line-cell {
    border-bottom: 4px solid #333;
}

.answer-cell {
    background-color: #f5f5f5;
    border-color: #666;
    color: #333;
    font-size: 2.5rem;
}

.answer-cell.correct {
    background-color: #c8e6c9;
    border-color: #4caf50;
    color: #2e7d32;
}

.answer-cell.incorrect {
    background-color: #ffcdd2;
    border-color: #f44336;
    color: #c62828;
}

.active-column {
    box-shadow: 0 0 0 4px #ff9800;
    z-index: 10;
}

/* Original and current digits for borrowed numbers */
.original-digit {
    font-size: 1.8rem;
    color: #999;
    text-decoration: line-through;
    margin-right: 10px;
}

.current-digit {
    font-size: 2.5rem;
    color: #ff9800;
    font-weight: bold;
}

/* Sub-problem area */
.sub-problem-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.decision-stage {
    display: none;
}

.decision-stage.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Stage 1 styles */
.current-column-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    font-size: 2.5rem;
}

.top-digit, .bottom-digit {
    padding: 20px 30px;
    border-radius: 10px;
    min-width: 100px;
    text-align: center;
    font-weight: bold;
}

.top-digit {
    background: #e8f5e9;
    border: 3px solid #4caf50;
    color: #2e7d32;
}

.bottom-digit {
    background: #e3f2fd;
    border: 3px solid #2196f3;
    color: #1565c0;
}

.operator {
    font-size: 3rem;
    color: #f44336;
    font-weight: bold;
}

.comparison-hint {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 15px 0;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.comparison-hint.needs-borrow {
    color: #d32f2f;
    background-color: #ffebee;
    border: 2px solid #f44336;
}

.comparison-hint.no-borrow {
    color: #2e7d32;
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
}

/* Yes/No buttons */
.yes-no-buttons {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    justify-content: center;
}

.btn-decision {
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.btn-yes {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-yes:hover {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.btn-no {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}

.btn-no:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
}

/* Stage 4 computation area */
.subtraction-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 3rem;
    margin: 30px 0;
}

.equals-line {
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
    color: #666;
}

.answer-placeholder {
    font-size: 3rem;
    text-align: center;
    color: #666;
    min-height: 80px;
    border-bottom: 4px solid #ccc;
    margin: 0 auto;
    width: 120px;
}

/* Number controls */
.number-display {
    background: #f5f5f5;
    border: 3px solid #2196f3;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    font-size: 3.5rem;
    font-weight: bold;
    color: #1565c0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.number-btn {
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #e0e0e0;
    color: #333;
}

.number-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.number-btn.increment {
    background: #4caf50;
    color: white;
}

.number-btn.decrement {
    background: #f44336;
    color: white;
}

.number-btn.clear {
    background: #ff9800;
    color: white;
}

/* Submit button */
.combined-action-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.combined-action-btn:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

/* Feedback */
.sub-feedback {
    margin: 20px 0;
    padding: 20px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.sub-feedback.correct {
    color: #2e7d32;
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
}

.sub-feedback.incorrect {
    color: #c62828;
    background-color: #ffebee;
    border: 2px solid #f44336;
}

/* Controls */
.simple-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.simple-controls button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#newProblem {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
}

#newProblem:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%);
    transform: translateY(-2px);
}

.context-column.can-borrow {
    background-color: #e8f5e8;
    border-left: 3px solid #4caf50;
}

.context-column.cannot-borrow {
    background-color: #ffebee;
    border-left: 3px solid #f44336;
}

.source-option {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    text-align: left;
    background: #e8f5e8;
    border: 2px solid #4caf50;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.source-option:hover {
    background: #c8e6c9;
    transform: translateY(-2px);
}

.source-option strong {
    color: #2e7d32;
}

.source-option small {
    color: #666;
    font-style: italic;
}

.no-sources {
    padding: 15px;
    background: #fff3e0;
    border: 2px dashed #ff9800;
    border-radius: 6px;
    text-align: center;
}

/* Score Display - SIMPLIFIED */
.enhanced-score-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.stat {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e0e0e0;
}

.stat.correct {
    border-color: #4caf50;
}

.stat.incorrect {
    border-color: #f44336;
}

.stat.total {
    border-color: #2196f3;
}

.stat.accuracy {
    border-color: #ff9800;
}

.stat-label {
    display: block;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
}

.stat.correct .stat-value {
    color: #4caf50;
}

.stat.incorrect .stat-value {
    color: #f44336;
}

.stat.total .stat-value {
    color: #2196f3;
}

.stat.accuracy .stat-value {
    color: #ff9800;
}

/* Reset Button */
#resetScores {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

#resetScores:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1024px) {
    .problem-grid {
        grid-template-columns: 30px repeat(3, 70px);
        grid-template-rows: repeat(5, 70px);
    }
    
    .grid-cell {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .problem-grid {
        grid-template-columns: 25px repeat(3, 60px);
        grid-template-rows: repeat(5, 60px);
    }
    
    .grid-cell {
        font-size: 1.8rem;
    }
    
    .score-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .current-column-display {
        font-size: 2rem;
    }
    
    .top-digit, .bottom-digit {
        padding: 15px 25px;
        min-width: 80px;
    }
    
    .btn-decision {
        padding: 15px 30px;
        font-size: 1.1rem;
        min-width: 120px;
    }
}

/* Add this to your subtraction.css file or at the end of your main CSS */

/* Remove the bottom border from all line cells in the problem grid */
#problemGrid .grid-cell.line-cell {
    border: none !important;
    position: relative;
    height: 40px; /* Ensure the cell has enough height */
}

/* Create a centered horizontal line using a pseudo-element */
#problemGrid .grid-cell.line-cell::after {
    content: '';
    position: absolute;
    top: 50%; /* Center vertically */
    left: -1px; /* Slight padding from left edge */
    right: -3px; /* Slight padding from right edge */
    height: 3px;
    background-color: rgb(51, 51, 51);
    transform: translateY(-50%);
}

/* For the standalone line cell that's outside the grid (if any) */
.grid-cell.line-cell:not(#problemGrid .grid-cell.line-cell) {
    border-bottom: none !important;
    position: relative;
    height: 40px;
}

.grid-cell.line-cell:not(#problemGrid .grid-cell.line-cell)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 5px;
    right: 5px;
    height: 3px;
    background-color: rgb(51, 51, 51);
    transform: translateY(-50%);
}
