:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-primary: #00b894;
    --accent-secondary: #00cec9;
    --danger: #ff7675;
    --chart-grid: #333;
    --input-bg: #2d2d2d;
    --border-color: #404040;
}

@keyframes backgroundPulse {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    20% {
        transform: scale(2.5);
        opacity: 0.5;
    }
    60% {
        transform: scale(4);
        opacity: 0.5;
    }
    70% {
        transform: scale(4);
        opacity: 0;
    }
    /* The 70% to 99.99% segment is a hold, so no additional keyframes needed there for smoothness of change */
    100% {
        transform: scale(1);
        opacity: 0;
    }

}

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

/* Hide main browser scrollbar */
html::-webkit-scrollbar {
    display: none; /* For WebKit browsers (Chrome, Safari, Edge, etc.) */
}
html {
    overflow-y: scroll; /* Ensure scrolling is possible even if bar hidden */
    -ms-overflow-style: none;  /* For Internet Explorer and Edge */
    scrollbar-width: none;  /* For Firefox */
}

/* Override styles to show scrollbar when class is present */
html.show-scrollbar::-webkit-scrollbar {
    display: block; /* Or initial/auto */
}
html.show-scrollbar {
    -ms-overflow-style: scrollbar; /* Or auto */
    scrollbar-width: auto;  /* Or thin/auto */
}

html.no-scroll {
    overflow-y: hidden; /* Hide vertical scrollbar on html when class is present */
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Allow text selection in Gemini chat */
#gemini-chat-window,
#gemini-chat-window * {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Allow text selection in input fields */
input, textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Remove existing body::before and body::after if they exist */
/* body::before { ... } */
/* body::after { ... } */

/* Ensure these are fully removed if they were present from previous attempts */

#backgroundCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* Use viewport units to ensure full coverage */
    height: 100vh;
    pointer-events: none; /* Allows clicks to pass through to elements behind it */
    z-index: 0; /* Position it behind most content but above default body background. Adjust if needed. */
    display: block; /* Avoids potential inline spacing issues */
}

@keyframes backgroundPulse {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    20% {
        transform: scale(2.5);
        opacity: 0.5;
    }
    60% {
        transform: scale(4);
        opacity: 0.5;
    }
    70% {
        transform: scale(4);
        opacity: 0;
    }
    /* The 70% to 99.99% segment is a hold, so no additional keyframes needed there for smoothness of change */
    100% {
        transform: scale(1);
        opacity: 0;
    }

}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-primary); /* Changed from transparent */
    padding: 1rem 2rem;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    /* backdrop-filter: blur(5px); Removed */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.header.scrolled {
    padding: 0.5rem 2rem;
}

.header.scrolled h1 {
    font-size: 2.4rem;
}

.container {
    /* max-width: 1400px; REMOVED */
    /* margin: 2rem auto; REMOVED auto margin */
    margin-top: 5rem; /* RESTORED top margin */
    padding: 3rem 2rem 0.5rem 2rem; /* Keep padding */
    background-color: var(--bg-primary); /* Ensure container bg matches body */
    /* border-radius: 8px; Optional: Remove radius if it looks odd full-width */
    /* Removed box-shadow as header has one */
}

.container.has-content {
    min-height: calc(100vh - 7rem);
}

/* Styles for the fullscreen toggle - NOW INDEPENDENTLY FIXED */
.top-auth-container {
    position: fixed;
    top: 0.5rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: opacity 0.15s ease-out;
}

.fullscreen-toggle {
    /* background-color, color, padding etc. remain */
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 2px 2px;
    margin-right: 1.6rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Removed top/right transition */
}

.fullscreen-toggle:hover {
    background-color: var(--button-hover-bg);
}

.fullscreen-toggle:active {
    transform: scale(0.98);
}

/* Styles for the tier logo GIF - NOW INSIDE A FIXED CONTAINER */
#tier-logo {
    /* position: fixed; REMOVED */
    /* top: 1rem; REMOVED */
    /* right: 1rem; REMOVED */
    margin-top: 2px;
    width: 52px; /* 20% larger than 36px */
    height: auto; /* Maintain aspect ratio */
    /* z-index: 1001; REMOVED - Handled by parent */
}

/* Styles for the container holding fixed elements THAT FADE */
#tier-info-container {
    position: fixed;
    top: calc(2.5rem - 10px); /* Adjust top slightly */
    /* margin-top: 1rem; */ /* Corrected comment */
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column; /* Stack Subscription and the row below */
    align-items: flex-end;   /* Align items to the right */
    gap: 0px; /* Adjust gap */
    opacity: 1;
    transition: opacity 0.15s ease-out;
}

#tier-info-container.faded-out {
    opacity: 0;
    pointer-events: none;
}

/* NEW: Styles for the horizontal row */
.credit-logo-tier-row {
    display: flex;
    align-items: center; /* Vertically align credit, logo, text */
    gap: 8px; /* Space between credit, logo, text */
}

/* Existing Subscription label styles */
#subscription-label {
    display: block; /* Ensure it takes full width */
    text-align: right; /* Align text right */
    margin-bottom: 2px; /* Small space below */
    margin-right: 3rem;
}


/* Credit display styles */
#credit-display {
    /* Ensure correct color and size */
    color: var(--accent-primary);
    font-size: 0.82rem;
    line-height: 1.1;
    /* Remove specific positioning */
    position: static;
    margin-top: 0;
    margin-right: 0;
}

/* Logo row within the new horizontal row */
.logo-text-row {
    /* Keep its internal flex display */
    display: flex;
    align-items: center;
    gap: 0px;
    /* Remove positioning relative to parent */
    position: static;
    top: auto;
    align-self: auto;
}

#tier-logo {
     width: 52px;
     height: auto;
}

.text-column {
    /* Keep internal flex */
    display: flex;
    flex-direction: column;
    position: static;
    top: auto;
}

#tier-info-container .tier-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.1;
}

/* Auth styles */
.auth-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.auth-row.scrolled-auth {
    margin-bottom: 2px;
    margin-right: 3rem; /* Align with credit display in scrolled state */
}

.auth-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: var(--accent-primary);
}

.auth-separator {
    color: var(--border-color);
    font-size: 0.8rem;
    user-select: none;
}


/* --- Scrolled State Controls --- */
#scrolled-controls-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 1rem;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    z-index: 1002;
}

.scrolled-controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header.scrolled #scrolled-controls-container {
    display: flex !important; /* Show when scrolled (Forced) */
}

#scrolled-controls-container .fullscreen-toggle {
    position: static;
    margin: 0;
    padding: 2px 4px;
    font-size: 0.75rem;
}

.auth-row.scrolled-auth {
    margin-bottom: 0; /* Reset margin for horizontal alignment */
    margin-right: 0; /* Reset margin for horizontal alignment */
}

#scrolled-credit-display {
    font-size: 0.75rem;
    text-align: right;
    color: var(--accent-primary);
    margin-right: 3rem;
    margin-top: 0.5rem;
}

/* Remove fixed positioning from original fullscreen toggle if still present */
.fullscreen-toggle {
   /* Base styles */
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 2px 2px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
    /* Removed fixed positioning properties */
}

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400&display=swap');

h1 {
    user-select: none;
    font-size: 3.4rem;
    font-weight: 300;
    font-family: 'Quicksand', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: block;
    background-image: linear-gradient(135deg, 
        #00cec9 0%,
        #00b894 5%,
        #00b894 10%,
        #ff8866 30%,
        #ff4444 35%, 
        #ff4444 40%,
        #ff8866 45%,
        #00b894 60%,
        #00b894 75%,
        #00cec9 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    margin: 0;
    letter-spacing: -0.01em;
    position: relative;
    text-shadow: 0 0 30px rgba(0, 184, 148, 0.1);
    animation: titleGlow 10s ease-in-out infinite alternate;
    transition: font-size 0.3s ease;
    line-height: 1;
    margin-bottom: -0.2rem;
}

.subtitle {
    user-select: none;
    display: block;
    font-size: 0.8rem;
    color: rgba(160, 160, 160, 0.7);
    font-weight: 300;
    margin-top: 0.15rem;
    margin-left: 0.2rem;
    font-family: 'Quicksand', sans-serif;
    transition: all 0.3s ease, opacity 0.5s ease-in-out;
    line-height: 1;
    opacity: 1;
}

.header.scrolled .subtitle {
    font-size: 0.7rem;
}

.header-description {
    display: inline-block;
    margin-left: 2rem;
    padding-left: 0;
    font-size: 0.78rem;
    color: rgb(158, 158, 158);
    font-weight: 300;
    vertical-align: middle;
    opacity: 1;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
    user-select: none;
    white-space: nowrap;
    line-height: 1;
    visibility: visible;
}

.header.scrolled .header-description {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
    pointer-events: none;
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 0 30px rgba(0, 184, 148, 0.1);
    }
    100% {
        text-shadow: 0 0 50px rgba(0, 184, 148, 0.2);
    }
}

/* Ensure the gradient animation works smoothly */
@media (prefers-reduced-motion: no-preference) {
    h1 {
        background-size: 200% auto;
        animation: titleGlow 5s ease-in-out infinite alternate,
                   gradientFlow 20s ease infinite;
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

h2, h3 {
    color: var(--text-primary);
    font-weight: 400;
    margin: 1.5rem 0;
}

.stock-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    min-height: fit-content;
}

.stock-input-group.has-price {
    margin-bottom: 2rem;
}

.mini-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.input-label {
    color: var(--text-secondary);
    font-weight: 500;
}

#stockTicker, #stockTickerBasic, #stockTickerMaxMin {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    width: 120px;
}

.price-isin-display {
    font-size: 1.1rem;
    color: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    line-height: 1.4;
}

.price-isin-display.visible {
    opacity: 1;
}

.price-isin-display .display-row-1,
.price-isin-display .display-row-2 {
    display: block;
    margin-bottom: 0.2rem;
}

.price-isin-display .display-row-2 {
    font-size: 1.0rem;
}

.ticker-error {
    color: #ffd700;
    font-size: 0.9rem;
    margin-top: 0.3rem;
    padding: 0.2rem 0.5rem;
    background-color: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    display: none;
    line-height: 1.2;
    min-height: unset;
}

button {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background-color: var(--accent-secondary);
    transform: translateY(-1px);
}

button:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.stop-btn {
    background-color: var(--danger);
}

.stop-btn:hover {
    background-color: #ff8b8b;
}

.analysis-section {
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.analysis-section.visible {
    opacity: 1;
    display: block;
}

#probabilityGraphContainer, #riskToleranceSection, #searchParametersSection, #availableOptionsContainer {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#probabilityGraphContainer.visible, #riskToleranceSection.visible, #searchParametersSection.visible, #availableOptionsContainer.visible {
    opacity: 1;
    pointer-events: auto;
}

select, input[type="number"], input[type="text"] {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    min-width: 200px;
}

select:disabled, input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.graph-container {
    background-color: transparent;
    border: none;
    padding: 1.5rem;
    margin: 2rem 0;
    /* height: 450px; */ /* REMOVED height */
    position: relative;
    clear: both;
}

/* Hide the default graph info text */
.graph-info {
    /*
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    */
    display: none; /* Ensure this is hidden */
}

.parameter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.parameter-group label {
    min-width: 100px;
}

#stepsContainer, #customWeightsContainer {
    display: none;
    margin-left: -0.5rem;
    align-items: center;
}

#stepsContainer.visible, #customWeightsContainer.visible {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weight-selection-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weight-label {
    display: inline-block;
    white-space: nowrap;
}

.console-window {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: #00ff00;
    font-family: 'Consolas', monospace;
    padding: 1rem;
    height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: all 0.3s ease;
    margin: 1rem 0;
    /* Webkit scrollbar styling */
    &::-webkit-scrollbar {
        width: 12px;
        background-color: var(--bg-primary);
    }
    &::-webkit-scrollbar-thumb {
        background-color: var(--border-color);
        border-radius: 6px;
        border: 2px solid var(--bg-primary);
    }
    &::-webkit-scrollbar-track {
        background-color: var(--bg-primary);
    }
    /* Firefox scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}

.console-window.expanded {
    height: 80vh;
    width: 95vw;
    position: fixed;
    top: 10vh;
    left: 2.5vw;
    z-index: 1000;
    background-color: rgba(36, 36, 36, 0.95);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.console-toggle {
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 0.9rem;
}

.console-close-btn {
    background-color: var(--danger);
    color: var(--text-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: fixed;
    top: 12vh;
    right: 4vw;
    z-index: 1010;
    font-size: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.console-window.expanded + .console-close-btn {
    display: flex;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-container {
    background-color: var(--bg-secondary);
    border-radius: 4px;
    height: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--accent-primary);
    height: 100%;
    transition: width 0.3s ease;
}

.warning-message {
    background-color: rgba(255, 118, 117, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.chart-container {
    background-color: transparent;
    border: none;
    padding: 1.5rem;
    margin: 1.5rem 0;
    min-height: 600px;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

#resultChart {
    flex: 1;
    width: 100%;
    height: 100%;
    /* min-height: 550px; REMOVED min-height */
}

#bsChartContainer {
    background-color: transparent;
    border: none;
    padding: 1.5rem;
    margin: 1.5rem 0;
    margin-bottom: 100px;
}

.risk-tolerance-section {
    margin-top: 6rem;
    position: relative;
    clear: both;
}

#riskToleranceSection {
    margin-top: 6rem;
}

#probabilityGraphContainer, #riskToleranceSection {
    margin: 2rem 0;
}

/* Chart.js customization */
canvas {
    filter: none;
}

.date-select-container {
    /* Styles for being inside stock-input-group */
    margin-top: 0; 
    margin-bottom: 0; 
    padding: 0; 
    width: auto; 
    min-width: 250px; 
    /* flex-shrink: 0; */ /* Not needed inside default flex */
    /* margin-left: 2rem; is set inline for now */
}

.date-select-title {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
}

.date-select-title .info-icon {
    position: relative;
    display: inline-block;
    margin-left: 4px;
}

.date-select-title .info-icon .tooltip {
    left: auto;
    right: -10px;
    top: 100%;
    margin-top: 8px;
    transform: none;
    width: 300px;
    max-width: 300px;
    white-space: normal;
    line-height: 1.4;
    font-size: 0.9rem;
    z-index: 1000;
}

.date-select-title .info-icon .tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 10px;
    width: 12px;
    height: 12px;
    background-color: var(--bg-secondary);
    transform: rotate(45deg);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

.years-horizontal-container {
    display: flex; /* Ensure flex display */
    /* justify-content: space-around; */ /* Remove justification */
    gap: 10px; /* Use same gap as vertical container */
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.year-header {
    font-size: 1.1em; 
    color: var(--accent-primary); 
    font-weight: 500;
    text-align: center;
    cursor: default;
    flex: 1; /* Make headers share space equally, replacing grow/basis */
    min-width: 70px; /* Match min-width of dates-container */
}

.dates-vertical-container {
    display: flex;
    /* justify-content: space-around; */ /* Remove justification */
    gap: 10px; /* Ensure gap is consistent */
}

.dates-container {
    display: flex;
    flex-direction: column;
    gap: 8px; 
    align-items: center;
    min-width: 70px;
    flex: 1; /* Make columns share space equally */
}

.date-option,
.date-option-basic,
.date-option-maxmin { /* Apply to all */
    padding: 8px 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 2px; /* Less round */
    transition: all 0.25s ease-in-out;
    text-align: center;
    user-select: none;
    width: 100%; /* Ensure full box is clickable */
    font-size: 0.9em;
}

.date-option:hover,
.date-option-basic:hover,
.date-option-maxmin:hover { /* Apply to all */
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-secondary);
    transform: scale(1.05); /* Subtle scale on hover */
}

.date-option.active,
.date-option-basic.active,
.date-option-maxmin.active { /* Apply to all */
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-secondary);
    font-weight: 500;
    box-shadow: 0 0 8px var(--accent-primary);
}

.warning-message {
    display: none !important;
}

.export-button {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
}

.export-button:hover {
    background-color: var(--accent-secondary);
    transform: translateY(-1px);
}

.title-container {
    position: relative;
    display: block;
}

.title-container h2, .title-container h3 {
    display: inline-block;
    margin-right: 4px;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: var(--bg-primary);
    font-size: 12px;
    margin-left: 8px;
    cursor: help;
    font-family: serif;
    font-style: italic;
}

.tooltip {
    /* Keep basic styling */
    visibility: hidden; /* Initially hidden */
    position: fixed; /* Use fixed positioning for placement relative to viewport */
    z-index: 1001; /* Ensure it's above most other content */
    min-width: 200px;
    max-width: 400px;
    width: max-content;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-align: left;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s ease-in-out; /* Faster transition */
    word-wrap: break-word;
    white-space: normal;
    pointer-events: none; /* Prevent tooltip from interfering with mouse events */
}

.spread-results {
    font-family: 'Consolas', monospace;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0 0.5rem 0; /* Reduced bottom margin */
    white-space: pre; /* Keep pre to respect newlines */
    line-height: 1.5;
    border: 1px solid var(--border-color);
    display: inline-block; /* Revert to inline-block */
    max-width: 100%; /* Prevent overflow if content is very wide */
    min-width: 350px; /* Keep the minimum width */
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: not-allowed;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
    background-color: white;
}

.toggle-switch.disabled {
    opacity: 0.5; /* Keep general dimming */
    cursor: not-allowed;
}

.toggle-switch.disabled .toggle-slider {
    cursor: not-allowed;
    background-color: #444; /* Darker grey for disabled slider background */
}

.toggle-switch.disabled .toggle-slider:before {
    background-color: #777; /* Darker grey for disabled slider knob */
}

.toggle-label {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative; /* Needed for tooltip positioning on hover */
    cursor: not-allowed; /* Apply not-allowed cursor to the whole label when disabled */
}

.toggle-container.disabled-mode .toggle-label {
    cursor: not-allowed; /* Ensure label gets the cursor */
    /* pointer-events: none; REMOVE this - it prevents hover */
}

/* Ensure the tooltip shows on hover of the CONTAINER (label wrapper) */
.toggle-container.disabled-mode:hover .disabled-tooltip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Position the tooltip relative to the toggle container */
.disabled-tooltip {
    visibility: hidden; /* Use visibility + opacity for transition */
    opacity: 0;
    position: absolute;
    bottom: 110%; /* Position above the toggle label */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(45, 45, 45, 0.9); /* Dark semi-transparent background */
    color: #ffd700; /* Yellow text */
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10; /* Ensure tooltip is above button */
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    pointer-events: none; /* Prevent tooltip from stealing hover */
}

#stopBtn {
    display: none; /* Hide by default */
}

.manual-entry-container {
    margin-top: 0.5rem;
    margin-bottom: 1rem; /* Reduced bottom margin slightly */
    display: none; /* Hide container by default */
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    min-height: min-content;
    overflow: visible;
}

.manual-entry-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    margin: 0;
    transition: opacity 0.2s;
    width: fit-content;
}

.manual-entry-toggle:hover {
    opacity: 0.8;
}

.manual-entry-row {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
    margin-bottom: 1rem;
    min-height: min-content;
    overflow: visible;
}

.manual-entry-input-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    min-height: 24px; /* Minimum height */
    margin-bottom: 0.5rem; /* Space below input row */
}

#manualEntryField {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.8rem;
    min-height: 24px;
    padding: 4px 8px;
    resize: none;
    width: calc(100% - 100px);
    overflow: hidden;
    max-height: 400px;
}

.manual-update-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 12px;
    font-size: 0.8rem;
    transition: all 0.2s;
    height: 24px;
    width: 80px;
    white-space: nowrap;
    align-self: flex-start;
}

.manual-entry-error {
    display: none;
    color: #ffd700;
    font-size: 0.8rem;
    margin-top: 4px;
    margin-bottom: 0.5rem; /* Space below error message */
}

/* Add spacing for content below manual entry */
.graph-container {
    position: relative;
    margin-top: 1rem;
    padding-top: 1rem;
    clear: both;
}

/* Ensure proper spacing when manual entry is expanded */
.manual-entry-row[style*="display: flex"] + .graph-container {
    margin-top: 2rem;
}

.search-parameters-section {
    margin-top: 200px;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Add new styles for the donation section */
.donation-section {
    margin-top: 3rem;
    margin-bottom: 8rem; /* Add bottom margin to ensure it's not at the very bottom edge */
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.03);
    width: 100%;
}

.donation-text {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.donate-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #0070ba;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.donate-button:hover {
    background-color: #005ea6;
}

.paypal-logo {
    height: 0.8rem;
    width: auto;
}

/* Result Action Buttons (Track, Invest, Share) */
.result-action-buttons {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 3rem; /* More spread out */
    margin-top: 1rem; /* Reduced from 2.5rem */
    margin-bottom: 1rem;
    padding: 0.5rem 0; /* Reduced from 1rem 0 */
    flex-wrap: wrap;
}

.result-action-buttons-bottom {
    justify-content: center;
    gap: 6rem; /* Even more spaced out for bottom row */
    margin-top: 3rem;
}

.action-button-wrapper {
    position: relative;
    display: inline-block;
}

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.action-button .action-icon {
    font-size: 1rem;
}

.action-button-track {
    background-color: #8c7b66; /* Muted orange-yellow-gray */
    color: #000;
    border: none;
    opacity: 0.85;
    cursor: not-allowed;
}

.action-button-track:hover {
    background-color: var(--accent-primary); /* Default teal color */
    opacity: 1;
    box-shadow: 0 0 15px rgba(0, 184, 148, 0.5);
    transform: translateY(-1px);
}

.action-button-invest {
    background-color: #8c8666; /* Muted golden-gray */
    color: #000;
    border: none;
    opacity: 0.85;
    cursor: not-allowed;
}

.action-button-invest:hover {
    background-color: #c5a021; /* Deep rich gold color */
    opacity: 1;
    box-shadow: 0 0 15px rgba(197, 160, 33, 0.5);
    transform: translateY(-1px);
}

.action-button-share {
    background-color: #4a4a4a;
    color: white;
    border: 1px solid #666;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.action-button-share:hover {
    background-color: #5a5a5a;
    border-color: #888;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.action-button-share .action-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Tooltip for disabled action buttons */
.action-button-wrapper .disabled-tooltip {
    bottom: 120%;
    font-size: 0.75rem;
}

.action-button-wrapper:hover .disabled-tooltip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Share copied indicator */
.share-copied-indicator {
    position: absolute;
    top: 50%;
    left: calc(100% + 0.5rem);
    transform: translateY(-50%);
    background-color: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    animation: fadeInOut 2s ease forwards;
}

.share-copied-indicator .copied-icon {
    margin-right: 0.2rem;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-50%) translateX(-5px); }
    15% { opacity: 1; transform: translateY(-50%) translateX(0); }
    85% { opacity: 1; transform: translateY(-50%) translateX(0); }
    100% { opacity: 0; transform: translateY(-50%) translateX(5px); }
}

/* NEW styles for the top layout container */
.top-layout-container {
    display: flex;
    /* justify-content: space-between; */ /* Change justification */
    justify-content: flex-start; /* Align items to start */
    align-items: flex-start; /* Align to top */
    gap: 2rem; /* Add gap between items */
    margin-bottom: 3rem; /* Space below this section */
}

/* Spacer element for positioning */
.layout-spacer {
    flex-basis: 25%; /* Occupy roughly 33% of the space */
    flex-shrink: 0;
}

/* --- New Top Layout Styles --- */
.top-section-wrapper {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 2rem; /* Gap between left and right columns */
    margin-bottom: 2rem; /* Space below this whole section */
}

.left-column {
    display: flex;
    flex-direction: column; /* Stack stock input and price/isin */
    flex-basis: 30%; /* Reduced from 40% to shift right column left */
    flex-shrink: 0;
}

.right-column {
    display: flex;
    align-items: flex-start; /* Align date selector and chart */
    gap: 1.5rem; /* Gap between date selector and chart */
    flex-grow: 1; /* Take remaining space */
}
/* --- End New Top Layout Styles --- */

.date-select-container {
    /* Styles for being in right column */
    margin-top: 0; 
    margin-bottom: 0; 
    padding: 0; 
    width: auto; 
    min-width: 250px; 
    flex-shrink: 0; /* Prevent shrinking */
}

.header .subtitle {
    font-size: 0.9rem; 
    color: var(--text-secondary);
    margin-top: 2px;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* Style for the controls container */
/* REMOVED .header-controls rule */

/* Styles for the moved fullscreen toggle */
/* REMOVED old .fullscreen-toggle rule */

/* Styles for the tier logo GIF */
/* REMOVED old #tier-logo rule */

/* Style for fading out the container on scroll */
#tier-info-container.faded-out {
    opacity: 0;
    pointer-events: none; /* Prevent interaction when invisible */
    transition: opacity 0.15s ease-out; /* FASTER transition */
}

/* --- Styles for Tiers Page (tiers.html) --- */

/* Style for the back link */
#back-link {
    display: inline-block; /* Allow margin */
    margin-bottom: 1.5rem; /* Space below link */
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

#back-link:hover {
    color: var(--text-primary);
}

.tier-list {
    margin-top: 2rem;
}

.tier-item {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Space between image and text block */
    padding: 1.5rem 0;
    /* border-bottom: 1px solid var(--border-color); REMOVED */
}

/* .tier-item:last-child { 
    border-bottom: none; REMOVED as border is gone 
} */

.tier-item img {
    width: 80px; /* Increased size */
    height: auto;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.tier-details {
    display: flex;
    align-items: center; /* Align text items horizontally */
    gap: 1.5rem; /* Space between name/api block and description */
    flex-grow: 1;
}

.tier-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-width: 100px; /* Ensure some width for name */
}

.tier-api {
    font-size: 1rem;
    color: var(--accent-primary); /* Use accent color */
    font-family: monospace;
    min-width: 100px; /* Ensure some width for api level */
}

.tier-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex-grow: 1; /* Allow description to take remaining space */
}

/* Style for the link wrapping the subscription label */
.tier-link {
    text-decoration: none; /* Remove underline */
    color: inherit; /* Inherit color from span */
}

/* Style for the notice box on tiers page */
.notice-box {
    background-color: rgba(255, 215, 0, 0.1); /* Light yellow/gold background */
    border: 1px solid rgba(255, 215, 0, 0.4); /* Yellow/gold border */
    color: #ffd700; /* Yellow/gold text */
    padding: 1rem 1.5rem;
    margin: 1rem 0 2rem 0; /* Add some vertical margin */
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notice-box strong {
    color: #fff; /* Make "Please Note:" stand out more */
}

.title-block {
    /* Takes available space pushing logo container right because of justify-content: space-between on parent */
    flex-grow: 1;
}

/* Style for the small logo image itself */
#header-tier-logo-container {
    opacity: 0; /* Hidden by default */
    pointer-events: none;
    transition: opacity 0.15s ease-out; /* Match fade speed */
    position: absolute; /* Position relative to header */
    right: 1rem; 
    top: 50%; /* Use 50% for better vertical centering */
    transform: translateY(-50%); /* Adjust for exact centering */
}

/* Hide the original fullscreen toggle when header is scrolled */
.header.scrolled + .fullscreen-toggle#fullscreenToggle {
    display: none;
}

/* Ensure the scrolled controls fullscreen toggle is only visible when header is scrolled */
#scrolled-controls-container .fullscreen-toggle {
    /* existing styles */
    display: none; /* Hidden by default */
}

.header.scrolled #scrolled-controls-container .fullscreen-toggle {
    display: block; /* Or inline-flex, or flex, depending on desired layout */
    position: static; /* Reset position if it was fixed/absolute */
    margin: 0;
    padding: 2px 4px;
    font-size: 0.75rem;
}

/* Style for the controls container */
/* REMOVED .header-controls rule */

/* Styles for the moved fullscreen toggle */
/* REMOVED old .fullscreen-toggle rule */

/* Styles for the tier logo GIF */
/* REMOVED old #tier-logo rule */

/* Style for fading out the container on scroll */
#tier-info-container.faded-out {
    opacity: 0;
    pointer-events: none; /* Prevent interaction when invisible */
    transition: opacity 0.15s ease-out; /* FASTER transition */
}

/* --- Styles for Tiers Page (tiers.html) --- */

/* Style for the back link */
#back-link {
    display: inline-block; /* Allow margin */
    margin-bottom: 1.5rem; /* Space below link */
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

#back-link:hover {
    color: var(--text-primary);
}

.tier-list {
    margin-top: 2rem;
}

.tier-item {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Space between image and text block */
    padding: 1.5rem 0;
    /* border-bottom: 1px solid var(--border-color); REMOVED */
}

/* .tier-item:last-child { 
    border-bottom: none; REMOVED as border is gone 
} */

.tier-item img {
    width: 80px; /* Increased size */
    height: auto;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.tier-details {
    display: flex;
    align-items: center; /* Align text items horizontally */
    gap: 1.5rem; /* Space between name/api block and description */
    flex-grow: 1;
}

.tier-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-width: 100px; /* Ensure some width for name */
}

.tier-api {
    font-size: 1rem;
    color: var(--accent-primary); /* Use accent color */
    font-family: monospace;
    min-width: 100px; /* Ensure some width for api level */
}

.tier-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex-grow: 1; /* Allow description to take remaining space */
}

/* Style for the link wrapping the subscription label */
.tier-link {
    text-decoration: none; /* Remove underline */
    color: inherit; /* Inherit color from span */
}

/* Style for the notice box on tiers page */
.notice-box {
    background-color: rgba(255, 215, 0, 0.1); /* Light yellow/gold background */
    border: 1px solid rgba(255, 215, 0, 0.4); /* Yellow/gold border */
    color: #ffd700; /* Yellow/gold text */
    padding: 1rem 1.5rem;
    margin: 1rem 0 2rem 0; /* Add some vertical margin */
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notice-box strong {
    color: #fff; /* Make "Please Note:" stand out more */
}

.title-block {
    /* Takes available space pushing logo container right because of justify-content: space-between on parent */
    flex-grow: 1;
}

/* Style for the small logo image itself */
#header-tier-logo {
    width: 33px; /* Increased size by ~30% */
    height: auto;
    display: block; /* Prevents extra space below */
}

/* Show the small logo when header is scrolled */
.header.scrolled #header-tier-logo-container {
    opacity: 1;
    pointer-events: auto;
    margin-top: 1rem;
}
/* From backup/2025-04-30-0328/style.css */

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@media (prefers-reduced-motion: no-preference) {
    h1 {
        background-size: 200% auto;
        animation: titleGlow 5s ease-in-out infinite alternate,
                   gradientFlow 20s ease infinite;
    }
}

/* Hide specific UI elements */
#estimatedTime,
#loadingIndicator .eta-display,
#consoleToggle {
    display: none !important; /* Hide estimate, ETA, and console toggle */
}

#resultGraphContainer {
    margin-top: 2rem;
    padding: 0; 
    border: none; 
    box-shadow: none; 
    height: auto; /* <<< Ensure height is auto to allow expansion */
}

.spread-results {
    font-family: 'Consolas', monospace;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0 0.5rem 0; /* Reduced bottom margin */
    white-space: pre; /* Keep pre to respect newlines */
    line-height: 1.5;
    border: 1px solid var(--border-color);
    display: inline-block; /* Revert to inline-block */
    max-width: 100%; /* Prevent overflow if content is very wide */
    min-width: 350px; /* Keep the minimum width */
}

/* Specific graph container heights */
#probabilityGraphContainer .graph-container {
    height: 600px; /* Adjusted height */
}
#riskToleranceSection .graph-container {
    height: 450px; /* Reduced height */
}

/* Add this class dynamically */
.container.has-content {
    min-height: calc(100vh - 7rem);
}

#resultGraphContainer .chart-container {
    height: 80vh; /* Set height relative to viewport height */
    /* aspect-ratio: 1 / 1; Removed fixed aspect ratio */
    background-color: transparent; /* Explicitly set to transparent */
    max-height: none; /* REMOVED max-height constraint */
    padding: 0rem;
    border-radius: 8px;
}

/* NEW rule for BS Table container */
.bs-table-container {
    background-color: transparent !important; /* Make background transparent */
    padding: 0.5rem;
    border-radius: 8px;
    margin: 1.5rem 0 100px 0;
    overflow: auto;
    height: auto;
    max-height: none;
}

/* Ensure the table itself can cause overflow */
#bsChartContainer table,
#bsChartContainerBasic table {
    width: 100%;
    border-collapse: collapse;
    background-color: transparent !important;
}

/* Styles for value glow effect */
.value-glow {
    /* Base styles if needed, e.g., display: inline-block; */
    /* but text-shadow should work on inline spans */
    position: relative; /* Helps some browsers render shadow consistently */
}

.value-glow.positive {
    /* Cyan glow - using accent-secondary */
    /* text-shadow: 0 0 8px rgba(0, 206, 201, 0.6); */
    text-shadow: 0 0 20px rgba(0, 206, 201, 1); /* Increased blur radius */
}

.value-glow.negative {
    /* Red glow - using danger color */
    /* text-shadow: 0 0 8px rgba(255, 118, 117, 0.7); */
    text-shadow: 0 0 20px rgba(255, 118, 117, 1); /* Increased blur radius */
}

.value-glow.zero {
    /* White/grey glow */
    /* text-shadow: 0 0 7px rgba(224, 224, 224, 0.5); */
    text-shadow: 0 0 20px rgba(224, 224, 224, 1); /* Increased blur radius */
}

/* Mode Selector Styles */
.mode-selector-container {
    display: flex;
    justify-content: space-between; /* SPREAD OUT buttons */
    padding: 1rem 20%; /* Space above/below AND 10% left/right padding */
    margin-top: 7rem; /* Push below fixed header */
    position: relative; /* Keep in flow but allow z-index if needed */
    z-index: 5; /* Ensure it's above the background pulse */
}

/* NEW: Mode Description Area Styles */
#mode-description-area {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 10%; /* Padding for horizontal centering and some vertical space */
    margin-top: 1.5rem; /* Increased to move it down */
    margin-bottom: -50px; /* Negative margin to pull subsequent content up */
    min-height: 2.5em; /* Reserve space to prevent layout shifts, allows for ~2 lines of text */
    line-height: 1.4;
    font-style: italic;
}

.math-toggle-link {
    color: var(--accent-primary);
    cursor: pointer;
    text-decoration: none;
}

.math-toggle-link:hover {
    text-decoration: underline;
}

/* Wrapper for each mode button */
.mode-button-wrapper {
    position: relative; /* For tooltip positioning */
}

.mode-button-wrapper.has-sub-options {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.mode-button-wrapper.has-sub-options .mode-button {
    width: 100%;
}

.mode-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: var(--input-bg); /* Whitish-grey */
    color: var(--text-secondary); /* Grey text */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    box-shadow: none; /* Default no glow */
}

/* Sub-mode buttons (Single/Multi for Max Min) */
.sub-mode-buttons {
    display: flex;
    width: 100%;
    margin-top: 0;
}

.sub-mode-button {
    flex: 1;
    padding: 0.2rem 0;
    font-size: 0.7rem;
    font-weight: 500;
    background-color: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid #333;
    border-top: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Remove double border between buttons and set border radius */
.sub-mode-button:first-child {
    border-radius: 0 0 0 6px;
    border-right: 1px solid #333;
}

.sub-mode-button:last-child {
    border-radius: 0 0 6px 0;
    border-left: none;
}

.sub-mode-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.sub-mode-button.active {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Remove bottom border-radius from Max Min button when sub-buttons are visible */
#mode-max-min.has-sub-buttons {
    border-radius: 6px 6px 0 0;
}

/* Visual styling for disabled mode buttons */
.mode-button-wrapper.disabled-mode .mode-button {
    opacity: 0.6;
    cursor: not-allowed;
    /* No pointer-events: none needed here, hover is on wrapper */
}

/* Don't apply hover effect to the button itself if disabled */
.mode-button-wrapper.disabled-mode .mode-button:hover {
    background-color: var(--input-bg); /* Keep original background */
    color: var(--text-secondary); /* Keep original text color */
    /* Prevent transform */
    transform: none; 
}

.mode-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 0 12px 1px rgba(224, 224, 224, 0.4); 
}

/* Styles for the disabled tooltip */
.disabled-tooltip {
    visibility: hidden; /* Use visibility + opacity for transition */
    opacity: 0;
    position: absolute;
    bottom: 110%; /* Position above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(45, 45, 45, 0.9); /* Dark semi-transparent background */
    color: #ffd700; /* Yellow text */
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10; /* Ensure tooltip is above button */
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    pointer-events: none; /* Prevent tooltip from stealing hover */
}

/* Show tooltip on wrapper hover (also show for non-disabled wrappers like MaxMin) */
.mode-button-wrapper.disabled-mode:hover .disabled-tooltip,
.mode-button-wrapper:hover .disabled-tooltip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Re-add the active button style with glow */
.mode-button.active {
    background-color: var(--bg-secondary); /* Slightly different active background */
    color: var(--text-primary);
    border-color: var(--text-secondary); 
    /* Whitish-grey glow */
    box-shadow: 0 0 12px 1px rgba(224, 224, 224, 0.4); 
}

/* Style for preset risk section */
.preset-section {
    margin-top: 0.5rem; /* Small gap below canvas */
    /*margin-bottom: 50rem;*/ /* INCREASED Space below presets before search params */
    text-align: left; /* Align label and buttons left */
}

.preset-label {
    display: block; /* Label on its own line */
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Style for preset risk buttons container */
.preset-risk-buttons {
    display: flex;
    justify-content: flex-start; 
    gap: 0.5rem; /* REDUCED gap */
    /*margin-bottom: 500px;*/ /* INCREASED Space below presets before search params */
}

.preset-button {
    padding: 0.3rem 0.6rem; /* Reduced padding */
    font-size: 0.8rem; /* Reduced font size */
    /* background-color: var(--input-bg); REMOVED solid background */
    background-color: rgba(45, 45, 45, 0.6); /* Use rgba for transparency (from #2d2d2d) */
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    background-image: none; /* <<< Explicitly no background image by default */
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; /* Specify transitions */
}

/* Remove generic hover background change */
/*
.preset-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
*/

/* Specific hover gradients */
#preset-high-risk:hover {
    /* Red to Yellow (less saturated) */
    background-image: linear-gradient(to top right, #d84444, #d4b000);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #d8444400;
}
#preset-medium-risk:hover {
    /* Orange to Light Grey (less saturated) */
    background-image: linear-gradient(to top right, #cc8400, #cccccc);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #cc850000;
}
#preset-low-risk:hover {
    /* Yellow to Light Green (less saturated) */
    background-image: linear-gradient(to top right, #d4b000, #7fbc7f);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #d4b10000;
}
#preset-insurance:hover, 
#preset-no-loss:hover { 
    /* Light Yellow - White - Light Green */
    background-image: linear-gradient(to top right, #ffffcc, #ffffff, #ccffcc);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: #333; /* Darker text for light gradient */
    border-color: #cccccc00;
}
#preset-no-brainer:hover {
    /* Light Green to Dark Green (less saturated) */
    background-image: linear-gradient(to top right, #7fbc7f, #004d00);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #7fbc7f00;
}

/* Unified styles for Market Data Overview charts */
#availableOptionsContainer, 
#availableOptionsContainerBasic, 
#availableOptionsContainerMaxMin {
    width: auto;
    max-width: none;
    height: 500px;
    margin-top: 0;
    flex-grow: 1;
    position: relative;
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#availableOptionsContainer.visible,
#availableOptionsContainerBasic.visible,
#availableOptionsContainerMaxMin.visible {
    opacity: 1;
    pointer-events: auto;
}

#availableOptionsContainer .graph-container,
#availableOptionsContainerBasic .graph-container,
#availableOptionsContainerMaxMin .graph-container {
    height: 100%;
    padding: 1rem;
    margin: 0;
}

#availableOptionsContainer h3,
#availableOptionsContainerBasic h3,
#availableOptionsContainerMaxMin h3 {
    margin-top: 0;
    font-size: 1.1rem;
}

#optionsOverviewChart,
#optionsOverviewChartBasic,
#optionsOverviewChartMaxMin {
    height: calc(100% - 40px) !important;
    width: 100% !important;
}

/* New styles for the top layout container */
.top-layout-container {
    display: flex;
    /* justify-content: space-between; */ /* Change justification */
    justify-content: flex-start; /* Align items to start */
    align-items: flex-start; /* Align to top */
    gap: 2rem; /* Add gap between items */
    margin-bottom: 3rem; /* Space below this section */
}

/* Spacer element for positioning */
.layout-spacer {
    flex-basis: 25%; /* Occupy roughly 33% of the space */
    flex-shrink: 0;
}

/* --- New Top Layout Styles --- */
.top-section-wrapper {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 2rem; /* Gap between left and right columns */
    margin-bottom: 2rem; /* Space below this whole section */
}

.left-column {
    display: flex;
    flex-direction: column; /* Stack stock input and price/isin */
    flex-basis: 30%; /* Reduced from 40% to shift right column left */
    flex-shrink: 0;
}

.right-column {
    display: flex;
    align-items: flex-start; /* Align date selector and chart */
    gap: 1.5rem; /* Gap between date selector and chart */
    flex-grow: 1; /* Take remaining space */
}
/* --- End New Top Layout Styles --- */

.date-select-container {
    /* Styles for being in right column */
    margin-top: 0; 
    margin-bottom: 0; 
    padding: 0; 
    width: auto; 
    min-width: 250px; 
    flex-shrink: 0; /* Prevent shrinking */
}

.header .subtitle {
    font-size: 0.9rem; 
    color: var(--text-secondary);
    margin-top: 2px;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* Style for the controls container */
/* REMOVED .header-controls rule */

/* Styles for the moved fullscreen toggle */
/* REMOVED old .fullscreen-toggle rule */

/* Styles for the tier logo GIF */
/* REMOVED old #tier-logo rule */

/* Style for fading out the container on scroll */
#tier-info-container.faded-out {
    opacity: 0;
    pointer-events: none; /* Prevent interaction when invisible */
    transition: opacity 0.15s ease-out; /* FASTER transition */
}

/* --- Styles for Tiers Page (tiers.html) --- */

/* Style for the back link */
#back-link {
    display: inline-block; /* Allow margin */
    margin-bottom: 1.5rem; /* Space below link */
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

#back-link:hover {
    color: var(--text-primary);
}

.tier-list {
    margin-top: 2rem;
}

.tier-item {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Space between image and text block */
    padding: 1.5rem 0;
    /* border-bottom: 1px solid var(--border-color); REMOVED */
}

/* .tier-item:last-child { 
    border-bottom: none; REMOVED as border is gone 
} */

.tier-item img {
    width: 80px; /* Increased size */
    height: auto;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.tier-details {
    display: flex;
    align-items: center; /* Align text items horizontally */
    gap: 1.5rem; /* Space between name/api block and description */
    flex-grow: 1;
}

.tier-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-width: 100px; /* Ensure some width for name */
}

.tier-api {
    font-size: 1rem;
    color: var(--accent-primary); /* Use accent color */
    font-family: monospace;
    min-width: 100px; /* Ensure some width for api level */
}

.tier-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex-grow: 1; /* Allow description to take remaining space */
}

/* Style for the link wrapping the subscription label */
.tier-link {
    text-decoration: none; /* Remove underline */
    color: inherit; /* Inherit color from span */
}

/* Style for the notice box on tiers page */
.notice-box {
    background-color: rgba(255, 215, 0, 0.1); /* Light yellow/gold background */
    border: 1px solid rgba(255, 215, 0, 0.4); /* Yellow/gold border */
    color: #ffd700; /* Yellow/gold text */
    padding: 1rem 1.5rem;
    margin: 1rem 0 2rem 0; /* Add some vertical margin */
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notice-box strong {
    color: #fff; /* Make "Please Note:" stand out more */
}

.title-block {
    /* Takes available space pushing logo container right because of justify-content: space-between on parent */
    flex-grow: 1;
}

/* Style for the small logo image itself */
#header-tier-logo {
    width: 33px; /* Increased size by ~30% */
    height: auto;
    display: block; /* Prevents extra space below */
}

/* Show the small logo when header is scrolled */
.header.scrolled #header-tier-logo-container {
    opacity: 1;
    pointer-events: auto;
    margin-top: 1rem;
}
/* From backup/2025-04-30-0328/style.css */

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@media (prefers-reduced-motion: no-preference) {
    h1 {
        background-size: 200% auto;
        animation: titleGlow 5s ease-in-out infinite alternate,
                   gradientFlow 20s ease infinite;
    }
}

/* Hide specific UI elements */
#estimatedTime,
#loadingIndicator .eta-display,
#consoleToggle {
    display: none !important; /* Hide estimate, ETA, and console toggle */
}

#resultGraphContainer {
    margin-top: 2rem;
    padding: 0; 
    border: none; 
    box-shadow: none; 
    height: auto; /* <<< Ensure height is auto to allow expansion */
}

.spread-results {
    font-family: 'Consolas', monospace;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0 0.5rem 0; /* Reduced bottom margin */
    white-space: pre; /* Keep pre to respect newlines */
    line-height: 1.5;
    border: 1px solid var(--border-color);
    display: inline-block; /* Revert to inline-block */
    max-width: 100%; /* Prevent overflow if content is very wide */
    min-width: 350px; /* Keep the minimum width */
}

/* Specific graph container heights */
#probabilityGraphContainer .graph-container {
    height: 600px; /* Adjusted height */
}
#riskToleranceSection .graph-container {
    height: 450px; /* Reduced height */
}

/* Add this class dynamically */
.container.has-content {
    min-height: calc(100vh - 7rem);
}

#resultGraphContainer .chart-container {
    height: 80vh; /* Set height relative to viewport height */
    /* aspect-ratio: 1 / 1; Removed fixed aspect ratio */
    background-color: transparent; /* Explicitly set to transparent */
    max-height: none; /* REMOVED max-height constraint */
    padding: 0rem;
    border-radius: 8px;
}

/* NEW rule for BS Table container */
.bs-table-container {
    background-color: transparent !important; /* Make background transparent */
    padding: 0.5rem;
    border-radius: 8px;
    margin: 1.5rem 0 100px 0;
    overflow: auto;
    height: auto;
    max-height: none;
}

/* Ensure the table itself can cause overflow */
#bsChartContainer table,
#bsChartContainerBasic table {
    width: 100%;
    border-collapse: collapse;
    background-color: transparent !important;
}

/* Styles for value glow effect */
.value-glow {
    /* Base styles if needed, e.g., display: inline-block; */
    /* but text-shadow should work on inline spans */
    position: relative; /* Helps some browsers render shadow consistently */
}

.value-glow.positive {
    /* Cyan glow - using accent-secondary */
    /* text-shadow: 0 0 8px rgba(0, 206, 201, 0.6); */
    text-shadow: 0 0 20px rgba(0, 206, 201, 1); /* Increased blur radius */
}

.value-glow.negative {
    /* Red glow - using danger color */
    /* text-shadow: 0 0 8px rgba(255, 118, 117, 0.7); */
    text-shadow: 0 0 20px rgba(255, 118, 117, 1); /* Increased blur radius */
}

.value-glow.zero {
    /* White/grey glow */
    /* text-shadow: 0 0 7px rgba(224, 224, 224, 0.5); */
    text-shadow: 0 0 20px rgba(224, 224, 224, 1); /* Increased blur radius */
}

/* Mode Selector Styles */
.mode-selector-container {
    display: flex;
    justify-content: space-between; /* SPREAD OUT buttons */
    padding: 1rem 20%; /* Space above/below AND 10% left/right padding */
    margin-top: 7rem; /* Push below fixed header */
    position: relative; /* Keep in flow but allow z-index if needed */
    z-index: 5; /* Ensure it's above the background pulse */
}

/* Wrapper for each mode button */
.mode-button-wrapper {
    position: relative; /* For tooltip positioning */
}

.mode-button-wrapper.has-sub-options {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.mode-button-wrapper.has-sub-options .mode-button {
    width: 100%;
}

.mode-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: var(--input-bg); /* Whitish-grey */
    color: var(--text-secondary); /* Grey text */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    box-shadow: none; /* Default no glow */
}

/* Sub-mode buttons (Single/Multi for Max Min) */
.sub-mode-buttons {
    display: flex;
    width: 100%;
    margin-top: 0;
}

.sub-mode-button {
    flex: 1;
    padding: 0.2rem 0;
    font-size: 0.7rem;
    font-weight: 500;
    background-color: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid #333;
    border-top: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Remove double border between buttons and set border radius */
.sub-mode-button:first-child {
    border-radius: 0 0 0 6px;
    border-right: 1px solid #333;
}

.sub-mode-button:last-child {
    border-radius: 0 0 6px 0;
    border-left: none;
}

.sub-mode-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.sub-mode-button.active {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Remove bottom border-radius from Max Min button when sub-buttons are visible */
#mode-max-min.has-sub-buttons {
    border-radius: 6px 6px 0 0;
}

/* Visual styling for disabled mode buttons */
.mode-button-wrapper.disabled-mode .mode-button {
    opacity: 0.6;
    cursor: not-allowed;
    /* No pointer-events: none needed here, hover is on wrapper */
}

/* Don't apply hover effect to the button itself if disabled */
.mode-button-wrapper.disabled-mode .mode-button:hover {
    background-color: var(--input-bg); /* Keep original background */
    color: var(--text-secondary); /* Keep original text color */
    /* Prevent transform */
    transform: none; 
}

.mode-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 0 12px 1px rgba(224, 224, 224, 0.4); 
}

/* Styles for the disabled tooltip */
.disabled-tooltip {
    visibility: hidden; /* Use visibility + opacity for transition */
    opacity: 0;
    position: absolute;
    bottom: 110%; /* Position above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(45, 45, 45, 0.9); /* Dark semi-transparent background */
    color: #ffd700; /* Yellow text */
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10; /* Ensure tooltip is above button */
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    pointer-events: none; /* Prevent tooltip from stealing hover */
}

/* Show tooltip on wrapper hover (also show for non-disabled wrappers like MaxMin) */
.mode-button-wrapper.disabled-mode:hover .disabled-tooltip,
.mode-button-wrapper:hover .disabled-tooltip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Re-add the active button style with glow */
.mode-button.active {
    background-color: var(--bg-secondary); /* Slightly different active background */
    color: var(--text-primary);
    border-color: var(--text-secondary); 
    /* Whitish-grey glow */
    box-shadow: 0 0 12px 1px rgba(224, 224, 224, 0.4); 
}

/* Style for preset risk section */
.preset-section {
    margin-top: 0.5rem; /* Small gap below canvas */
    /*margin-bottom: 50rem;*/ /* INCREASED Space below presets before search params */
    text-align: left; /* Align label and buttons left */
}

.preset-label {
    display: block; /* Label on its own line */
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Style for preset risk buttons container */
.preset-risk-buttons {
    display: flex;
    justify-content: flex-start; 
    gap: 0.5rem; /* REDUCED gap */
    /*margin-bottom: 500px;*/ /* INCREASED Space below presets before search params */
}

.preset-button {
    padding: 0.3rem 0.6rem; /* Reduced padding */
    font-size: 0.8rem; /* Reduced font size */
    /* background-color: var(--input-bg); REMOVED solid background */
    background-color: rgba(45, 45, 45, 0.6); /* Use rgba for transparency (from #2d2d2d) */
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    background-image: none; /* <<< Explicitly no background image by default */
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; /* Specify transitions */
}

/* Remove generic hover background change */
/*
.preset-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
*/

/* Specific hover gradients */
#preset-high-risk:hover {
    /* Red to Yellow (less saturated) */
    background-image: linear-gradient(to top right, #d84444, #d4b000);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #d8444400;
}
#preset-medium-risk:hover {
    /* Orange to Light Grey (less saturated) */
    background-image: linear-gradient(to top right, #cc8400, #cccccc);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #cc850000;
}
#preset-low-risk:hover {
    /* Yellow to Light Green (less saturated) */
    background-image: linear-gradient(to top right, #d4b000, #7fbc7f);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #d4b10000;
}
#preset-insurance:hover, 
#preset-no-loss:hover { 
    /* Light Yellow - White - Light Green */
    background-image: linear-gradient(to top right, #ffffcc, #ffffff, #ccffcc);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: #333; /* Darker text for light gradient */
    border-color: #cccccc00;
}
#preset-no-brainer:hover {
    /* Light Green to Dark Green (less saturated) */
    background-image: linear-gradient(to top right, #7fbc7f, #004d00);
    background-color: transparent; /* <<< Ensure solid color is removed */
    color: var(--text-primary); /* Standard hover text color */
    border-color: #7fbc7f00;
}

/* Spread Section Styles REMOVED */

/* ... rest of css ... */

/* NEW Spread Selector Grid Styles */
#spreadSectionBasic {
    margin-top: 2rem;
    margin-bottom: 3rem;
    padding: 0 2rem; /* Horizontal padding */
}

#spreadGridBasic {
    background-color: transparent; /* Transparent background */
    width: 100%;
    margin-top: 1rem;
}

.spread-grid-row {
    display: flex;
    gap: 1rem; /* Gap between columns */
    align-items: center; /* Vertically center items in the row */
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.5rem; /* Space between rows */
}

.spread-grid-header {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem; /* More space below header */
}

.grid-col {
    box-sizing: border-box;
    display: flex;
    align-items: center; /* Center content vertically */
}

/* Column Widths (adjust as needed) */
.grid-col-longshort { width: 15%; } /* New column */
.grid-col-alloc  { width: 15%; /* text-align: right; REMOVED */ } /* Wider Allocation */
.grid-col-type   { width: 20%; } /* Wider Type */
.grid-col-strike { width: 20%; } /* Wider Strike */
.grid-col-price  { width: 15%; } /* Wider Price */
.grid-col-action { width: 10%; justify-content: center; } /* Center action items */

/* Style for the calculate button section */
.spread-calculate-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column; /* Stack button and message */
    align-items: flex-start; /* Align items left */
    gap: 0.5rem; /* Space between button and message */
}

/* Style for the validation message */
.spread-validation-message {
    color: #ffd700; /* Yellow */
    font-size: 0.9rem;
    /* display: none; /* Controlled by JS */
}

/* Style for disabled short option (title attribute handles tooltip) */
select.long-short-select option[value="short"]:disabled {
    color: #888; /* Grey out text */
    cursor: not-allowed;
    /* Background changes might not work consistently across browsers for disabled options */
}

.spread-grid-header .header-label {
    width: 100%;
    text-align: left; /* Ensure all headers are left-aligned */
    white-space: nowrap;
}

/* REMOVED specific alignment for allocation header */

/* Add button specific row styling */
.spread-add-row {
    justify-content: flex-start; /* Align button to the left */
    margin-top: 0.5rem;
}

.add-spread-leg-btn {
    background-color: rgba(0, 184, 148, 0.15); /* Transparent greenish */
    color: var(--accent-primary);
    border: 1px dashed var(--accent-primary); /* Dashed border */
    border-radius: 50%; /* Make it round */
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 1.2rem; /* Larger plus sign */
    line-height: 28px; /* Center plus sign vertically */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.add-spread-leg-btn:hover {
    background-color: rgba(0, 184, 148, 0.3); /* More opaque green */
    color: #aaffec;
    border-color: var(--accent-secondary);
    transform: scale(1.05);
}

.add-spread-leg-btn:active {
    transform: scale(0.98);
}

/* NEW Style for Remove Button */
.remove-spread-leg-btn {
    background-color: rgba(255, 118, 117, 0.15); /* Transparent reddish */
    color: var(--danger);
    border: 1px dashed var(--danger);
    border-radius: 50%; /* Make it round */
    width: 26px; /* Slightly smaller than add */
    height: 26px;
    padding: 0;
    font-size: 1rem; /* Slightly smaller minus */
    line-height: 24px; /* Adjust line height */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.remove-spread-leg-btn:hover {
    background-color: rgba(255, 118, 117, 0.3);
    color: #ffcccc;
    border-color: #ff4d4d;
    transform: scale(1.05);
}

.remove-spread-leg-btn:active {
    transform: scale(0.98);
}

/* Container for dynamically added legs */
#spread-legs-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Consistent gap with rows */
}

/* Input styling within the grid */
.spread-leg-input {
    width: 100%;
    height: 36px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.spread-leg-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #333; /* Darker disabled background */
}

/* Remove spinner buttons for number inputs */
.percentage-input::-webkit-outer-spin-button,
.percentage-input::-webkit-inner-spin-button,
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.percentage-input[type=number],
.price-input[type=number] {
  -moz-appearance: textfield;
}

/* Style for price reset button */
.price-reset-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 5px; /* Space it from input */
    font-size: 12px;
    line-height: 18px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    display: none; /* Hidden by default */
    transition: background-color 0.2s, color 0.2s;
}

.price-reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

/* --- End NEW Spread Selector Grid Styles --- */

/* Add padding to body bottom */
body {
    /* ... existing body styles ... */
    padding-bottom: 30vh; /* Add significant padding to the bottom */
}

/* NEW: Container for price input + reset button */
.price-input-container {
    position: relative; /* Allows absolute positioning for button */
    display: flex; /* Aligns items */
    align-items: center; /* Vertical alignment */
    width: 100%;
}

.price-input {
    /* Price input takes most space, but leaves room for button */
    flex-grow: 1;
    padding-right: 25px !important; /* Ensure space for button */
    /* Inherit other styles from .spread-leg-input */
}

.spread-leg-input:disabled {
    opacity: 0.5;
}

/* Style for the new status message */
.calculation-status {
    display: none; /* Hidden by default */
    color: #ffd700; /* Yellow text */
    font-size: 0.9rem;
    margin-left: 1rem; /* Space between button and message */
    font-style: italic;
}

/* NEW: Container for price input + reset button */
.price-input-container {
    position: relative; /* Allows absolute positioning for button */
}

/* Ensure the tooltip shows on hover of the CONTAINER (label wrapper) */
.toggle-container.disabled-mode:hover .disabled-tooltip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* <<< Add pointer-events: none to label when disabled >>> */
.toggle-container.disabled-mode .toggle-label {
    pointer-events: none;
}

/* Position the tooltip relative to the toggle container */

#bsChartContainerBasic table {
    width: 100%;
    border-collapse: collapse;
}

#bsChartContainerBasic td {
    border: 1px solid var(--border-color);
}

/* === Basic Calculation: Performance chart height === */
#resultChartBasicContainer.chart-container,
#resultChartBasicContainer {
    min-height: 1200px !important; /* 300% of 600px = 1800px */
}

/* Adjust inner canvas to take full height */
#resultChartBasic {
    height: 100% !important;
}

/* Ensure donation sections are at the bottom of results */
#resultGraphContainer .donation-section, 
#resultContainerBasic .donation-section {
    margin-top: 4rem;
    margin-bottom: 0;
    padding-bottom: 4rem;
    position: relative;
    z-index: 2;
}

/* Force result containers to be at bottom of page */
#resultContainerBasic,
#resultGraphContainer {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Fix container padding to ensure no extra space */
.container {
    padding-bottom: 0;
}

/* Force donation sections to be at the very bottom of the page */
.donation-section {
    position: relative;
    margin-top: 4rem;
    margin-bottom: 0;
    padding-bottom: 2rem;
    clear: both;
    background-color: transparent !important;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Ensure content containers have no margin/padding at bottom */
#resultContainerBasic,
#resultGraphContainer,
.container,
body,
#mainContainer,
#mainContainerBasic {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Add space at bottom of main section to ensure donation button is visible */
.donation-section:after {
    content: '';
    display: block;
    height: 10px;
    width: 100%;
    clear: both;
}

/* Clear all floats */
.donation-section {
    clear: both;
}

/* Hide any content that might appear after donation section */
.donation-section ~ *:not(script):not(style) {
    display: none !important;
}

/* === ADDED: Bottom Spacing for Search Parameters === */
#searchParametersSection.needs-bottom-space {
    margin-bottom: 50vh; /* Add significant space below */
    transition: margin-bottom 0.5s ease-in-out; /* Smooth transition */
}
#searchParametersSection {
     transition: margin-bottom 0.5s ease-in-out; /* Ensure transition applies when class is removed */
}

/* === Improvement: keep loading indicator just below Calculate button === */
#searchParametersSection #loadingIndicator {
    margin-top: 1rem;
}

/* --- Credit Display Adjustments (Corrected) --- */

/* Ensure the main container stacks Subscription link and the row below */
#tier-info-container {
    /* position, top, right, z-index, opacity, transition remain */
    display: flex;
    flex-direction: column; /* STACK subscription + row */
    align-items: flex-end;  /* Align content to the right */
    gap: 2px; /* Small gap between subscription and row */
}

/* Style the new row holding credit, logo, tier text */
.credit-logo-tier-row {
    display: flex;
    align-items: center; /* Vertically align items in the row */
    gap: 8px; /* Space between credit and logo-row */
    width: 100%; /* Allow it to take width needed */
    justify-content: flex-end; /* Align content right */
}

/* Adjust subscription label display */
#subscription-label {
    display: block;
    text-align: right;
    margin-bottom: 2px;
}

/* Credit display within the horizontal row */
#credit-display {
    /* Styles inherited from .tier-text */
    color: var(--accent-primary); /* Specific color */
    /* Ensure no conflicting positioning */
    position: static;
    margin: 0; /* Reset margins */
    margin-top: 0.5rem;
}

/* Original logo-text row */
.logo-text-row {
    /* Keep internal flex */
    display: flex;
    align-items: center;
    gap: 0px;
    /* Remove any conflicting positioning */
    position: static;
    top: auto;
    align-self: auto;
}

/* --- Scrolled State Controls (Keep as previously added) --- */
#scrolled-controls-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 1rem;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    z-index: 1002;
}

.header.scrolled #scrolled-controls-container {
    display: flex !important; /* Show when scrolled (Forced) */
}

#scrolled-controls-container .fullscreen-toggle {
    position: static;
    margin: 0;
    padding: 2px 4px;
    font-size: 0.75rem;
}

#scrolled-credit-display {
    font-size: 0.75rem;
    text-align: right;
    color: var(--accent-primary);
    display: block; /* Ensure it's visible */
}

/* --- Ensure tier info container fades out properly when scrolled --- */
.header.scrolled #tier-info-container {
    opacity: 0;
    pointer-events: none;
}

/* --- Fullscreen Toggle Positioning --- */
/* REMOVE any 'position: fixed', 'top', 'right' from the main .fullscreen-toggle rule */
/* It should only define background, padding, font-size etc. */
/* The positioning is now handled by #scrolled-controls-container */
/* or its default placement if the header isn't scrolled */

/* Gemini Chat Styles */
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    color: var(--text-secondary);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--accent-primary);
}

.form-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
    width: 100% !important; /* Override potential global widths */
    min-width: unset !important;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 184, 148, 0.2);
}

.login-submit-btn {
    width: 100%;
    margin-top: 1rem;
    font-weight: 600;
}

.modal-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* Subscription Matrix in sub.html */
.tier-matrix {
    display: grid;
    grid-template-columns: 320px repeat(4, 1.2fr 0.8fr); /* Feature and API columns grouped */
    width: 100%;
    margin-top: 2rem;
    /* background-color: rgba(255, 255, 255, 0.02); REMOVED - avoid global background */
    border-radius: 12px;
    /* overflow: hidden; REMOVED to allow border-right separation */
}

.tier-matrix-header {
    display: contents;
}

.header-cell {
    padding: 1rem 0.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-align: center;
    background-color: rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.super-header-cell {
    padding: 1.2rem 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    background-color: rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Separation logic */
.tier-matrix .super-header-cell:first-child,
.tier-matrix .header-cell:first-child,
.tier-matrix .tier-info-cell {
    border-right: 1px dashed rgba(255, 255, 255, 0.2);
    background-color: transparent !important;
}

/* Feature columns background */
.super-header-cell:nth-child(2),
.header-cell:not(:first-child),
.cell:not(:first-child) {
    background-color: rgba(255, 255, 255, 0.02);
}

.tier-matrix-row {
    display: contents;
}

.tier-matrix-row:hover .cell:not(.tier-info-cell) {
    background-color: rgba(255, 255, 255, 0.04);
}

.cell {
    padding: 1.2rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    gap: 0.15rem;
}

.tier-info-cell {
    flex-direction: row !important; /* Keep logo and text horizontal */
    justify-content: flex-start;
    gap: 1.2rem;
    padding-left: 1.5rem;
}

.cell-subtext {
    font-size: 0.75rem; /* Increased from 0.6rem */
    color: var(--text-secondary);
    opacity: 0.8; /* Increased opacity slightly */
    text-align: center;
    line-height: 1.1;
    max-width: 100px;
}

.tier-info-cell {
    justify-content: flex-start;
    gap: 1.2rem;
    padding-left: 1.5rem;
}

.tier-info-cell img {
    width: 80px !important; /* Bigger GIFs as requested */
    height: auto;
    border-radius: 8px;
    box-shadow: none !important; /* Remove any shadow/tile effect */
}

.tier-cell-name {
    display: flex;
    flex-direction: column;
}

.tier-cell-title {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.tier-cell-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkmark {
    color: #00b894;
    font-size: 1.2rem;
    font-weight: bold;
}

.cross {
    color: var(--text-secondary);
    opacity: 0.2;
    font-size: 1.1rem;
}

@media (max-width: 1400px) {
    .tier-matrix {
        grid-template-columns: 280px repeat(4, 1.2fr 0.8fr);
    }
}

@media (max-width: 1200px) {
    .tier-matrix {
        grid-template-columns: 240px repeat(4, 1.2fr 0.8fr);
    }
    .header-cell {
        font-size: 0.75rem;
    }
}

@media (max-width: 992px) {
    .tier-matrix {
        display: block;
        overflow-x: auto;
    }
    .tier-matrix-header, .tier-matrix-row, .tier-matrix-super-header {
        display: flex;
        width: max-content;
        min-width: 100%;
    }
    .header-cell, .cell, .super-header-cell {
        width: 100px;
        flex-shrink: 0;
    }
    .tier-info-cell, .super-header-cell:first-child {
        width: 240px;
    }
    .super-header-cell:last-child {
        width: calc(100px * 8);
    }
}

/* Cost Modal Styles */
.cost-modal-content {
    max-width: 800px !important;
}

.cost-table {
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.cost-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.cost-row:last-child {
    border-bottom: none;
}

.cost-row.header-row {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--accent-primary);
}

.cost-col {
    padding: 1rem;
    display: flex;
    align-items: center;
}

.feature-col {
    flex: 1.2;
    border-right: 1px solid var(--border-color);
}

.pricing-col {
    flex: 1.5;
    border-right: 1px solid var(--border-color);
}

.api-col {
    flex: 1.5;
}

.cost-trigger {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.5rem;
}

.cost-trigger:hover {
    text-decoration: underline;
}

/* Signup Page Specific Styles */
.signup-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.signup-form-container {
    max-width: 700px !important;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-row .form-group {
    flex: 1;
}

.subscription-matrix {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tier-row-container {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.tier-row-container:has(input:checked) {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.tier-row-main {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.tier-identity {
    display: flex;
    flex-direction: row; /* Horizontal for icon + name */
    align-items: center;
    gap: 0.75rem;
    min-width: 160px; /* Increased for icon + name */
    padding-top: 0.5rem;
}

.tier-mini-icon {
    width: 32px;
    height: auto;
    border-radius: 4px;
}

.tier-name {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 1rem;
    white-space: nowrap;
}

.api-selection-area {
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 0.5rem;
    flex-grow: 1;
}

.api-radio-option {
    cursor: pointer;
    width: 100%;
}

.api-radio-option input {
    display: none;
}

.api-row-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.api-chip {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.api-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.api-radio-option:hover .api-row-content {
    border-color: var(--text-secondary);
}

.api-radio-option input:checked + .api-row-content {
    background-color: rgba(0, 184, 148, 0.1);
    border-color: var(--accent-primary);
}

.api-radio-option input:checked + .api-row-content .api-chip,
.api-radio-option input:checked + .api-row-content .api-price {
    color: var(--text-primary);
    font-weight: 600;
}

/* Signup Preview Area */
.signup-tier-preview {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    background-color: rgba(0, 184, 148, 0.05);
    border: 1px dashed var(--accent-primary);
    border-radius: 12px;
}

.preview-card {
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 400px;
}

.preview-left {
    flex-shrink: 0;
}

.preview-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    flex-grow: 1;
}

#final-tier-animation {
    width: 100px;
    height: auto;
}

.preview-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

#preview-tier-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

#preview-api-text {
    font-size: 0.95rem;
    color: var(--accent-primary);
    font-family: monospace;
}

.preview-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 0.5rem;
    max-width: 300px;
}

.preview-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

/* Payment Section Styles */
.payment-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: modalAppear 0.3s ease-out;
}

.payment-header {
    margin-bottom: 1rem;
}

.payment-header label {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.stripe-mock-container {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.stripe-mock-tab {
    padding: 1rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stripe-mock-tab.active {
    background-color: transparent;
    border-left: 2px solid #0070ba; /* Stripe Blue */
    color: #0070ba;
}

.tab-icon { font-size: 1.1rem; }
.tab-text { font-weight: 600; font-size: 0.95rem; }

.stripe-mock-form-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stripe-link-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: rgba(0, 184, 148, 0.05);
    border: 1px solid rgba(0, 184, 148, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.link-lock { color: #00b894; }
.link-arrow { margin-left: auto; font-size: 0.7rem; opacity: 0.5; }

.mock-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mock-field-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.mock-input-wrapper {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mock-input-text {
    color: var(--text-primary);
    font-family: 'Courier Prime', monospace;
    font-size: 1rem;
    opacity: 0.6;
}

.mock-card-logos {
    display: flex;
    gap: 0.5rem;
}

.mock-card-logos img {
    height: 20px;
    width: auto;
    filter: grayscale(0.2);
}

.mock-field-row {
    display: flex;
    gap: 1.5rem;
}

.mock-field-row .mock-field-group {
    flex: 1;
}

.cvc-icon { opacity: 0.4; }

.mock-input-wrapper.select {
    cursor: pointer;
}

.select-arrow { font-size: 0.7rem; opacity: 0.5; }

.stripe-other-method {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.stripe-other-method:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.method-icon {
    height: 18px;
    width: auto;
}

.method-icon.klarna { height: 14px; }
.method-icon.affirm { 
    width: 24px; 
    height: 24px; 
    background: #000; 
    color: white; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 12px;
}

.method-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.card-errors {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
    text-align: center;
}


/* Payment Section Styles */
.payment-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: modalAppear 0.3s ease-out;
}

.payment-header {
    margin-bottom: 1rem;
}

.payment-header label {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.payment-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stripe-placeholder {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stripe-placeholder:hover {
    border-color: var(--text-secondary);
}

.stripe-mock-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.mock-input-row {
    display: flex;
    width: 100%;
}

.mock-input-row.split {
    gap: 1.5rem;
}

.mock-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.mock-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.mock-value {
    color: var(--text-primary);
    font-family: 'Courier Prime', monospace;
    font-size: 1.1rem;
    letter-spacing: 1px;
    opacity: 0.6;
}

.card-errors {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    min-height: 1.2em;
}

.subscription-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.subscription-note {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
    font-style: italic;
    background-color: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 4px 4px 0;
}

@media (max-width: 600px) {
    .tier-row-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .tier-identity {
        flex-direction: row;
        min-width: auto;
    }
}

#gemini-logo-container {
    position: fixed;
    top: 15%; /* Changed from 25% */
    right: 2rem;
    z-index: 1005; /* Ensure it's above most content */
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

#gemini-logo-container:hover {
    transform: scale(1.1);
}

#gemini-logo-icon {
    width: 50px; /* Adjust size as needed */
    height: 50px;
    border-radius: 50%; /* Make it circular */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background-color: var(--bg-secondary); /* Optional: background for the logo */
    padding: 5px; /* Optional: padding around the logo image */
    object-fit: contain; /* Ensure image aspect ratio is maintained */
    box-sizing: border-box; /* Explicitly set box-sizing */
}

#gemini-chat-window {
    position: fixed;
    /* Adjusted to be right under the logo container, now at 10% */
    top: calc(15% + 60px); /* 10% from top (logo's top) + logo height (50px) + some spacing (10px) */
    right: 2rem;
    width: 320px;
    height: 450px;
    background-color: rgba(26, 26, 26, 0.9); /* var(--bg-primary) with transparency */
    border: 1px solid var(--border-color);
    border-radius: 16px; /* More rounded corners */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 1004;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform-origin: bottom right;
}

#gemini-chat-window.visible {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

#gemini-chat-window:not(.visible) {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

#gemini-chat-header {
    background-color: transparent; /* Make header transparent */
    padding: 0; /* Remove padding */
    display: flex;
    justify-content: flex-end;
    align-items: flex-start; /* Align close button to the top */
    border-bottom: none; /* Remove border */
    color: var(--text-primary);
    min-height: auto;
    height: 20px; /* Minimal height, adjust as needed or make 0 if button is fully absolute */
    position: relative; /* Needed for absolute positioning of the child button */
}

#gemini-chat-close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: absolute; /* Position absolutely within the chat window */
    top: 0.5rem;        /* Adjust as needed */
    right: 0.75rem;       /* Adjust as needed */
    z-index: 10;       /* Ensure it's above messages */
}

#gemini-chat-close-btn:hover {
    color: var(--text-primary);
}

#gemini-chat-messages {
    flex-grow: 1;
    padding: 1rem;
    /* Add padding to the top to prevent messages from going under the absolute positioned close button */
    padding-top: 2.5rem; 
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Custom scrollbar for chat messages */
    scrollbar-width: thin;
    scrollbar-color: #5470ca var(--bg-secondary); /* Updated thumb color */
}

#gemini-chat-messages::-webkit-scrollbar {
    width: 8px;
}

#gemini-chat-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

#gemini-chat-messages::-webkit-scrollbar-thumb {
    background-color: #5470ca; /* Updated thumb color */
    border-radius: 4px;
    border: 2px solid var(--bg-secondary);
}

.gemini-message {
    align-self: flex-end; /* Gemini messages on the right */
    background-image: linear-gradient(to right, #8A2BE2, #4169E1); /* Purple to Blue gradient */
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 90%;
    word-wrap: break-word;
}

.user-message {
    align-self: flex-start; /* User messages on the left */
    background-color: #5470ca; /* Greyish blue */
    color: var(--text-primary); /* Adjusted for better contrast if needed */
    border-radius: 6px; /* Standard border-radius */
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 90%;
    word-wrap: break-word;
}

#gemini-chat-input-container {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary); /* Match window background */
}

#gemini-chat-input {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

#gemini-chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 184, 148, 0.2);
}

#gemini-chat-send-btn {
    background-color: #5470ca; /* Greyish blue */
    color: var(--text-primary); /* Adjusted for better contrast */
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

#gemini-chat-send-btn:hover {
    background-color: #546E7A; /* Darker greyish blue for hover */
}

/* --- Official Stripe Payment Element Styles --- */

/* Container for the Stripe Payment Element */
#payment-element {
    min-height: 200px;
    border-radius: 8px;
}

/* High-Fidelity Stripe Element Mockup */
.stripe-element-mockup {
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.stripe-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.stripe-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #a0a0a0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

.stripe-tab.active {
    color: #0570de;
    border-bottom-color: #0570de;
    background-color: rgba(5, 112, 222, 0.05);
}

.stripe-tab svg {
    opacity: 0.8;
}

.stripe-link-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px;
    padding: 12px 14px;
    background-color: rgba(0, 184, 148, 0.08);
    border: 1px solid rgba(0, 184, 148, 0.25);
    border-radius: 6px;
    font-size: 13px;
    color: #e0e0e0;
}

.stripe-link-auth strong {
    color: #00b894;
}

.stripe-link-auth .chevron {
    margin-left: auto;
    opacity: 0.5;
}

.stripe-form-fields {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stripe-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stripe-field label {
    font-size: 13px;
    font-weight: 500;
    color: #a0a0a0;
}

.stripe-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px 14px;
    transition: all 0.15s ease;
}

.stripe-input:hover {
    border-color: #666;
}

.stripe-input:focus-within {
    border-color: #0570de;
    box-shadow: 0 0 0 3px rgba(5, 112, 222, 0.15);
}

.stripe-input .placeholder-text {
    color: #666;
    font-size: 14px;
    font-family: inherit;
}

.stripe-input .card-brands {
    display: flex;
    gap: 4px;
    align-items: center;
}

.stripe-input .card-brands img {
    height: 18px;
    opacity: 0.7;
}

.stripe-field-row {
    display: flex;
    gap: 12px;
}

.stripe-field-row .stripe-field {
    flex: 1;
}

.stripe-input .cvc-hint {
    opacity: 0.4;
}

.stripe-input.stripe-select {
    cursor: pointer;
}

.stripe-input .selected-value {
    color: #e0e0e0;
    font-size: 14px;
}

.stripe-input .select-chevron {
    opacity: 0.5;
}

.stripe-alt-methods {
    border-top: 1px solid #333;
}

.stripe-alt-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.stripe-alt-method:last-child {
    border-bottom: none;
}

.stripe-alt-method:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.stripe-alt-method span {
    font-size: 14px;
    font-weight: 500;
    color: #a0a0a0;
}

.stripe-alt-method .klarna-logo {
    font-size: 16px;
    font-weight: 700;
    color: #ffb3c7;
    letter-spacing: -0.5px;
}

.stripe-mockup-notice {
    padding: 10px 16px;
    background-color: rgba(255, 193, 7, 0.1);
    border-top: 1px solid rgba(255, 193, 7, 0.2);
    text-align: center;
}

.stripe-mockup-notice span {
    font-size: 11px;
    color: #ffc107;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stripe pending notice (shown when backend clientSecret not yet available) */
.stripe-pending-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.stripe-pending-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.stripe-pending-notice p {
    margin: 0.25rem 0;
}

.stripe-pending-notice strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.stripe-pending-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem !important;
}

.stripe-pending-subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    max-width: 350px;
    line-height: 1.4;
    margin-top: 0.75rem !important;
}

.payment-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.card-errors {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
    text-align: center;
}

