/* --- MODERN TECH THEME --- */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    /* Tech Blue - WCAG AA compliant */
    --accent-hover: #1d4ed8;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* --- NAVBAR --- */
.navbar {
    width: 100%;
    background-color: var(--card-bg);
    border-bottom: 1px solid #334155;
    padding: 15px 0;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 28px;
    width: auto;
    border-radius: 4px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--accent);
    background: rgba(37, 99, 235, 0.1);
}

.nav-link.active {
    color: var(--text-main);
    background: var(--accent);
}

.nav-link.active:hover {
    color: white;
}

/* --- CONTAINER --- */
.container {
    max-width: 600px;
    width: 90%;
    margin-top: 20px;
    /* Reduced top margin since navbar exists */
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .navbar {
        padding: 20px 0;
    }

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 5px 8px;
    }

    h1 {
        font-size: 2rem;
    }
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: -1px;
}

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

/* --- CALCULATOR CARD --- */
.calculator-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input[type="number"] {
    width: 100%;
    padding: 15px;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

button.calculate-btn {
    width: 100%;
    padding: 15px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

button.calculate-btn:hover {
    background-color: var(--accent-hover);
}

/* --- ADVANCED MODE TOGGLE --- */
.mode-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.advanced-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- ADVANCED SECTION --- */
.advanced-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out, margin-top 0.5s;
    opacity: 0;
    border-top: 1px solid #334155;
    margin-top: 0;
}

.advanced-section.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 25px;
    padding-top: 25px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.unit-select {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    background: #1e293b;
    color: white;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 0 5px;
    cursor: pointer;
}

.input-wrapper {
    position: relative;
}

.range-slider-container {
    margin-top: 10px;
}

input[type=range] {
    width: 100%;
    background: transparent;
    cursor: pointer;
}

/* --- RESULT SECTION --- */
.result-box {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: none;
}

.result-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent);
}

.result-label {
    color: var(--text-muted);
}

/* --- AFFILIATE / LINKS SECTION --- */
.affiliate-section {
    margin-top: 60px;
    text-align: center;
    padding-bottom: 50px;
    border-top: 1px solid #334155;
    padding-top: 40px;
}

.affiliate-title {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.product-link {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid #334155;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.product-link:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    color: white;
    background-color: #273548;
}

.footer {
    margin-top: auto;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
}