/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-dark: #2563eb;
    /* Blue 600 */
    --primary-light: #60a5fa;
    /* Blue 400 */

    --secondary: #64748b;
    /* Slate 500 */
    --secondary-light: #94a3b8;
    /* Slate 400 */

    --success: #10b981;
    /* Emerald 500 */
    --error: #ef4444;
    /* Red 500 */

    --bg-body: #f1f5f9;
    /* Slate 100 */
    --bg-card: #ffffff;
    --bg-input: #f8fafc;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #475569;
    /* Slate 600 */

    --border: #e2e8f0;
    /* Slate 200 */
    --radius: 0.75rem;
    --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);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.25;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

main.container {
    flex: 1;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

/* Header & Nav */
.main-nav {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Calculator Card */
.calculator-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.calculator-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.input-group {
    margin-bottom: 2rem;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-input);
    transition: all 0.2s ease;
    color: var(--text-main);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Helper Buttons inside input rows */
.input-helper-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 0.875rem;
}

/* Main Action Button */
.calc-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    width: 100%;
    transition: filter 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.calc-btn:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}

.calc-btn:active {
    transform: translateY(1px);
}

/* Results Section */
.result-box {
    margin-top: 2.5rem;
    padding: 2rem;
    background: linear-gradient(to right, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    display: none;
    /* Hidden by default */
    position: relative;
    overflow: hidden;
}

.result-box.visible {
    display: block;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-box h2 {
    color: #0369a1;
    font-size: 1.5rem;
    margin-top: 0;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0284c7;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0.5rem;
    text-align: center;
}

.steps-box {
    margin-top: 2rem;
    border-top: 1px solid #bfdbfe;
    padding-top: 1.5rem;
}

/* Formula Box */
.formula-box {
    background: #fff;
    padding: 1.25rem;
    border-left: 5px solid var(--primary);
    border-radius: 0 0.5rem 0.5rem 0;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    color: #334155;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

/* Content Sections */
.content-section {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius);
    margin-top: 3rem;
    border: 1px solid var(--border);
}

/* Footer */
.site-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.75rem;
}

.footer-section a {
    color: #94a3b8;
    font-weight: 400;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .nav-links {
        display: none;
    }

    /* Add mobile menu logic later if needed */
    .input-row {
        grid-template-columns: 1fr;
    }

    .main-nav .container {
        flex-direction: column;
        gap: 1rem;
    }
}