/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    padding: 2rem 1rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

/* Unit Toggle Container */
.unit-toggle-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.unit-toggle-container label {
    font-weight: 600;
    color: white;
}
#unit-switch {
    background: #1f2937;
    color: white;
    border: 1px solid white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    appearance: none; /* Hide default dropdown arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7em top 50%, 0 0;
    background-size: 0.65em auto, 100%;
}

/* Navigation (Refactored for many calculators) */
.main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
    background: #1f2937; /* Dark background for the nav bar */
    margin: 1rem -1rem -1rem; /* Extend navigation edge-to-edge visually */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.2s ease, transform 0.1s ease;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    background: #f97316; /* Orange active button */
    border-color: #f97316;
    font-weight: 600;
}

/* Secondary Nav for static pages (kept for affiliate.html etc.) */
.secondary-nav {
    margin-top: 1rem;
    margin-bottom: 0;
    background: none;
}
.secondary-nav .nav-btn {
    font-size: 1rem;
}


/* Main Content & Container */
main {
    flex-grow: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.tool-intro {
    text-align: center;
    margin: 1rem 0 2rem;
    font-size: 1.1rem;
    color: #4b5563;
}

/* Calculator Box */
.calculator-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.calculator-box h2 {
    color: #dc2626;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.calculator-box h3 {
    margin-top: 1.5rem;
    color: #374151;
    font-size: 1.3rem;
    border-left: 4px solid #f97316;
    padding-left: 0.75rem;
    margin-bottom: 1rem;
}

.calculator-box .description {
    margin-bottom: 1.5rem;
    color: #6b7280;
}

/* Forms */
form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #1f2937;
    font-size: 0.95rem;
}

.input-group input[type="number"],
.input-group select {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.2s;
    width: 100%;
}

.input-group input[type="number"]:focus,
.input-group select:focus {
    border-color: #dc2626;
    outline: none;
}

.input-group small {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Buttons */
button[type="submit"] {
    grid-column: 1 / -1;
    background: #dc2626;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

button[type="submit"]:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

/* Results */
.result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
}

.result.hidden {
    display: none;
}

.result h3 {
    color: #dc2626;
    margin-bottom: 1rem;
}

/* Checklist Group Styling for Passive Tools */
.checklist-group label {
    font-weight: 400;
    color: #333;
}
.checklist-group select {
    margin-top: 0.5rem;
}
.result h4 {
    color: #374151;
    margin-top: 1rem;
}
.result ul {
    list-style-type: disc;
    margin-left: 1.5rem;
}

/* Affiliate/Support Banner */
.affiliate-banner {
    margin-top: 3rem;
    padding: 1rem;
    text-align: center;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
}
.affiliate-banner a {
    color: #dc2626;
    font-weight: 600;
    text-decoration: none;
}
.affiliate-banner a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background: #1f2937;
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

footer p {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}
