:root {
    /* Brand Colors */
    --primary-orange: #C9511F;
    --primary-orange-hover: #D46216;

    /* Dark Theme Palette */
    --bg-page: #000000;
    --bg-card: #151515;
    --bg-input: #222222;

    /* Text Colors */
    --text-main: #FFFFFF;
    --text-secondary: #e5e5e5;
    --text-muted: #a3a3a3;
    --text-inverse: #000000;

    /* Functional */
    --border: #333333;
    --shadow: 0 4px 20px -1px rgba(0, 0, 0, 0.5);
    --radius: 3px;
    /* Sharper corners as per reference */

    /* Mappings to existing variables to minimize code breakage */
    --primary: var(--text-main);
    --primary-light: var(--text-muted);
    --accent: var(--primary-orange);
    --accent-hover: var(--primary-orange-hover);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-page);
    background: radial-gradient(circle at top right, #1a1a1a 0%, #000000 100%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Montserrat', sans-serif;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

.main-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    height: 128px;
    /* Increased size */
    width: auto;
    display: block;
}

/* h1 removed from header as logo contains text, or style if needed */

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Nav */
.app-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-orange);
    background: rgba(201, 81, 31, 0.1);
}

.nav-link.active {
    background: var(--primary-orange);
    color: white;
}

/* Grid Layout */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr 1.2fr;
        align-items: start;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.card h2,
.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.icon-sm {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

/* Input Styles */
.input-section {
    animation: fadeInLeft 0.6s ease-out;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-light);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-left: 2.5rem;
    /* Space for prefix */
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s, ring 0.2s;
    font-family: inherit;
    color: var(--primary);
    background-color: var(--bg-input);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(201, 81, 31, 0.2);
}

.prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
    z-index: 10;
}

.suffix {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
}

/* Adjust padding if no prefix/suffix */
.input-wrapper:not(:has(.prefix)) input {
    padding-left: 1rem;
}

.input-wrapper:has(.suffix) input {
    padding-right: 2.5rem;
}


/* Results Styles */
.results-section {
    animation: fadeInRight 0.6s ease-out;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.highlight-card {
    background: linear-gradient(145deg, #101010 0%, #000000 100%);
    border: 1px solid var(--primary-orange);
    color: white;
}

/* Ensure single result card fills space if needed */
.results-section .result-card:only-child,
.results-section .result-card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.highlight-card h3 {
    color: #e2e8f0;
}

.result-grid {
    display: grid;
    gap: 1.5rem;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
}

.btn-icon:hover {
    background: var(--bg-page);
    color: var(--primary);
    border-color: var(--primary);
}

/* Ensure existing H3 doesn't have excess margin when in row */
.card-header-row h3 {
    margin-bottom: 0;
}

.two-col {
    grid-template-columns: 1fr 1fr;
}

.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.four-col {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* Result Items Styling (Bubbles) */
.result-item {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-radius: 16px;
    transition: transform 0.2s;
    height: 100%;
    justify-content: center;
}

.result-item:hover {
    transform: translateY(-2px);
}

/* Primary Bubble (Totals) - Taking up space */
.primary-bubble {
    background: linear-gradient(135deg, #222222 0%, #151515 100%);
    border: 1px solid var(--primary-orange);
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 15px rgba(201, 81, 31, 0.15);
}

.primary-bubble .bubble-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-orange);
    margin-bottom: 0.75rem;
    padding: 6px;
    background: rgba(201, 81, 31, 0.1);
    border-radius: 50%;
}

.primary-bubble .label {
    font-size: 0.9rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.primary-bubble .value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
}

/* Secondary Bubble (Splits) */
.secondary-bubble {
    background: var(--bg-page);
    border: 1px solid var(--border);
    align-items: center;
    text-align: center;
    padding: 1rem;
}

.secondary-bubble .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.secondary-bubble .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.subtext {
    display: none;
    /* Hide subtext for cleaner bubble look */
}

/* Split content inside bubble */
.split-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    width: 100%;
}

.split-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sub-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.value-sm {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.divider-vertical {
    width: 1px;
    height: 24px;
    background-color: var(--border);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Tweak */
@media (max-width: 600px) {
    h1 {
        font-size: 1.75rem;
    }

    .two-col,
    .three-col {
        grid-template-columns: 1fr;
    }

    body {
        padding: 1rem;
    }
}