:root {
    --primary: #2C3E50;
    --accent: #D35400;
    /* Leather rust/orange */
    --accent-hover: #E67E22;
    --bg-page: #F8F9FA;
    --bg-card: #FFFFFF;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --border: #E0E0E0;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.top-bar {
    background: #000;
    color: #fff;
    padding: 8px 0;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

.top-bar .back-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 25px 0;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.brand-link {
    text-decoration: none;
    color: #000;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.1rem;
    display: block;
}

.tool-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

@media (min-width: 600px) {
    .header-flex {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }

    .header-divider {
        height: 20px;
        width: 1px;
        background: #ccc;
        display: block;
    }

    .brand-link {
        margin-bottom: 0;
    }
}

/* Tool Navigation */
.tool-nav {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (min-width: 600px) {
    .tool-nav {
        margin-top: 0;
    }
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}

.nav-link.active {
    color: #fff;
    background: var(--primary);
}

.tool-view {
    animation: fadeIn 0.3s ease-out;
}

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

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

/* Intro */
.intro-text {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-muted);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Calculator Card */
.calculator-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 40px;
}

/* Mode Toggles */
.mode-toggles {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.mode-btn {
    flex: 1;
    background: #f1f1f1;
    border: none;
    padding: 15px;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: #e9ecef;
}

.mode-btn.active {
    background: #fff;
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
}

.calculator-body {
    padding: 25px;
}

/* Inputs */
.input-panel {
    display: none;
}

.input-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

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

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-wrapper {
    display: flex;
}

.input-wrapper input {
    flex: 1;
    border: 1px solid var(--border);
    border-right: none;
    padding: 12px;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

.input-wrapper select {
    background: #eee;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-main);
}

/* Regular inputs and selects outside wrapper wrapper */
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

/* Fix for input wrapper layout conflict */
.input-wrapper input[type="number"] {
    width: 0;
    /* Let flex handle width explicitly */
    min-width: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}

.input-wrapper select {
    width: auto;
    /* Override the 100% width from above */
    flex: 0 0 auto;
    /* Prevent growing/shrinking */
    min-width: 80px;
    border-radius: 0 var(--radius) var(--radius) 0;
    background-color: #eee;
}

/* Details row (2 cols) */
.details-row {
    display: flex;
    gap: 20px;
}

.half-group {
    flex: 1;
}

/* Complexity Switch */
.complexity-toggle {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid #eee;
}

.switch-label {
    font-weight: 600;
    margin-bottom: 0 !important;
}

.toggle-group {
    display: flex;
    gap: 15px;
}

.toggle-group input[type="radio"] {
    margin-right: 5px;
}

/* Advanced section hidden by default in JS logic if implemented, but we rely on simple/advanced logic in JS. 
We'll show all or hide via JS. For now let's style them. */
.advanced-inputs {
    padding: 15px;
    background: #fcfcfc;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group input {
    width: auto;
}

.checkbox-group label {
    margin-bottom: 0;
}

/* Tooltip (Custom CSS to avoid native delay) */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    color: #fff;
    font-size: 10px;
    margin-left: 5px;
    cursor: help;
    position: relative;
    /* Anchor for tooltip */
}

/* Tooltip Text */
.tooltip-icon[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    /* Position above */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    z-index: 100;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Tooltip Arrow */
.tooltip-icon[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 90%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    z-index: 100;
}

/* RESULTS AREA */
.results-area {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f1f1f1;
}

.result-box.primary {
    background: var(--primary);
    color: #fff;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 15px;
}

.result-label {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.result-sub {
    font-size: 1rem;
    opacity: 0.9;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    color: var(--text-main);
}

.detail-row span:last-child {
    font-weight: 600;
}

.recommendation-box {
    background: #eef8ff;
    padding: 15px;
    border-radius: var(--radius);
    margin: 15px 0;
    font-size: 0.95rem;
    color: #0b4f84;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
    flex: 2;
}

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

.secondary-btn {
    background: var(--primary);
    color: #fff;
    flex: 1;
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
    text-decoration: underline;
}

/* FAQ & Supplies */
.faq-section,
.related-supplies {
    margin-bottom: 50px;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.faq-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-item summary {
    padding: 15px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    /* remove arrow */
    background: #fafafa;
    position: relative;
    padding-right: 40px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    position: absolute;
    right: 20px;
    font-weight: bold;
    color: var(--accent);
}

.faq-item[open] summary::after {
    content: '-';
}

.faq-content {
    padding: 20px;
    border-top: 1px solid #eee;
    color: #555;
    font-size: 0.95rem;
}

/* Related Supplies Grid */
.supplies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.supply-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    /* For image */
    display: flex;
    flex-direction: column;
}

.supply-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

.supply-img-wrapper {
    width: 100%;
    aspect-ratio: 1;
    /* Square image */
    background: #f9f9f9;
    border-bottom: 1px solid #f0f0f0;
    overflow: hidden;
}

.supply-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Cover */
    transition: transform 0.4s ease;
}

.supply-card:hover .supply-img-wrapper img {
    transform: scale(1.05);
    /* Subtle zoom */
}

.supply-name {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
    padding: 15px 15px 0 15px;
    /* Added padding here */
}

.supply-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 15px 15px 15px;
    /* Added padding here */
}

/* Collapsible "How it works" */
.how-it-works {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.how-it-works summary {
    cursor: pointer;
    margin-bottom: 10px;
    text-decoration: underline;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: #fff;
}

.small-text {
    font-size: 0.85rem;
    margin-top: 5px;
}

@media (min-width: 600px) {
    .tool-title {
        font-size: 2.2rem;
    }
}

/* Horizontal Radio Group (Pills) */
.horizontal-radios {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-option {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-option label {
    display: block;
    background: #f1f1f1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 0 !important;
}

.radio-option input[type="radio"]:checked+label {
    background: #fff;
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.radio-option label:hover {
    background: #e9ecef;
}

/* Warning Box */
.warning-box {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #8d6e63;
}

/* Spacing Tool Specifics */
#spacing-rec-mm {
    font-size: 3rem;
}