/* Calculator Pages Stylesheet */

/* Calculator Page Layout */
.calculator-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 100px 0 50px;
}

.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.calculator-header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 40px;
}

.calculator-header h1 {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.calculator-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator Card */
.calculator-card-main {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.calculator-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 30px;
    text-align: center;
}

/* Form Styling */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:invalid {
    border-color: #ef4444;
}

.form-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button Styling */
.btn-calculate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-calculate:active {
    transform: translateY(0);
}

.btn-clear {
    background: #6b7280;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    background: #4b5563;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 30px;
    text-align: center;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e5e7eb;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: #374151;
}

.result-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 1.125rem;
}

.result-value.highlight {
    color: #2563eb;
    font-size: 1.25rem;
}

.result-value.currency {
    color: #059669;
}

.result-value.percentage {
    color: #7c3aed;
}

/* Basic Calculator Specific */
.calculator-display {
    background: #1e293b;
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: right;
    font-family: 'Courier New', monospace;
    border: 3px solid #334155;
}

.display-main {
    font-size: 2rem;
    font-weight: 600;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    word-break: break-all;
}

.display-history {
    font-size: 0.875rem;
    color: #94a3b8;
    min-height: 20px;
    margin-bottom: 10px;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.calc-btn {
    aspect-ratio: 1;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-btn.number {
    background: #f1f5f9;
    color: #1e293b;
}

.calc-btn.number:hover {
    background: #e2e8f0;
}

.calc-btn.operator {
    background: #3b82f6;
    color: #fff;
}

.calc-btn.operator:hover {
    background: #2563eb;
}

.calc-btn.function {
    background: #8b5cf6;
    color: #fff;
    font-size: 0.875rem;
}

.calc-btn.function:hover {
    background: #7c3aed;
}

.calc-btn.equals {
    background: #059669;
    color: #fff;
}

.calc-btn.equals:hover {
    background: #047857;
}

.calc-btn.clear {
    background: #ef4444;
    color: #fff;
}

.calc-btn.clear:hover {
    background: #dc2626;
}

.calc-btn:active {
    transform: scale(0.95);
}

/* Scientific Calculator Extensions */
.scientific-panel {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.scientific-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.scientific-buttons .calc-btn {
    aspect-ratio: 2;
    font-size: 0.875rem;
}

/* BMI Results Specific */
.bmi-result-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #3b82f6;
}

.bmi-score {
    font-size: 3rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 10px;
}

.bmi-category {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    padding: 10px 20px;
    border-radius: 25px;
    margin-bottom: 20px;
}

.bmi-category.underweight {
    background: #dbeafe;
    color: #1d4ed8;
}

.bmi-category.normal {
    background: #d1fae5;
    color: #059669;
}

.bmi-category.overweight {
    background: #fed7aa;
    color: #ea580c;
}

.bmi-category.obese {
    background: #fecaca;
    color: #dc2626;
}

.recommendations {
    margin-top: 20px;
}

.recommendations h4 {
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
}

.recommendations ul {
    list-style: none;
    padding: 0;
}

.recommendations li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.recommendations li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #059669;
    font-weight: bold;
}

/* Loan Calculator Table */
.amortization-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.amortization-table th {
    background: #f1f5f9;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.amortization-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.amortization-table tr:hover {
    background: #f8fafc;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
}

/* Tip Calculator Split */
.tip-split-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.tip-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.tip-suggestion {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tip-suggestion:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.tip-suggestion.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.tip-percentage {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.tip-amount {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 5px;
}

/* History Section */
.history-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #3b82f6;
    transform: translateX(5px);
}

.history-calculation {
    font-family: 'Courier New', monospace;
    color: #6b7280;
    font-size: 0.875rem;
}

.history-result {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
    margin-top: 5px;
}

.history-timestamp {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 5px;
}

/* Error States */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.875rem;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.875rem;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 968px) {
    .calculator-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .calculator-buttons {
        gap: 8px;
    }
    
    .calc-btn {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .calculator-page {
        padding: 80px 0 30px;
    }
    
    .calculator-container {
        padding: 0 15px;
    }
    
    .calculator-card-main,
    .results-section {
        padding: 25px;
    }
    
    .calculator-header h1 {
        font-size: 2rem;
    }
    
    .calculator-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .scientific-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tip-suggestions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .amortization-table {
        font-size: 0.875rem;
    }
    
    .amortization-table th,
    .amortization-table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    .calculator-card-main,
    .results-section {
        padding: 20px;
    }
    
    .display-main {
        font-size: 1.5rem;
    }
    
    .calc-btn {
        font-size: 0.875rem;
    }
    
    .bmi-score {
        font-size: 2.5rem;
    }
    
    .tip-suggestions {
        grid-template-columns: 1fr;
    }
}