:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
}

h1, h2, h3, .header-content h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.app-header h1 {
    font-size: 2.5rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Intro Card */
.intro-card {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

/* Tabs */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1px;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

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

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: #334155;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.2s;
}

input[type="number"], select {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    background-color: #fcfcfd;
    transition: all 0.2s ease;
    color: var(--text-main);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input:focus + i, select:focus + i {
    color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.formula-box {
    background-color: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    overflow-x: auto;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Result Card */
.result-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.intermediate-values {
    margin-bottom: 2rem;
}

.value-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.value-item span:first-child {
    color: var(--text-muted);
}

.value-item span:last-child {
    font-weight: 600;
    color: var(--text-main);
}

.final-result {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin-top: auto;
}

.final-result .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.final-result .value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
}

tfoot tr td {
    background-color: #f1f5f9;
    font-weight: 700;
}

.table-actions {
    margin-bottom: 2rem;
}

.main-actions {
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Utility */
.hidden {
    display: none !important;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.toast {
    background-color: #1e293b;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-top: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Footer */
.app-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.source-note {
    max-width: 800px;
    margin: 0 auto;
}
