/* Financial Calculator - Simplified Professional Design */
/* Clean, minimal color scheme with clear visual hierarchy */

:root {
    /* Background colors */
    --fc-bg-main: #f5f7fa;
    --fc-bg-calculator: #ffffff;
    --fc-bg-display: #1a1a1a;
    
    /* Simplified color palette */
    --fc-btn-default: #607d8b;        /* Gray - all other buttons */
    --fc-btn-number: #6c757d;         /* Light grey - numbers */
    --fc-btn-tvm: #64b5f6;            /* Light blue - TVM row (N, I/Y, PV, PMT, FV) */
    --fc-btn-worksheet: #7b1fa2;      /* Purple - CF, NPV, IRR */
    --fc-btn-2nd: #000000;            /* Black - 2ND button */
    --fc-btn-compute: #2196f3;        /* Blue - CPT and ENTER */
    --fc-btn-clear: #ef5350;          /* Red - Clear */
    --fc-btn-equals: #66bb6a;         /* Green - Equals */
    --fc-btn-nav: #90a4ae;            /* Light gray - navigation arrows */
    
    /* Text colors */
    --fc-text-white: #ffffff;
    --fc-text-dark: #212121;
    --fc-text-secondary: #757575;
    --fc-text-display: #ffffff;
    
    /* Borders and shadows */
    --fc-border-color: #e0e0e0;
    --fc-shadow-light: 0 1px 3px rgba(0,0,0,0.12);
    --fc-shadow-medium: 0 2px 6px rgba(0,0,0,0.16);
    --fc-shadow-hover: 0 4px 8px rgba(0,0,0,0.2);
    
    /* Spacing and sizing */
    --fc-gap: 0.25rem;
    --fc-btn-height: 32px;
    --fc-border-radius: 6px;
    --fc-transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.financial-calculator-container {
    background: var(--fc-bg-main);
    min-height: 100vh;
    padding: 1.5rem 0;
}

/* Hero Section */
.fc-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.75rem 0;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.fc-title {
    color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    letter-spacing: -0.02em;
}

.fc-subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Calculator Body */
.fc-calculator {
    background: var(--fc-bg-calculator);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    max-width: 385px;
    margin: 0 auto;
    border: 1px solid var(--fc-border-color);
}

/* Display Panel */
.fc-display-panel {
    background: linear-gradient(to bottom, #0f0f0f, #1a1a1a);
    border-radius: 8px;
    padding: 0.6rem;
    margin-bottom: 0.875rem;
    border: 2px solid #000;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.8);
    position: relative;
}

/* LCD Grid Effect */
.fc-display-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.02) 2px,
        rgba(255, 255, 255, 0.02) 3px
    );
    pointer-events: none;
    border-radius: inherit;
}

/* Indicators */
.fc-indicators {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    min-height: 15px;
    padding: 0 0.4rem;
    position: relative;
    z-index: 1;
}

.indicator {
    visibility: hidden;
    opacity: 0;
    color: #ffd600;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Roboto Mono', 'SF Mono', monospace;
    transition: all 0.3s ease;
    display: inline-block;
}

.indicator.active {
    visibility: visible;
    opacity: 1;
    text-shadow: 0 0 8px #ffd600;
}

/* Display */
.fc-display {
    background: transparent;
    padding: 0.5rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

.fc-display-line {
    color: var(--fc-text-display);
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 1.6rem;
    font-weight: 300;
    text-align: right;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

/* TVM Variable Display Mode */
.fc-display-line.tvm-mode {
    display: flex;
    justify-content: space-between;
    width: 100%;
    text-align: initial;
}

.fc-display-line .tvm-label {
    text-align: left;
    font-weight: 300;
}

.fc-display-line .tvm-value {
    text-align: right;
    font-weight: 300;
}

/* Button Grid */
.fc-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--fc-gap);
}

.fc-button-row {
    display: flex;
    justify-content: center;
    gap: var(--fc-gap);
    width: 100%;
}

/* Button Wrapper */
.fc-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 66px;
    flex-shrink: 0;
}

/* Secondary Labels */
.fc-secondary-label {
    color: #000000;
    font-size: 0.55rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    min-height: 11px;
    text-align: center;
    width: 100%;
    opacity: 1;
}

/* Base Button Styles - Default Gray */
.fc-btn {
    background: var(--fc-btn-default);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--fc-border-radius);
    color: var(--fc-text-white);
    cursor: pointer;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 4px;
    transition: var(--fc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--fc-btn-height);
    width: 100%;
    min-width: 0;
    box-shadow: var(--fc-shadow-light);
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: relative;
}

.fc-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--fc-shadow-hover);
    filter: brightness(1.1);
}

.fc-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Number Buttons (0-9) - Light grey background */
.fc-btn-number,
body .fc-btn-number,
body .financial-calculator-container .fc-btn.fc-btn-number {
    background: #6c757d !important;
    background-color: #6c757d !important;
    color: #ffffff !important;
    font-size: 1.05rem;
    font-weight: 700;
    border: 1px solid #495057 !important;
    box-shadow: var(--fc-shadow-light) !important;
}

.fc-btn-number:hover,
body .fc-btn-number:hover,
body .financial-calculator-container .fc-btn.fc-btn-number:hover {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

.fc-btn-number:active,
.fc-btn-number:focus,
body .fc-btn-number:active,
body .fc-btn-number:focus,
body .financial-calculator-container .fc-btn.fc-btn-number:active,
body .financial-calculator-container .fc-btn.fc-btn-number:focus {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* TVM Keys (Row 3: N, I/Y, PV, PMT, FV) - Light Blue */
.fc-btn-tvm {
    background: var(--fc-btn-tvm);
    color: var(--fc-text-white);
    font-weight: 700;
}

.fc-btn-tvm:hover {
    background: #42a5f5;
}

/* 2ND Button - Black background */
.fc-btn-2nd {
    background: var(--fc-btn-2nd);
    color: var(--fc-text-white);
    font-weight: 700;
}

.fc-btn-2nd:hover {
    background: #212121;
}

/* CPT and ENTER Buttons - Blue */
.fc-btn[data-primary="CPT"],
.fc-btn[data-primary="ENTER"] {
    background: var(--fc-btn-compute);
    color: var(--fc-text-white);
    font-weight: 700;
}

.fc-btn[data-primary="CPT"]:hover,
.fc-btn[data-primary="ENTER"]:hover {
    background: #1e88e5;
}

/* CE|C Button - Default gray (CLR WORK secondary stays red via text) */
.fc-btn-clear {
    background: var(--fc-btn-default);
    color: var(--fc-text-white);
}

.fc-btn-clear:hover {
    background: #546e7a;
}

/* Equals Button - Green */
.fc-btn-equals {
    background: var(--fc-btn-equals);
    color: var(--fc-text-white);
    font-size: 1.15rem;
    font-weight: 700;
}

.fc-btn-equals:hover {
    background: #4caf50;
}

/* Navigation Buttons (Arrows) - Light gray */
.fc-btn[data-primary="UP"],
.fc-btn[data-primary="DOWN"] {
    background: var(--fc-btn-nav);
    color: var(--fc-text-white);
    font-size: 1.1rem;
}

.fc-btn[data-primary="UP"]:hover,
.fc-btn[data-primary="DOWN"]:hover {
    background: #78909c;
}

/* Decimal and +/- - Light grey background */
.fc-btn[data-primary="DECIMAL"],
.fc-btn[data-primary="PLUS_MINUS"] {
    background: #6c757d;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Fix +/- button text wrapping */
.fc-btn[data-primary="PLUS_MINUS"] {
    white-space: nowrap;
    padding: 0 2px;
    letter-spacing: -1px;
}

.fc-btn[data-primary="DECIMAL"]:hover,
.fc-btn[data-primary="PLUS_MINUS"]:hover {
    background: #000000;
    color: #ffffff;
}

.fc-btn[data-primary="DECIMAL"]:active,
.fc-btn[data-primary="PLUS_MINUS"]:active {
    background: #000000;
    color: #ffffff;
}

/* Refresh Button - Distinct but subtle */
.fc-btn-refresh {
    background: #78909c;
    color: var(--fc-text-white);
    font-size: 1.2rem;
}

.fc-btn-refresh:hover {
    background: #607d8b;
}

/* CF, NPV, IRR Buttons - Purple */
.fc-btn[data-primary="CF"],
.fc-btn[data-primary="NPV"],
.fc-btn[data-primary="IRR"] {
    background: var(--fc-btn-worksheet);
    color: var(--fc-text-white);
}

.fc-btn[data-primary="CF"]:hover,
.fc-btn[data-primary="NPV"]:hover,
.fc-btn[data-primary="IRR"]:hover {
    background: #8e24aa;
}

/* Force specific button colors with higher specificity */
.financial-calculator-container .fc-btn-2nd {
    background: #000000 !important;
}

.financial-calculator-container .fc-btn-2nd:hover {
    background: #212121 !important;
}

.financial-calculator-container .fc-btn-tvm {
    background: #64b5f6 !important;
}

.financial-calculator-container .fc-btn-tvm:hover {
    background: #42a5f5 !important;
}

.financial-calculator-container .fc-btn-number {
    background: #6c757d !important;
    color: #ffffff !important;
}

.financial-calculator-container .fc-btn-number:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

.financial-calculator-container .fc-btn-number:active {
    background: #000000 !important;
    color: #ffffff !important;
}

.financial-calculator-container .fc-btn[data-primary="CF"],
.financial-calculator-container .fc-btn[data-primary="NPV"],
.financial-calculator-container .fc-btn[data-primary="IRR"] {
    background: var(--fc-btn-worksheet) !important;
}

.financial-calculator-container .fc-btn-clear {
    background: var(--fc-btn-default) !important;
}

.financial-calculator-container .fc-btn-equals {
    background: var(--fc-btn-equals) !important;
}

.financial-calculator-container .fc-btn[data-primary="DECIMAL"],
.financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"] {
    background: #6c757d !important;
    color: #ffffff !important;
    white-space: nowrap !important;
}

.financial-calculator-container .fc-btn[data-primary="DECIMAL"]:hover,
.financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"]:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

.financial-calculator-container .fc-btn[data-primary="DECIMAL"]:active,
.financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"]:active {
    background: #000000 !important;
    color: #ffffff !important;
}

/* All other buttons inherit default gray styling */
/* This includes: CF, NPV, IRR, %, √X, X², 1/X, ÷, INV, (, ), y^x, ×, LN, −, STO, +, RCL, BACKSPACE */

/* Superscript in buttons */
.fc-btn sup {
    font-size: 0.6em;
    vertical-align: super;
    line-height: 0;
}

/* 2nd Mode Animation */
@keyframes pulse-2nd {
    0%, 100% {
        background: #000000;
        transform: scale(1);
    }
    50% {
        background: #ffea00;
        transform: scale(1.05);
    }
}

.fc-calculator.second-active .fc-btn-2nd {
    animation: pulse-2nd 1.5s infinite;
    box-shadow: 0 0 15px rgba(255, 214, 0, 0.5);
}

/* Focus styles for accessibility */
.fc-btn:focus {
    outline: 3px solid #2196f3;
    outline-offset: 2px;
}

/* Visual feedback for button press */
.fc-btn.active {
    transform: scale(0.95);
    opacity: 0.85;
}

/* Disclaimer */
.fc-disclaimer {
    background: #fafafa;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 2rem;
    border: 1px solid #e0e0e0;
}

.fc-disclaimer p {
    color: #616161;
    font-size: 0.8rem;
    line-height: 1.6;
    margin: 0;
}

.fc-disclaimer strong {
    color: #424242;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fc-calculator {
        padding: 1.25rem;
        margin: 0 1rem;
    }
    
    .fc-button-row {
        gap: 0.3rem;
    }
    
    .fc-btn {
        height: 44px;
        font-size: 0.9rem;
    }
    
    .fc-btn-number {
        font-size: 1.15rem;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }

    .fc-secondary-label {
        font-size: 0.55rem;
    }
    
    .fc-display-line {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .fc-title {
        font-size: 2rem;
    }
    
    .fc-calculator {
        padding: 1rem;
    }
    
    .fc-button-row {
        gap: 0.25rem;
    }
    
    .fc-btn {
        height: 40px;
        font-size: 0.85rem;
        border-radius: 4px;
    }
    
    .fc-btn-number {
        font-size: 1.05rem;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }

    .fc-secondary-label {
        font-size: 0.5rem;
        min-height: 12px;
    }
    
    .fc-display-line {
        font-size: 1.5rem;
    }
    
    .fc-btn-equals {
        font-size: 1rem;
    }
}

/* Progressive mobile height adjustments - Try size reduction first */
@media (max-width: 768px) and (max-height: 650px) {
    .fc-hero {
        padding: 0.75rem 0;
        margin-bottom: 0.5rem;
    }
    .fc-title {
        font-size: 1.75rem;
    }
    .fc-subtitle {
        font-size: 0.85rem;
    }
    .fc-calculator {
        padding: 0.75rem;
    }
    .fc-btn {
        height: 40px;
    }
    .fc-display-panel {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .fc-disclaimer {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }
}

@media (max-width: 768px) and (max-height: 580px) {
    .fc-hero {
        display: none; /* Hide hero on very small screens */
    }
    .fc-btn {
        height: 38px;
    }
    .fc-secondary-label {
        font-size: 0.48rem;
    }
    .fc-button-row {
        gap: 0.2rem;
    }
}

/* Scale transform only when absolutely necessary */
@media (max-width: 768px) and (max-height: 520px) {
    .fc-calculator {
        transform: scale(0.9);
        transform-origin: center top;
    }
    /* Ensure button animations still work */
    .fc-btn.active {
        transform: scale(0.95) !important;
    }
}

@media (max-width: 768px) and (max-height: 480px) {
    .fc-calculator {
        transform: scale(0.85);
    }
    .fc-disclaimer {
        display: none;
    }
}

/* Absolute minimum - never go below this */
@media (max-width: 768px) and (max-height: 440px) {
    .fc-calculator {
        transform: scale(0.8);
    }
    .financial-calculator-container {
        padding: 0.25rem 0;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
}

/* Prevent scrolling issues on scaled content */
@media (max-width: 768px) {
    body.calculator-page {
        overflow-x: hidden;
    }
    .financial-calculator-container {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

/* Height-based responsive design for MAIN PAGE */
/* Compact mode for shorter screens (700-850px height) */
@media (max-height: 850px) and (min-width: 768px) {
    .fc-hero {
        padding: 1.5rem 0;
        margin-bottom: 1rem;
    }
    
    .fc-title {
        font-size: 2rem;
    }
    
    .fc-subtitle {
        font-size: 0.95rem;
    }
    
    .fc-calculator {
        padding: 1.25rem;
    }
    
    .fc-btn {
        height: 40px;
    }
    
    .fc-btn-number {
        font-size: 1.15rem;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }

    .fc-button-row {
        gap: 0.3rem;
    }
    
    .fc-secondary-label {
        font-size: 0.58rem;
        min-height: 12px;
    }
    
    .fc-display-panel {
        padding: 0.6rem;
        margin-bottom: 0.9rem;
    }
    
    .fc-display-line {
        font-size: 1.7rem;
    }
    
    .fc-disclaimer {
        padding: 1rem;
        margin-top: 1.5rem;
    }
}

/* Ultra-compact mode for very short screens (< 700px height) */
@media (max-height: 700px) and (min-width: 768px) {
    /* Hide hero section to save critical space */
    .fc-hero {
        display: none;
    }
    
    .financial-calculator-container {
        padding: 1rem 0;
    }
    
    .fc-calculator {
        padding: 1rem;
    }
    
    .fc-btn {
        height: 36px;
        font-size: 0.85rem;
    }
    
    .fc-btn-number {
        font-size: 1.05rem;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }

    .fc-button-row {
        gap: 0.25rem;
    }
    
    .fc-btn-wrapper {
        gap: 2px;
    }
    
    .fc-secondary-label {
        font-size: 0.52rem;
        min-height: 10px;
    }
    
    .fc-display-panel {
        padding: 0.5rem;
        margin-bottom: 0.7rem;
    }
    
    .fc-display-line {
        font-size: 1.5rem;
    }
    
    .fc-display {
        min-height: 38px;
    }
    
    .fc-indicators {
        font-size: 0.6rem;
        min-height: 14px;
    }
    
    .fc-disclaimer {
        padding: 0.75rem;
        margin-top: 1rem;
        font-size: 0.75rem;
    }
}

/* Pop-out Button */
.fc-btn-popout {
    background: #4285f4;
    color: var(--fc-text-white);
    font-size: 1.3rem;
}

.fc-btn-popout:hover {
    background: #3367d6;
}

/* Popup Mode Styles */
.popup-mode {
    margin: 0;
    padding: 0;
    background: var(--fc-bg-main);
}

.popup-mode .fc-hero,
.popup-mode .fc-disclaimer,
.popup-mode header,
.popup-mode footer,
.popup-mode .admin-bar,
.popup-mode nav {
    display: none !important;
}

.popup-mode .financial-calculator-container {
    padding: 1rem 0.5rem;
    min-height: auto;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.popup-mode .fc-calculator {
    margin: 0;
    max-width: none;
    width: 100%;
    box-shadow: none;
    border: none;
}

.popup-mode .container,
.popup-mode .row,
.popup-mode .col-lg-8,
.popup-mode .col-xl-6 {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Compact sizing for popup mode */
.popup-mode .fc-btn {
    height: 38px;
    font-size: 0.9rem;
}

.popup-mode .fc-btn-number {
    font-size: 1.05rem;
    background: #6c757d !important;
    color: #ffffff !important;
}

.popup-mode .fc-btn-number:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

.popup-mode .fc-btn-equals {
    font-size: 0.95rem;
}

.popup-mode .fc-secondary-label {
    font-size: 0.5rem;
    min-height: 11px;
    gap: 1px;
}

.popup-mode .fc-button-row {
    gap: 0.25rem;
}

.popup-mode .fc-btn-wrapper {
    gap: 2px;
}

.popup-mode .fc-calculator {
    padding: 0.75rem;
}

.popup-mode .fc-display-panel {
    padding: 0.5rem;
    margin-bottom: 0.75rem;
}

.popup-mode .fc-display-line {
    font-size: 1.6rem;
}

.popup-mode .fc-indicators {
    font-size: 0.6rem;
    margin-bottom: 0.25rem;
    min-height: 14px;
}

.popup-mode .fc-display {
    min-height: 36px;
    padding: 0.4rem;
}

/* Responsive sizing for popup mode based on screen height */
/* Ultra-compact for very small screens (< 700px height) */
@media (max-height: 700px) {
    .popup-mode .fc-btn {
        height: 30px !important;
        font-size: 0.8rem !important;
    }
    
    .popup-mode .fc-btn-number {
        font-size: 0.95rem !important;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .popup-mode .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .popup-mode .fc-secondary-label {
        font-size: 0.4rem !important;
        min-height: 9px !important;
    }
    
    .popup-mode .fc-button-row {
        gap: 2px !important;
    }
    
    .popup-mode .fc-calculator {
        padding: 0.5rem !important;
    }
    
    .popup-mode .fc-display-panel {
        padding: 0.3rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .popup-mode .fc-display-line {
        font-size: 1.3rem !important;
    }
    
    .popup-mode .fc-display {
        min-height: 30px !important;
    }
}

/* Small screens (700-900px height) */
@media (min-height: 700px) and (max-height: 900px) {
    .popup-mode .fc-btn {
        height: 34px !important;
        font-size: 0.85rem !important;
    }
    
    .popup-mode .fc-btn-number {
        font-size: 1rem !important;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .popup-mode .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .popup-mode .fc-secondary-label {
        font-size: 0.45rem !important;
        min-height: 10px !important;
    }
    
    .popup-mode .fc-button-row {
        gap: 3px !important;
    }
    
    .popup-mode .fc-display-line {
        font-size: 1.5rem !important;
    }
}

/* Medium screens (900-1080px height) - default compact settings apply */

/* Large screens (> 1080px height) */
@media (min-height: 1080px) {
    .popup-mode .fc-btn {
        height: 42px !important;
        font-size: 0.95rem !important;
    }
    
    .popup-mode .fc-btn-number {
        font-size: 1.15rem !important;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .popup-mode .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .popup-mode .fc-btn-equals {
        font-size: 1.05rem !important;
    }
    
    .popup-mode .fc-secondary-label {
        font-size: 0.55rem !important;
        min-height: 12px !important;
    }
    
    .popup-mode .fc-button-row {
        gap: 0.3rem !important;
    }
    
    .popup-mode .fc-calculator {
        padding: 1rem !important;
    }
    
    .popup-mode .fc-display-panel {
        padding: 0.6rem !important;
    }
    
    .popup-mode .fc-display-line {
        font-size: 1.8rem !important;
    }
}

/* Simple overflow prevention - only hide hero when space is critical */
@media (max-height: 750px) and (min-width: 768px) {
    .financial-calculator-container {
        min-height: auto;
        padding: 1rem 0;
    }
    
    .fc-hero {
        display: none;
    }
}

/* Loading state */
.fc-calculator.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Narrow mobile screens - prevent horizontal overflow */
/* For iPhone 12 Pro and similar (376-400px width) */
@media (max-width: 400px) {
    .fc-calculator {
        max-width: 370px !important;
        padding: 1rem !important;
    }
    
    .fc-btn-wrapper {
        width: 62px !important;
    }
    
    .fc-button-row {
        gap: 3px !important;
    }
    
    .fc-buttons {
        gap: 3px !important;
    }
    
    .fc-btn {
        font-size: 0.8rem !important;
    }
    
    .fc-btn-number {
        font-size: 1rem !important;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .fc-secondary-label {
        font-size: 0.45rem !important;
    }
}

/* For iPhone SE and smaller (≤375px width) */
@media (max-width: 375px) {
    .fc-calculator {
        max-width: 355px !important;
        padding: 0.8rem !important;
    }
    
    .fc-btn-wrapper {
        width: 58px !important;
    }
    
    .fc-button-row {
        gap: 2px !important;
    }
    
    .fc-buttons {
        gap: 2px !important;
    }
    
    .fc-btn {
        height: 30px !important;
        font-size: 0.75rem !important;
    }
    
    .fc-btn-number {
        font-size: 0.95rem !important;
        background: #6c757d !important;
        color: #ffffff !important;
    }

    .fc-btn-number:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .fc-secondary-label {
        font-size: 0.4rem !important;
        min-height: 9px !important;
    }
    
    .fc-display-panel {
        padding: 0.5rem !important;
        margin-bottom: 0.7rem !important;
    }
    
    .fc-display-line {
        font-size: 1.4rem !important;
    }
    
    .fc-display {
        min-height: 32px !important;
        padding: 0.4rem !important;
    }
    
    .fc-indicators {
        font-size: 0.5rem !important;
        margin-bottom: 0.3rem !important;
    }
}

/* Extra narrow screens - apply horizontal scaling if needed */
@media (max-width: 360px) {
    .fc-calculator {
        transform: scale(0.95);
        transform-origin: center top;
        margin: 0 auto;
    }
}

/* Guide Container - Full Width Background */
.fc-guide-container {
    background: #f8f9fa;
    padding: 3rem 0;
    margin-top: 3rem;
    border-top: 1px solid #e0e0e0;
}

/* Guide Section Styles */
.fc-guide-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    color: #333;
    line-height: 1.6;
}

/* Guide Main Title */
.fc-guide-main-title {
    text-align: center;
    margin-bottom: 2rem;
}

/* Guide Wrapper with TOC */
.fc-guide-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* TOC Sidebar */
.fc-toc-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* TOC Header */
.fc-toc-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #667eea;
}

.fc-toc-header h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0 0 0.75rem 0;
}

/* TOC Search */
.fc-toc-search {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.fc-toc-search:focus {
    outline: none;
    border-color: #667eea;
}

/* TOC List */
.fc-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin: 0;
    position: relative;
}

.toc-item.toc-level-2 {
    margin-top: 0.5rem;
}

.toc-item.toc-level-2:first-child {
    margin-top: 0;
}

/* TOC Toggle Button - Hidden by default, collapsible sections use indentation */
.toc-toggle {
    display: none; /* Hide the toggle buttons completely */
}

/* TOC Links */
.toc-link {
    display: block;
    padding: 0.4rem 0.5rem;
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
}

.toc-level-3 .toc-link {
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

.toc-level-4 .toc-link {
    padding-left: 2.5rem;
    font-size: 0.85rem;
    color: #777;
}

.toc-link:hover {
    background: #f8f9fa;
    color: #667eea;
}

.toc-link.active {
    background: #667eea;
    color: #fff;
}

/* TOC Children */
.toc-children {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
}

.toc-item.has-children {
    padding-left: 0;
}

/* Guide Content */
.fc-guide-content {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 300px); /* Account for TOC sidebar */
}

@media (max-width: 768px) {
    .fc-guide-content {
        max-width: 100%;
    }
}

.fc-guide-section h2 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #667eea;
}

.fc-guide-section h3 {
    color: #34495e;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.fc-guide-section h4 {
    color: #555;
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.fc-guide-section p {
    margin-bottom: 1rem;
    color: #555;
}

/* Example Boxes */
.example-box {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 1.25rem;
    margin: 1rem 0 1.5rem 0;
    border-radius: 4px;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.95rem;
}

.example-box strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 0.5rem;
}

/* FAQ Section */
.faq-section {
    margin-top: 2rem;
}

.faq-item {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.faq-item h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.faq-item p {
    margin-bottom: 0;
    color: #666;
}

/* Mobile TOC Button */
.fc-toc-mobile-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 999;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.fc-toc-mobile-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.fc-toc-mobile-label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Mobile TOC Drawer */
.fc-toc-mobile-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.fc-toc-mobile-drawer.open {
    left: 0;
}

.fc-toc-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.fc-toc-mobile-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.fc-toc-mobile-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
}

.fc-toc-mobile-search {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.fc-toc-mobile-list {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.fc-toc-mobile-list .toc-item {
    margin-bottom: 0.25rem;
}

.fc-toc-mobile-list .toc-link {
    padding: 0.75rem 1rem;
    display: block;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.fc-toc-mobile-list .toc-link:active {
    background: #667eea;
    color: #fff;
}

/* Mobile TOC Overlay */
.fc-toc-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.fc-toc-mobile-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Hide desktop TOC on mobile */
@media (max-width: 768px) {
    .fc-toc-sidebar {
        display: none;
    }
    
    .fc-guide-wrapper {
        display: block;
    }
    
    .fc-toc-mobile-btn {
        display: flex;
    }
    
    .fc-guide-container {
        padding: 2rem 0;
        margin-top: 2rem;
    }
    
    .fc-guide-section {
        padding: 0 1rem;
    }
    
    .fc-guide-section h2 {
        font-size: 1.6rem;
    }
    
    .fc-guide-section h3 {
        font-size: 1.3rem;
    }
    
    .fc-guide-section h4 {
        font-size: 1.1rem;
    }
    
    .example-box {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .fc-toc-sidebar {
        width: 220px;
    }
    
    .fc-guide-wrapper {
        gap: 1.5rem;
    }
}

/* Scrollbar styling for TOC */
.fc-toc-sidebar::-webkit-scrollbar,
.fc-toc-mobile-drawer::-webkit-scrollbar {
    width: 6px;
}

.fc-toc-sidebar::-webkit-scrollbar-track,
.fc-toc-mobile-drawer::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.fc-toc-sidebar::-webkit-scrollbar-thumb,
.fc-toc-mobile-drawer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.fc-toc-sidebar::-webkit-scrollbar-thumb:hover,
.fc-toc-mobile-drawer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* TVM Variables Interactive Cards */
.tvm-variables-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tvm-var-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tvm-var-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.tvm-var-card:hover::before {
    transform: scaleX(1);
}

.tvm-var-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.var-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.var-symbol {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Roboto Mono', monospace;
}

.var-icon {
    color: #999;
    transition: color 0.3s;
}

.tvm-var-card:hover .var-icon {
    color: #667eea;
}

.var-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.var-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin-top: 0.5rem;
}

.tvm-var-card:hover .var-details {
    max-height: 200px;
}

.var-details p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.var-example,
.var-tip {
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.var-example strong,
.var-tip strong {
    color: #2c3e50;
}

/* TVM Settings Section */
.tvm-settings-section {
    margin: 3rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.tvm-settings-section h5 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.tvm-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tvm-setting-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.setting-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.setting-symbol {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

.setting-name {
    font-weight: 600;
    color: #2c3e50;
}

.tvm-setting-card p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.setting-example {
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

/* TVM Quick Reference Table */
.tvm-quick-ref {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.tvm-quick-ref h5 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.tvm-sign-table {
    width: 100%;
    border-collapse: collapse;
}

.tvm-sign-table th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #667eea;
}

.tvm-sign-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.tvm-sign-table .positive {
    color: #66bb6a;
    font-weight: 600;
}

.tvm-sign-table .negative {
    color: #ef5350;
    font-weight: 600;
}

/* Responsive adjustments for TVM sections */
@media (max-width: 768px) {
    .tvm-variables-table {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tvm-var-card {
        padding: 1.25rem;
    }
    
    .var-symbol {
        font-size: 1.5rem;
    }
    
    .tvm-settings-grid {
        grid-template-columns: 1fr;
    }
    
    .tvm-sign-table {
        font-size: 0.9rem;
    }
    
    .tvm-sign-table th,
    .tvm-sign-table td {
        padding: 0.5rem;
    }
}

/* Animation for first-time visitors */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* OVERRIDE BOOTSTRAP AND OTHER STYLES - MUST BE AT END OF FILE */
/* Force number button styles to override any conflicting styles */
body .financial-calculator-container .fc-btn.fc-btn-number,
body .fc-calculator .fc-btn.fc-btn-number,
.financial-calculator-container .fc-buttons .fc-btn-number,
.fc-btn-number[data-primary="0"],
.fc-btn-number[data-primary="1"],
.fc-btn-number[data-primary="2"],
.fc-btn-number[data-primary="3"],
.fc-btn-number[data-primary="4"],
.fc-btn-number[data-primary="5"],
.fc-btn-number[data-primary="6"],
.fc-btn-number[data-primary="7"],
.fc-btn-number[data-primary="8"],
.fc-btn-number[data-primary="9"] {
    background: #6c757d !important;
    background-color: #6c757d !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

body .financial-calculator-container .fc-btn.fc-btn-number:hover,
body .fc-calculator .fc-btn.fc-btn-number:hover,
.financial-calculator-container .fc-buttons .fc-btn-number:hover,
.fc-btn-number[data-primary="0"]:hover,
.fc-btn-number[data-primary="1"]:hover,
.fc-btn-number[data-primary="2"]:hover,
.fc-btn-number[data-primary="3"]:hover,
.fc-btn-number[data-primary="4"]:hover,
.fc-btn-number[data-primary="5"]:hover,
.fc-btn-number[data-primary="6"]:hover,
.fc-btn-number[data-primary="7"]:hover,
.fc-btn-number[data-primary="8"]:hover,
.fc-btn-number[data-primary="9"]:hover,
body .financial-calculator-container .fc-btn.fc-btn-number:active,
body .fc-calculator .fc-btn.fc-btn-number:active,
.financial-calculator-container .fc-buttons .fc-btn-number:active,
body .financial-calculator-container .fc-btn.fc-btn-number:focus,
body .fc-calculator .fc-btn.fc-btn-number:focus,
.financial-calculator-container .fc-buttons .fc-btn-number:focus {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* Force decimal and +/- button styles */
body .financial-calculator-container .fc-btn[data-primary="DECIMAL"],
body .financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"],
body .fc-calculator .fc-btn[data-primary="DECIMAL"],
body .fc-calculator .fc-btn[data-primary="PLUS_MINUS"],
.financial-calculator-container .fc-buttons .fc-btn[data-primary="DECIMAL"],
.financial-calculator-container .fc-buttons .fc-btn[data-primary="PLUS_MINUS"] {
    background: #6c757d !important;
    background-color: #6c757d !important;
    color: #ffffff !important;
    border-color: #495057 !important;
    white-space: nowrap !important;
}

body .financial-calculator-container .fc-btn[data-primary="DECIMAL"]:hover,
body .financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"]:hover,
body .fc-calculator .fc-btn[data-primary="DECIMAL"]:hover,
body .fc-calculator .fc-btn[data-primary="PLUS_MINUS"]:hover,
.financial-calculator-container .fc-buttons .fc-btn[data-primary="DECIMAL"]:hover,
.financial-calculator-container .fc-buttons .fc-btn[data-primary="PLUS_MINUS"]:hover,
body .financial-calculator-container .fc-btn[data-primary="DECIMAL"]:active,
body .financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"]:active,
body .financial-calculator-container .fc-btn[data-primary="DECIMAL"]:focus,
body .financial-calculator-container .fc-btn[data-primary="PLUS_MINUS"]:focus {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* Force TVM button styles (N, I/Y, PV, PMT, FV) - Light Blue */
body .financial-calculator-container .fc-btn-tvm,
body .fc-calculator .fc-btn-tvm,
.financial-calculator-container .fc-buttons .fc-btn-tvm,
.fc-btn-tvm[data-primary="N"],
.fc-btn-tvm[data-primary="I/Y"],
.fc-btn-tvm[data-primary="PV"],
.fc-btn-tvm[data-primary="PMT"],
.fc-btn-tvm[data-primary="FV"] {
    background: #64b5f6 !important;
    background-color: #64b5f6 !important;
    color: #ffffff !important;
    border-color: #42a5f5 !important;
}

body .financial-calculator-container .fc-btn-tvm:hover,
body .fc-calculator .fc-btn-tvm:hover,
.financial-calculator-container .fc-buttons .fc-btn-tvm:hover,
.fc-btn-tvm[data-primary="N"]:hover,
.fc-btn-tvm[data-primary="I/Y"]:hover,
.fc-btn-tvm[data-primary="PV"]:hover,
.fc-btn-tvm[data-primary="PMT"]:hover,
.fc-btn-tvm[data-primary="FV"]:hover,
body .financial-calculator-container .fc-btn-tvm:active,
body .financial-calculator-container .fc-btn-tvm:focus {
    background: #42a5f5 !important;
    background-color: #42a5f5 !important;
    color: #ffffff !important;
    border-color: #2196f3 !important;
}

/* Force 2ND button black background */
body .financial-calculator-container .fc-btn-2nd,
body .fc-calculator .fc-btn-2nd,
.financial-calculator-container .fc-buttons .fc-btn-2nd {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
}

body .financial-calculator-container .fc-btn-2nd:hover,
body .fc-calculator .fc-btn-2nd:hover,
.financial-calculator-container .fc-buttons .fc-btn-2nd:hover {
    background: #212121 !important;
    background-color: #212121 !important;
    color: #ffffff !important;
}

/* Force all secondary labels to be black */
body .financial-calculator-container .fc-secondary-label,
body .fc-calculator .fc-secondary-label,
.financial-calculator-container .fc-secondary-label,
.popup-mode .fc-secondary-label {
    color: #000000 !important;
    opacity: 1 !important;
}

.tvm-var-card {
    animation: slideInUp 0.5s ease forwards;
}

.tvm-var-card:nth-child(1) { animation-delay: 0.1s; }
.tvm-var-card:nth-child(2) { animation-delay: 0.2s; }
.tvm-var-card:nth-child(3) { animation-delay: 0.3s; }
.tvm-var-card:nth-child(4) { animation-delay: 0.4s; }
.tvm-var-card:nth-child(5) { animation-delay: 0.5s; }

/* Calculator Example Styles */
.calculator-example {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.calculator-example h6 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.example-scenario {
    color: #555;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Button Sequence Table */
.button-sequence-table {
    overflow-x: auto;
    margin: 1rem 0;
}

.button-sequence-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.button-sequence-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.button-sequence-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.button-sequence-table tr:last-child td {
    border-bottom: none;
}

.button-sequence-table tr:hover {
    background: #f8f9fa;
}

/* Button styling in tables */
.button-sequence-table .button-key {
    display: inline-block;
    background: #607d8b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0.25rem;
}

.button-sequence-table .button-key.number {
    background: #2196f3;
}

.button-sequence-table .button-key.tvm {
    background: #00acc1;
}

.button-sequence-table .button-key.operator {
    background: #ef5350;
}

.button-sequence-table .button-key.compute {
    background: #66bb6a;
}

/* Display value styling */
.button-sequence-table .display-value {
    font-family: 'Roboto Mono', monospace;
    background: #1a1a1a;
    color: #ffd600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Result styling */
.button-sequence-table .result-value {
    font-weight: 600;
    color: #667eea;
    font-size: 1rem;
}

/* Step numbers */
.button-sequence-table .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Mobile responsiveness for example tables */
@media (max-width: 768px) {
    .calculator-example {
        padding: 1.25rem;
        margin: 1.5rem 0;
    }
    
    .calculator-example h6 {
        font-size: 1rem;
    }
    
    .button-sequence-table {
        font-size: 0.85rem;
    }
    
    .button-sequence-table th,
    .button-sequence-table td {
        padding: 0.5rem;
    }
    
    .button-sequence-table .button-key {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
        margin: 0 0.15rem;
    }
    
    .button-sequence-table .display-value {
        font-size: 0.8rem;
    }
}