/* --- MODERN VARIABLES --- */
:root {
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary: #64748b;
    /* Slate 500 */
    --bg-body: #f3f4f6;
    /* Gray 100 */
    --bg-card: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --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: 0.75rem;
    /* 12px */
}

/* --- RESET & TYPOGRAPHY --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: #0f172a;
    /* Slate 900 */
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #1e293b;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.logo-text h2 {
    color: white;
    font-size: 1.1rem;
    margin: 0;
}

.logo-text span {
    font-size: 0.8rem;
    color: #94a3b8;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 1rem;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: #cbd5e1;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-menu li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-menu li.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}

.sidebar-footer {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px solid #1e293b;
}

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 2.5rem;
    min-height: 100vh;
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.content-header h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--secondary);
    margin: 0;
}

/* --- CARDS --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    font-weight: 600;
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- LAYOUT GRID --- */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-2-col-wide {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 1.5rem;
}

/* --- TYPOGRAPHY COMPONENTS --- */
.prose p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

.step-list {
    list-style: none;
    padding: 0;
}

.step-list li {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.step-num {
    background: var(--bg-body);
    color: var(--primary);
    font-weight: bold;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.formula-group {
    margin-bottom: 1rem;
}

.formula-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.math-block {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    text-align: center;
}

/* --- TABLES --- */
.table-container {
    width: 100%;
    overflow: hidden;
}

.scrollable-x {
    overflow-x: auto;
}

.scrollable-y {
    max-height: 400px;
    overflow-y: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.modern-table th {
    background: #f1f5f9;
    padding: 1rem;
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table input,
.modern-table select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.modern-table input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.small-text {
    font-size: 0.85rem;
}

.small-text td,
.small-text th {
    padding: 0.75rem;
    text-align: center;
}

/* --- BADGES & BUTTONS --- */
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-benefit {
    background: #dcfce7;
    color: #15803d;
}

.badge-cost {
    background: #fee2e2;
    color: #b91c1c;
}

.btn {
    cursor: pointer;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

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

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

.btn-danger-soft {
    background: #fef2f2;
    color: var(--danger);
}

.btn-danger-soft:hover {
    background: #fee2e2;
}

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

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

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.glow {
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
}

/* --- RESULTS SECTION --- */
.section-divider {
    display: flex;
    align-items: center;
    margin: 3rem 0 2rem;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.section-divider span {
    padding: 0 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.highlight-result {
    border-top: 4px solid var(--success);
}

.rank-1 {
    background: #f0fdf4;
}

.rank-1 td {
    font-weight: 700;
    color: #15803d;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        overflow: hidden;
    }

    .logo-text,
    .sidebar-menu span,
    .sidebar-footer {
        display: none;
    }

    .sidebar-menu li {
        justify-content: center;
        padding: 1rem;
    }

    .main-content {
        margin-left: 70px;
        width: calc(100% - 70px);
        padding: 1.5rem;
    }

    .grid-2-col,
    .grid-2-col-wide {
        grid-template-columns: 1fr;
    }
}