/* ===== Fraction Calculator Specific Styles ===== */
#fraction-calculator {
    /* Scope all fraction-specific styles under this root */
}

/* Calculator Hero Section */
.calculator-hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(247, 250, 252, 0.95) 100%);
    padding: var(--spacing-2xl) 0;
    border-bottom: 1px solid var(--border-light);
}

.calculator-hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.calculator-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-coral) 0%, #dc2626 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calculator-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Calculator Main Section */
.calculator-main {
    padding: var(--spacing-xl) 0;
    background: var(--background-gray);
}

.calculator-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2xl);
    max-width: 900px;
    margin: 0 auto;
}

.calculator-panel {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    width: 100%;
}

/* Calculator Tabs */
.calculator-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--border-light);
}

.calc-tab {
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.calc-tab:hover {
    color: var(--primary-coral);
}

.calc-tab.active {
    color: var(--primary-coral);
    border-bottom-color: var(--primary-coral);
}

/* Operation Selector */
.operation-selector {
    margin-bottom: var(--spacing-xl);
}

.operation-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.operation-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.op-btn {
    flex: 1;
    padding: var(--spacing-md);
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.op-btn:hover {
    border-color: var(--primary-coral);
    color: var(--primary-coral);
}

.op-btn.active {
    background: var(--primary-coral);
    border-color: var(--primary-coral);
    color: white;
}

/* Mode Sections */
.mode-section {
    display: none;
}

.mode-section.active {
    display: block;
}

/* Fractions Row */
.fractions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* Fraction Input */
.fraction-input {
    text-align: center;
}

.fraction-input label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.fraction-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--background-gray);
    border-radius: var(--border-radius);
}

.numerator,
.denominator {
    width: 80px;
    padding: var(--spacing-sm);
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    background: white;
}

.numerator:focus,
.denominator:focus {
    outline: none;
    border-color: var(--primary-coral);
}

.fraction-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

/* Mixed Number Input */
.mixed-input {
    text-align: center;
}

.mixed-input label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.mixed-display {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-md);
}

.whole-number {
    width: 60px;
    padding: var(--spacing-sm);
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    background: white;
}

.whole-number:focus {
    outline: none;
    border-color: var(--primary-coral);
}

/* Operation Symbol */
.operation-symbol {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-coral);
    padding: var(--spacing-md);
}

/* Options Row */
.options-row {
    display: flex;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-coral) 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

/* Results Panel */
.results-panel {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    width: 100%;
}

.result-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.result-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

/* Result Display */
.result-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: var(--background-gray);
    border-radius: var(--border-radius);
}

.result-fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.result-numerator,
.result-denominator {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--primary-coral);
}

.result-line {
    width: 100px;
    height: 3px;
    background: var(--primary-coral);
}

.result-equals {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.result-decimal {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--primary-coral);
}

/* Result Formats */
.result-formats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.format-item {
    padding: var(--spacing-md);
    background: var(--background-gray);
    border-radius: var(--border-radius);
    text-align: center;
}

.format-label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.format-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Solution Steps */
.solution-steps {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--background-gray);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-coral);
}

.solution-steps h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.step {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--border-radius);
}

.step-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: var(--primary-coral);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    margin-right: var(--spacing-sm);
}

.step-content {
    display: inline-block;
    color: var(--text-primary);
}

.step-math {
    display: block;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--background-gray);
    border-radius: var(--border-radius);
    font-family: var(--font-mono);
    font-size: 1.125rem;
    text-align: center;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: var(--spacing-md);
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-coral) 0%, #dc2626 100%);
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    border-color: var(--primary-coral);
    color: var(--primary-coral);
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-title {
        font-size: 2rem;
    }
    
    .fractions-row {
        flex-direction: column;
    }
    
    .operation-symbol {
        transform: rotate(90deg);
        margin: var(--spacing-md) 0;
    }
    
    .mixed-display {
        flex-direction: column;
    }
    
    .operation-buttons {
        flex-wrap: wrap;
    }
    
    .op-btn {
        min-width: calc(50% - var(--spacing-xs));
    }
    
    .result-display {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .options-row {
        flex-direction: column;
        gap: var(--spacing-md);
    }
}