:root {
    --accent-primary-start: #00e6b8;
    --accent-primary-end: #086272;
    --accent-glow: rgba(0, 230, 184, 0.2);
    --sidebar-bg: #0c0c0d;
    --content-bg: #f0f4f8;
    --text-dark: #1a202c;
    --text-light-on-dark: #f0f0f0;
    --text-medium: #4a5568;
    --text-light: #718096;
    --border-color: #dee2e6;
    --white: #fff;
    --error-red: #e53e3e;
    --footer-bg: #0c0c0d; /* Changed to match sidebar */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-dark);
    display: flex;
}

/* --- SIDEBAR NAVIGATION (Desktop) --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    color: var(--text-light-on-dark);
    height: 100vh;
    overflow-y: auto;
    position: sticky; /* Sticky sidebar */
    top: 0;
    flex-shrink: 0;
    transition: width 0.3s ease;
}
.sidebar-header { text-align: center; margin-bottom: 2.5rem; }
.sidebar-header .logo { font-family: 'Lora', serif; font-size: 2rem; font-weight: 700; text-decoration: none; color: var(--white); }
.nav-menu { list-style: none; }
.nav-menu li a {
    display: flex; align-items: center; padding: 0.9rem 1.2rem; color: var(--text-light); text-decoration: none;
    border-radius: 0.5rem; margin-bottom: 0.5rem; font-weight: 500; transition: background-color 0.2s ease, color 0.2s ease; white-space: nowrap;
}
.nav-menu li a .icon { font-size: 1.25rem; margin-right: 1rem; width: 30px; text-align: center; }
.nav-menu li a:hover { background-color: rgba(255, 255, 255, 0.1); color: var(--white); }
.nav-menu li a.active {
    background: linear-gradient(90deg, var(--accent-primary-start), var(--accent-primary-end));
    color: var(--sidebar-bg); font-weight: 600; box-shadow: 0 8px 20px -8px rgba(0, 230, 184, 0.5);
}

/* --- MOBILE TOP NAVIGATION --- */
.mobile-top-bar { display: none; }

/* --- MAIN CONTENT AREA --- */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures footer is at bottom */
}
.content-area {
    flex-grow: 1; /* Pushes footer down */
    padding: 2rem 3rem;
}
.calculator-page { display: none; }
.calculator-page.active { display: block; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page-header { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.page-title { font-family: 'Lora', serif; font-size: 2.8rem; }
.gradient-text {
    background: linear-gradient(90deg, var(--accent-primary-start), var(--accent-primary-end));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.settings-switches { display: flex; gap: 1rem; }
.settings-switches select { padding: 0.5rem 1rem; border-radius: 20px; border: 1px solid var(--border-color); background-color: white; font-weight: 500; cursor: pointer; }

/* --- NEW CALCULATOR LAYOUT --- */
.calculator-container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 2.5rem;
    background: var(--white);
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.07);
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}
.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-content: start;
}
.form-group { margin-bottom: 0; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.form-group input, .form-group select {
    width: 100%; padding: 0.8rem 1rem; font-size: 1rem; border-radius: 0.5rem;
    border: 1px solid var(--border-color); background-color: #fcfcfd;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--accent-primary-start); box-shadow: 0 0 0 3px var(--accent-glow);
}
.calculate-button {
    grid-column: 1 / -1;
    display: inline-flex; justify-content: center; width: 100%;
    background: linear-gradient(135deg, var(--accent-primary-start), var(--accent-primary-end));
    color: white; font-weight: 600; font-size: 1rem; padding: 1rem 2rem; border-radius: 50px;
    text-decoration: none; box-shadow: 0 8px 25px -8px rgba(0, 230, 184, 0.5);
    transition: all 0.3s ease; border: none; cursor: pointer; margin-top: 1rem;
}
.calculate-button:hover {
    transform: translateY(-4px) scale(1.02); box-shadow: 0 12px 30px -8px rgba(0, 230, 184, 0.7);
}

.results-section {
    position: sticky; top: 2rem; padding: 2rem; background-color: #f8f9fa;
    border-radius: 1rem; text-align: center; border: 1px solid #e9ecef;
    visibility: hidden; opacity: 0; transition: opacity 0.4s, visibility 0.4s;
}
.results-section.active { visibility: visible; opacity: 1; }
.results-section h3 { font-family: 'Lora', serif; margin-bottom: 1.5rem; color: var(--text-dark); }
.results-section .result-item {
    display: flex; justify-content: space-between; align-items: center; text-align: left;
    margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color);
}
.results-section .result-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.results-section .result-item span { color: var(--text-medium); font-weight: 500; }
.results-section .highlight { font-size: 1.8rem; font-weight: 700; color: var(--accent-primary-end); text-align: right; }

.single-column-layout { grid-template-columns: 1fr; }
.single-column-layout .input-section { grid-template-columns: 1fr; }

.standard-calculator { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.standard-calculator input {
    grid-column: 1 / -1; padding: 1.2rem; font-size: 2.5rem; text-align: right; border: none;
    border-radius: 0.75rem; margin-bottom: 0.5rem; background-color: #e9ecef; color: var(--text-dark);
}
.standard-calculator button {
    padding: 1.2rem; font-size: 1.3rem; border-radius: 0.75rem; border: none; cursor: pointer;
    background-color: var(--white); box-shadow: 0 4px 10px rgba(0,0,0,0.05); transition: all 0.2s ease;
}
.standard-calculator button:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
.standard-calculator .op-btn { background-color: #ffc107; color: var(--white); font-weight: bold; }
.standard-calculator .eq-btn { grid-column: 3 / 5; background-color: #28a745; color: var(--white); font-weight: bold; }

.timer-display { font-size: 4rem; font-weight: 700; text-align: center; font-family: 'Lora', serif; color: var(--text-dark); margin-bottom: 1.5rem; }
.timer-controls { display: flex; justify-content: center; gap: 1rem; }
.timer-controls .calculate-button { width: auto; min-width: 120px; grid-column: auto; }

.toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); background-color: var(--text-dark);
    color: var(--white); padding: 0.8rem 1.5rem; border-radius: 50px; z-index: 2000; opacity: 0;
    visibility: hidden; transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, -10px); }

.footer {
    background-color: var(--footer-bg); color: var(--text-light-on-dark);
    padding: 3rem 2rem 1.5rem; text-align: center;
}
.footer-container {
    max-width: 1200px; margin: 0 auto; display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; text-align: left;
}
.footer-column h4 { font-family: 'Lora', serif; font-size: 1.2rem; margin-bottom: 1rem; color: var(--white); }
.footer-column p, .footer-column a { color: var(--text-light); text-decoration: none; line-height: 1.8; font-size: 0.95rem; }
.footer-column a:hover { color: var(--accent-primary-start); text-decoration: underline; }
.footer-column ul { list-style: none; }
.footer-column ul li { margin-bottom: 0.5rem; }
.social-icons { display: flex; gap: 1rem; margin-top: 1rem; }
.social-icons a { font-size: 1.5rem; color: var(--text-light); transition: color 0.2s; }
.social-icons a:hover { color: var(--accent-primary-start); }
.footer-bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid #3e4c5a; font-size: 0.9rem; color: var(--text-light); }

/* --- STATIC PAGE STYLES (About, Contact, etc.) --- */
.static-page-container {
    max-width: 900px;
    margin: 1rem auto;
    padding: 2.5rem;
    background: var(--white);
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.07);
}
.static-page-container h1 {
    font-family: 'Lora', serif;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}
.static-page-container h2 {
    font-family: 'Lora', serif;
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}
.static-page-container p, .static-page-container li {
    line-height: 1.8;
    color: var(--text-medium);
    margin-bottom: 1rem;
}
.static-page-container ul {
    list-style-position: inside;
    padding-left: 1rem;
}
.static-page-container a {
    color: var(--accent-primary-end);
    text-decoration: none;
    font-weight: 600;
}
.static-page-container a:hover {
    text-decoration: underline;
}
.contact-form {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}
.contact-form .form-group {
    grid-column: 1 / -1;
}
.contact-form .form-group.half-width {
    grid-column: span 1;
}
@media(min-width: 768px) {
    .contact-form {
        grid-template-columns: 1fr 1fr;
    }
}


/* --- RESPONSIVENESS --- */
@media (max-width: 992px) {
    body { flex-direction: column; }
    .sidebar { display: none; }
    .content-area { padding: 1.5rem 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .page-title { font-size: 2.2rem; }
    .mobile-top-bar {
        display: block;
        position: sticky; /* Sticky top bar on mobile */
        top: 0;
        width: 100%;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
        padding: 0.75rem 0;
        height: 60px;
        flex-shrink: 0;
    }
    .mobile-top-bar .top-nav-scroll { overflow-x: auto; white-space: nowrap; -ms-overflow-style: none; scrollbar-width: none; }
    .mobile-top-bar .top-nav-scroll::-webkit-scrollbar { display: none; }
    .mobile-top-bar .nav-menu { display: flex; padding: 0 1rem; }
    .mobile-top-bar .nav-menu li a { padding: 0.6rem 1rem; border-radius: 20px; margin: 0 0.2rem; }
    .mobile-top-bar .nav-menu li a .icon { margin-right: 0.5rem; }
    .mobile-top-bar .nav-menu li a .nav-text { font-size: 0.9rem; font-weight: 600; }
    .mobile-top-bar .nav-menu li a.active { box-shadow: none; color: white; }
    .calculator-container { grid-template-columns: 1fr; gap: 2rem; padding: 1.5rem; }
    .results-section { position: static; top: auto; }
    .footer { padding: 2rem 1rem; }
    .footer-container { grid-template-columns: 1fr; text-align: center; }
    .footer-column { align-items: center; text-align: center; }
    .social-icons { justify-content: center; }
}