/* ================= RESET & BASE ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    color: #2c3e50;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ================= HEADER & LOGO ================= */
header {
    flex: 0 0 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3%;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    height: 45px;
    width: auto;
}

.brand-name {
    font-weight: 800;
    font-size: 1.6rem;
    color: #2c3e50;
    letter-spacing: -0.5px;
}

/* ================= ADS ================= */
.ad-text {
    color: #adb5bd;
    font-weight: 500;
    letter-spacing: 1px;
}

.ad-banner-top {
    width: 728px;
    height: 90px;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.ad-sidebar-left {
    width: 250px;
    height: 100%;
    max-height: 600px;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.bottom-banner-container {
    flex: 0 0 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-top: 1px solid #e9ecef;
}

.ad-banner-bottom {
    width: 728px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================= MAIN GRID ================= */
.main-grid {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3%;
    gap: 2rem;
    min-height: 0;
}

/* ================= TABLET CONTAINER ================= */
.tablet-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    /* ADD THIS LINE: */
    min-width: 0;
    /* This allows the container to shrink below its content size, stopping the stretch bug. */
}

/* THE BEZEL */
/* FIX 2: Lock the Tablet Size (Prevent Expansion) */
.tablet-bezel {
    position: relative;
    background-color: #2c3e50;
    border-radius: 36px;
    padding: 15px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 92%;
    max-width: 1100px;
    height: 75vh;
    min-height: 600px;
    max-height: 800px !important;
    /* Force a hard limit */
    overflow: hidden !important;
    /* Cut off anything that tries to push out */
    display: flex;
    flex-direction: column;
}

/* THE SCREEN */
.tablet-screen {
    flex: 1;
    /* Take up available space but don't exceed parent */
    height: 100%;
    overflow: hidden;
    /* Internal scroll only */
    position: relative;
    background-color: #f8f9fa;
    /* Light Grey */
    border-radius: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ================= THE WINDOW (Scroll Container) ================= */
/* ZERO PADDING = NO WHITE BORDERS */
#screen-scroll-container {
    flex: 1;
    padding: 0 !important;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#screen-scroll-container::-webkit-scrollbar {
    width: 8px;
}

#screen-scroll-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 10px;
}

/* ================= THE SPACER (Headroom Fix) ================= */
.scroll-spacer {
    width: 100%;
    min-height: 85px;
    flex-shrink: 0;
}

/* ================= UNIVERSAL APP CARD STYLING ================= */
/* This forces every single app to be the same size */
#input-screen,
#results-screen,
#app-binomial,
#app-geometric,
#app-poisson,
#app-bernoulli,
.detail-view {
    width: 95%;
    max-width: 850px;
    margin: 0 auto;
    padding-bottom: 50px;
    margin-top: 0 !important;
    padding-top: 0 !important;
    display: block;
    box-sizing: border-box;
}

/* ================= CALCULATOR UI ================= */
.calculator-body h3 {
    font-weight: 700;
    color: #34495e;
    margin-bottom: 1rem;
    text-align: center;
}

.subtext {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
    text-align: center;
}

.calc-section,
.result-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    position: relative;
    /* Necessary for absolute positioning inside */
}

.calc-section.no-bg {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.formula-header {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #34495e;
    font-size: 1.1rem;
    background: #ebf5fb;
    padding: 1rem;
    border-radius: 8px;
}

/* Inputs */
.input-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    justify-content: center;
    margin-top: 0.5rem;
    /* Add a little space if needed */
    padding-right: 20px;
    /* Safety buffer for toggle */
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    max-width: 120px;
}

.input-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group input {
    padding: 0.75rem;
    border: 2px solid #dfe4ea;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
}

/* Buttons */
.secondary-btn {
    padding: 0.75rem 1.5rem;
    background: #bdc3c7;
    color: #2c3e50;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    height: 46px;
}

.secondary-btn:hover {
    background: #aeb6bf;
}

.history-btn {
    /* REMOVED: font-size: 1.2rem; -> Now it matches "Generate" */
    min-width: 80px;
    /* Ensure it's wide enough for text */
    padding: 0.75rem 1rem;
    /* Match standard padding */
}

.primary-action-btn {
    width: 100%;
    padding: 1.25rem;
    background: #bdc3c7;
    color: #2c3e50;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
}

.primary-action-btn:hover {
    background: #95a5a6;
    color: white;
}

/* ================= RESULTS MENU GRID ================= */
.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    padding: 0 1rem;
}

.app-card {
    background: white;
    padding: 1.2rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f3f5;
    transition: all 0.2s ease;
    aspect-ratio: 1.4/1;
}

.app-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(41, 128, 185, 0.12);
    border-color: #d6eaf8;
}

.icon-box svg {
    width: 32px;
    height: 32px;
    stroke: #3498db;
    stroke-width: 2px;
}

.app-card span {
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.2;
}

.nav-back-btn {
    align-self: flex-start;
    background: transparent;
    border: 1px solid #dfe4ea;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-back-btn:hover {
    background: #f1f3f5;
    color: #2c3e50;
}

/* ================= TABLES & GRAPHS ================= */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.results-table th,
.results-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.results-table thead {
    background: #3498db;
    color: white;
}

/* FIX 1: Prevent Graph from cutting off or expanding the tablet */
.histogram-container {
    display: flex;
    justify-content: flex-start;
    /* Fallback for very old browsers */
    justify-content: safe center;
    /* The modern fix: Centers safely without cutoff */
    align-items: flex-end;
    height: 400px;
    min-height: 400px;
    width: 100%;
    overflow-x: auto;
    /* Allow horizontal scrolling */
    overflow-y: hidden;
    padding: 30px 10px 5px 10px;
    /* Safe zone for labels */
    background: #f8f9fa;
    border-radius: 8px;
    border-bottom: 2px solid #bdc3c7;
    gap: 8px;
    box-sizing: border-box;
}

#sum-histogram {
    height: 450px;
    min-height: 450px;
    padding-top: 40px;
}

.histogram-container>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.hist-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    min-width: 40px;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
    /* Ensure the bars don't shrink */
}

.hist-bar {
    width: 100%;
    background: linear-gradient(0deg, #3498db 0%, #5dade2 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
}

.hist-bar:hover::after {
    content: attr(data-prob);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.hist-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2c3e50;
}

/* ================= PRECISION TOGGLE ================= */
/* Float the toggle in the corner of the relative parent (.calc-section) */
/* ================= TOGGLE POSITIONING ================= */
.calc-section {
    position: relative;
    /* Anchor for the absolute toggle */
}

/* Pin to top right */
.precision-toggle-wrapper {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    margin: 0;
    z-index: 20;
}

/* Ensure title doesn't run into the toggle */
.calc-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-right: 140px;
    /* Safe space for the toggle */
}

/* (Optional) Adjust spacing for the inputs below */
.input-row {
    margin-top: 0.5rem;
}

/* Tooltip for High Precision (Simple CSS Hover) */
.switch-label {
    position: relative;
    /* Anchor for tooltip */
}

.switch-label:hover::after {
    content: attr(data-title);
    /* Use the data-title attribute */
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #34495e;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.switch-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #7f8c8d;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: #3498db;
}

input:checked+.slider:before {
    transform: translateX(16px);
}

/* ================= SIDEBAR MENU ================= */
.menu-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    /* Centered Vertically */
    flex-shrink: 0;
}

.menu-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 1px solid #bdc3c7;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    background: white;
    color: #2c3e50;
    text-decoration: none;
    display: block;
}

.menu-btn:not(.active):hover {
    background: #ebf5fb;
    color: #2980b9;
    transform: translateX(5px);
}

.menu-btn.active {
    background: #3498db;
    color: white;
    border: none;
}

/* ================= MODALS & ERRORS ================= */
.error-container {
    background: #fee;
    border: 2px solid #e74c3c;
    color: #c0392b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-overlay {
    position: absolute;
    /* Changed from fixed to absolute */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Ensure it respects the tablet's rounded corners */
    border-radius: 20px;
    /* Keep existing styles */
    background: rgba(44, 62, 80, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.work-modal {
    background: #fff;
    width: 90%;
    max-height: 90%;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
}

.interactive-result {
    color: #3498db;
    border-bottom: 2px dashed #3498db;
    cursor: pointer;
}

.interactive-result:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.math-row {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    color: #34495e;
    font-size: 1rem;
}

/* Fix for 10x10 Matrix Overflow */
.grid-wrapper {
    display: block;
    /* Was inline-block, block allows width control */
    width: 100%;
    /* Take full width of the parent card */
    overflow-x: auto;
    /* ENABLE HORIZONTAL SCROLL */
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    white-space: nowrap;
    /* Prevents rows from wrapping weirdly */
}

.grid-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    width: max-content;
    /* CRITICAL: Forces row to take full required width */
}

.grid-cell {
    width: 80px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #f1f3f5;
    border-radius: 4px;
    flex-shrink: 0;
    /* CRITICAL: Never let these elements shrink */
}

.grid-cell.header {
    background: #e9ecef;
    color: #34495e;
}

.grid-cell.empty {
    background: transparent;
}

.grid-input {
    width: 80px;
    height: 50px;
    text-align: center;
    border: 2px solid #dfe4ea;
    border-radius: 4px;
    font-size: 1rem;
    flex-shrink: 0;
    /* CRITICAL: Never let these elements shrink */
}

.header-input {
    font-weight: 700;
    background: #ebf5fb !important;
    border-color: #3498db !important;
}

/* Prob Sum Indicator */
.prob-sum-indicator {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s;
}

.prob-sum-indicator.valid {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.prob-sum-indicator.invalid {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

/* Marginal Stats */
.marginal-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.marginal-section {
    flex: 1;
    min-width: 250px;
    max-width: 350px;
}

.quick-stats {
    background: linear-gradient(135deg, #ebf5fb 0%, #d6eaf8 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.95rem;
    border: 1px solid #aed6f1;
}

.quick-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-stat-label {
    font-weight: 600;
    color: #2c3e50;
}

.quick-stat-value {
    font-weight: 700;
    color: #3498db;
    font-family: 'Courier New', monospace;
}

.stat-bar-container {
    flex: 1;
    height: 12px;
    background: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.cumulative-cell {
    color: #8e44ad;
    font-weight: 600;
}

/* Stats Display */
.stats-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

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

.history-item {
    background: #f8f9fa;
    padding: 0.75rem;
    /* Smaller text */
    margin-bottom: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    font-size: 0.8rem;
    /* Smaller text */
}

.history-item:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateX(5px);
}

.history-timestamp {
    font-size: 0.7rem;
    /* Even smaller timestamp */
    color: #7f8c8d;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-weight: 700;
    color: #3498db;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
}

/* Dependency Status */
#dependency-status {
    margin: 1.5rem 0;
}

.status-independent {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid #28a745;
}

.status-dependent {
    display: inline-block;
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid #dc3545;
}

.status-desc {
    margin-top: 1rem;
    color: #7f8c8d;
    font-size: 0.95rem;
}

.reason-list {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 4px solid #dc3545;
}

.reason-list li {
    margin-bottom: 0.75rem;
    color: #2c3e50;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem;
    border-radius: 4px;
}

.reason-list li:hover {
    background-color: #fce8e8;
    transform: translateX(5px);
}

/* Interpretation Box */
.interpretation-box {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    border-left: 4px solid #3498db;
}

.interpretation-box p {
    color: #2c3e50;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* History List */
.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.history-item:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateX(5px);
}

.history-timestamp {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 0.25rem;
}

.history-summary {
    font-weight: 600;
    color: #2c3e50;
}

.clear-history-btn {
    width: 100%;
    padding: 0.75rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #c0392b;
}

/* Detail Header */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.detail-header h3 {
    margin-bottom: 0 !important;
}

/* Hint Button */
.hint-btn {
    position: absolute;
    top: 1rem;
    right: 4rem;
    background: white;
    border: 2px solid #f39c12;
    color: #f39c12;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.hint-btn:hover {
    background: #fff3cd;
}

.hint-btn.active {
    background: #f39c12;
    color: white;
}

.calc-term {
    display: inline-block;
    transition: all 0.3s;
}

.show-zeros-crossed .zero-term {
    text-decoration: line-through;
    color: #e74c3c;
    opacity: 0.5;
}

/* Step Box */
.step-box {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed #e9ecef;
    text-align: center;
}

.step-box:last-child {
    border-bottom: none;
}

.step-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    text-align: center;
}

/* MathJax */
mjx-container {
    display: inline-block !important;
    text-align: center !important;
    margin: 0 auto !important;
    justify-content: center !important;
}

mjx-container[jax="CHTML"] {
    display: inline-block !important;
    text-align: center !important;
    justify-content: center !important;
}

/* Heatmap Colors */
.bg-low {
    background-color: rgba(255, 255, 255, 1);
}

.bg-mid {
    background-color: rgba(52, 152, 219, 0.2) !important;
}

.bg-high {
    background-color: rgba(52, 152, 219, 0.5) !important;
    color: white !important;
}

.mode-cell {
    position: relative;
    border: 2px solid #f1c40f !important;
}

.mode-star {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f1c40f;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.total-cell {
    font-weight: 800;
    background: #ecf0f1;
    color: #2c3e50;
    border-left: 2px solid #bdc3c7 !important;
}

.total-header {
    background: #2c3e50 !important;
    color: white !important;
}

.tooltip-cell {
    position: relative;
    cursor: help;
}

.tooltip-cell:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #34495e;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Tabs */
.tab-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #2c3e50;
    background: #f8f9fa;
}

.tab-btn.active {
    background: #ebf5fb;
    color: #3498db;
    font-weight: 700;
}

/* Chart Canvas */
.chart-canvas {
    width: 100%;
    height: auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.collapsible-section {
    margin-top: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-btn {
    width: 100%;
    padding: 1rem;
    background: #ebf5fb;
    border: none;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    font-size: 1rem;
}

.collapsible-btn:hover {
    background: #d6eaf8;
}

.collapsible-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.collapsible-content {
    padding: 1rem;
    color: #34495e;
    line-height: 1.6;
}

.cond-content h4 {
    margin-top: 1rem;
    color: #7f8c8d;
}