* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.problem {
    text-align: center;
    font-size: 2em;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.models-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.model-section {
    padding: 20px;
    background-color: white;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h2 {
    color: #444;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Ratio Table Styles */
.ratio-table {
    display: table;
    margin: 0 auto;
    border-collapse: collapse;
    border: 3px solid #3498db;
}

.ratio-row {
    display: table-row;
}

.ratio-cell {
    display: table-cell;
    padding: 10px 20px;
    text-align: center;
    min-width: 80px;
    border: 2px solid #2980b9;
    vertical-align: middle;
}

.ratio-row:last-child .ratio-cell {
    border-bottom: none;
}

.ratio-cell:last-child {
    border-right: none;
}

.ratio-input {
    width: 40px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
}

/* Open Area Model Styles */
.area-model {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    min-height: 120px;
    position: relative;
    padding: 10px;
}

.area-divisor {
    padding: 10px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.area-rectangles {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-grow: 1;
    align-items: stretch;
    padding: 25px 0 10px;
}

.rectangle {
    position: relative;
    border: 2px solid #16a085;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    min-width: 100px;
}

.rectangle.sized {
    flex-grow: 0;
}

.area-multiplier {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    background-color: white;
    padding: 0 5px;
}

.area-input {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    text-align: center;
    background-color: white;
    border: 1px solid #ddd;
    padding: 2px;
}

.area-result {
    font-size: 1.2em;
}

/* Partial Quotients Styles */
.partial-quotients {
    margin: 20px;
    display: flex;
    justify-content: center;
}

.pq-table {
    border-collapse: collapse;
    font-family: monospace;
    font-size: 1.4em;
    margin-left: 40px;
}

.pq-table td {
    width: 30px;
    height: 35px;
    text-align: right;
    vertical-align: bottom;
    position: relative;
    padding: 5px;
}

/* First row styling for dividend */
.dividend-row td:nth-child(3),
.dividend-row td:nth-child(4),
.dividend-row td:nth-child(5) {
    border-top: 2px solid #333;
}

.dividend-row td:nth-child(3) {
    border-left: 2px solid #333;
}

/* Subtraction styling */
.subtraction-row td {
    color: #d32f2f;  /* Red color for subtraction */
}

.subtraction-row td:nth-child(3),
.subtraction-row td:nth-child(4),
.subtraction-row td:nth-child(5) {
    position: relative;
}

.subtraction-row td:nth-child(3)::before {
    content: '-';
    position: absolute;
    left: -15px;
    color: #d32f2f;
}

.subtraction-row:not(:last-child) td:nth-child(3),
.subtraction-row:not(:last-child) td:nth-child(4),
.subtraction-row:not(:last-child) td:nth-child(5) {
    border-bottom: 1px solid #333;
}

/* Quotient styling */
.quotient-cell {
    color: #2196F3;
    font-weight: bold;
    padding-left: 15px !important;
}

/* Input styling */
.pq-input {
    width: 30px;
    text-align: center;
    font-family: monospace;
    font-size: 1em;
    padding: 2px;
    border: 1px solid #2196F3;
    border-radius: 2px;
    background-color: #fff;
}

/* Completion message styling */
.completion-message {
    margin-top: 20px;
    padding: 15px;
    background-color: #e8f5e9;
    border-radius: 5px;
    text-align: center;
}

.completion-message h3 {
    color: #2e7d32;
    margin-bottom: 10px;
}

.completion-message p {
    color: #1b5e20;
}

input[type="number"] {
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Hide number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.pq-quotients-stack {
    position: absolute;
    top: -25px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

/* Add checkbox styling */
.problem-controls {
    text-align: center;
    margin: 20px 0;
}

.problem-controls label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.problem-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* New Problem button styling */
.new-problem-btn {
    display: inline-block;
    margin-left: 20px;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.new-problem-btn:hover {
    background-color: #45a049;
}

/* Check Remainder button styling */
.check-remainder-btn {
    display: inline-block;
    padding: 5px 10px;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
}

.check-remainder-btn:hover {
    background-color: #f57c00;
}

/* Hide the check remainder buttons initially */
.check-remainder-btn {
    display: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.completion-message {
    text-align: center;
}

.completion-message h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.completion-message p {
    color: #1b5e20;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.modal-close:hover {
    color: #333;
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.modal-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.new-problem-modal-btn {
    background-color: #4CAF50;
    color: white;
}

.new-problem-modal-btn:hover {
    background-color: #45a049;
}

.continue-btn {
    background-color: #2196F3;
    color: white;
}

.continue-btn:hover {
    background-color: #1976D2;
}

/* Model Section Header Styles */
.model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
}

.model-header h2 {
    margin: 0;
}

.collapse-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #666;
    cursor: pointer;
    padding: 0 10px;
    transition: transform 0.3s ease;
}

.collapse-btn:hover {
    color: #333;
}

.collapse-btn.collapsed {
    transform: rotate(-90deg);
}

/* Model Content Styles */
.model-content {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

.model-content.collapsed {
    max-height: 0;
} 