* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.calculator-container {
    background: #1e1e1e;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    width: 100%;
    overflow: visible;
    min-height: 600px; /* Ensures consistent minimum height */
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    color: white;
    border-radius: 20px 20px 0 0;
}

.display-section {
    background: #2d2d2d;
    padding: 20px;
    color: white;
}

.mode-content {
    display: none;
    padding: 20px;
}

.mode-content.active {
    display: block;
}

.history-panel {
    background: #2d2d2d;
    border-top: 2px solid #3a3a3a;
    max-height: 200px;
    overflow-y: auto;
}

/* Remove any max-height constraints */
.calculator-container {
    max-height: none !important;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    text-align: center;
}

.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mode-btn.active {
    background: white;
    color: #667eea;
    font-weight: bold;
}

.expression-display {
    font-size: 16px;
    color: #888;
    min-height: 24px;
    text-align: right;
    overflow-x: auto;
    white-space: nowrap;
}

.result-display {
    font-size: 48px;
    font-weight: bold;
    text-align: right;
    margin-top: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

.memory-indicator {
    font-size: 12px;
    color: #667eea;
    text-align: right;
    margin-top: 5px;
    min-height: 16px;
}


.mode-content.active {
    display: block;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.programmer-grid {
    grid-template-columns: repeat(6, 1fr);
}

.btn {
    background: #3a3a3a;
    border: none;
    padding: 20px;
    border-radius: 10px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn:hover {
    background: #4a4a4a;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn.number {
    background: #4a4a4a;
}

.btn.operator {
    background: #667eea;
}

.btn.function {
    background: #5a5a5a;
    font-size: 14px;
}

.btn.equals {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 24px;
    font-weight: bold;
}

.btn.clear {
    background: #e74c3c;
}

.btn.memory {
    background: #f39c12;
    font-size: 14px;
}

.btn.constant {
    background: #16a085;
}

.btn.toggle {
    background: #9b59b6;
    font-size: 12px;
}

.btn.hex {
    background: #34495e;
}

.base-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.base-btn {
    background: #3a3a3a;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.base-btn.active {
    background: #667eea;
}

.graph-controls {
    margin-bottom: 20px;
}

#graphFunction {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
}

.range-controls {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.range-controls label {
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

.range-controls input {
    width: 60px;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
}

#graphCanvas {
    width: 100%;
    background: #2d2d2d;
    border-radius: 10px;
    display: block;
}

.graph-info {
    color: #888;
    margin-top: 10px;
    font-size: 14px;
}

.converter-section select,
.converter-section input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
}

.conversion-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.input-group {
    flex: 1;
}

.swap-btn {
    background: #667eea;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
}

.swap-btn:hover {
    background: #764ba2;
    transform: rotate(180deg);
}

.history-panel {
    background: #2d2d2d;
    border-top: 2px solid #3a3a3a;
    max-height: 200px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #3a3a3a;
}

.history-header h3 {
    color: white;
    font-size: 16px;
}

.btn-small {
    background: #e74c3c;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

.history-list {
    padding: 10px 20px;
}

.history-item {
    color: #888;
    padding: 8px 0;
    border-bottom: 1px solid #3a3a3a;
    cursor: pointer;
    transition: color 0.2s;
}

.history-item:hover {
    color: #667eea;
}

.history-item:last-child {
    border-bottom: none;
}

.basic-grid {
    grid-template-columns: repeat(6, 1fr);
}

.scientific-grid {
    grid-template-columns: repeat(6, 1fr);
}

.programmer-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Financial Mode Styles */
.financial-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.fin-tab-btn {
    background: #3a3a3a;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.fin-tab-btn:hover {
    background: #4a4a4a;
}

.fin-tab-btn.active {
    background: #667eea;
}

.fin-content {
    display: none;
}

.fin-content.active {
    display: block;
}

.fin-content h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
}

.fin-input-group {
    margin-bottom: 15px;
}

.fin-input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.fin-input-group input,
.fin-input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
}

.fin-input-group input:focus,
.fin-input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.calculate-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 20px 0;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
}

.fin-results {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.fin-results h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #3a3a3a;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: #aaa;
}

.result-value {
    color: white;
    font-weight: bold;
}

.result-highlight {
    color: #667eea;
    font-size: 24px;
    font-weight: bold;
}

.amortization-table,
.depreciation-table {
    margin-top: 20px;
    overflow-x: auto;
}

.amortization-table table,
.depreciation-table table {
    width: 100%;
    border-collapse: collapse;
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
}

.amortization-table th,
.depreciation-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.amortization-table td,
.depreciation-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #3a3a3a;
    color: #ccc;
    font-size: 13px;
}

.amortization-table tr:hover,
.depreciation-table tr:hover {
    background: #3a3a3a;
}

.chart-container {
    margin-top: 20px;
    background: #2d2d2d;
    padding: 15px;
    border-radius: 10px;
}
/* Electrical Mode Styles */
.electrical-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.elec-tab-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.elec-tab-btn:hover {
    background: #4a4a4a;
}

.elec-tab-btn.active {
    background: #f39c12;
}

.elec-content {
    display: none;
}

.elec-content.active {
    display: block;
}

.elec-content h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
}

.formula-display {
    background: #2d2d2d;
    border-left: 4px solid #f39c12;
    padding: 15px;
    margin-bottom: 20px;
    color: #f39c12;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    text-align: center;
    border-radius: 5px;
}

.elec-input-group {
    margin-bottom: 15px;
}

.elec-input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.elec-input-group input,
.elec-input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
}

.elec-input-group input:focus,
.elec-input-group select:focus {
    outline: none;
    border-color: #f39c12;
}

.elec-results {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.elec-results h4 {
    color: #f39c12;
    margin-bottom: 15px;
    font-size: 18px;
}

.info-text {
    color: #888;
    font-size: 14px;
    margin-bottom: 15px;
    font-style: italic;
}

/* Resistor Mode Selector */
.resistor-mode-selector,
.capacitor-mode-selector,
.inductor-mode-selector,
.battery-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.resistor-mode-btn,
.cap-mode-btn,
.ind-mode-btn,
.bat-mode-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.resistor-mode-btn:hover,
.cap-mode-btn:hover,
.ind-mode-btn:hover,
.bat-mode-btn:hover {
    background: #4a4a4a;
}

.resistor-mode-btn.active,
.cap-mode-btn.active,
.ind-mode-btn.active,
.bat-mode-btn.active {
    background: #f39c12;
}

.resistor-calc-mode,
.capacitor-calc-mode,
.inductor-calc-mode,
.battery-calc-mode {
    display: none;
}

.resistor-calc-mode.active,
.capacitor-calc-mode.active,
.inductor-calc-mode.active,
.battery-calc-mode.active {
    display: block;
}

/* Color Band Selector */
.color-band-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.band-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.band-group label {
    color: #aaa;
    font-size: 13px;
}

.color-select {
    padding: 8px;
    border-radius: 5px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 14px;
}

.resistor-visual {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 30px;
    margin: 20px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resistor-body {
    width: 300px;
    height: 60px;
    background: #d4a574;
    border-radius: 5px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 20px;
}

.resistor-band {
    width: 15px;
    height: 60px;
    border-radius: 2px;
}

.resistor-lead {
    width: 50px;
    height: 3px;
    background: #888;
}

/* LED Presets */
.led-presets {
    margin-top: 20px;
    padding: 15px;
    background: #2d2d2d;
    border-radius: 8px;
}

.led-presets h4 {
    color: #f39c12;
    margin-bottom: 10px;
    font-size: 16px;
}

.preset-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    margin: 5px;
    font-size: 13px;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #f39c12;
}

/* Wire Gauge Table */
.wire-gauge-table {
    margin-top: 20px;
    overflow-x: auto;
}

.wire-gauge-table table {
    width: 100%;
    border-collapse: collapse;
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
}

.wire-gauge-table th {
    background: #f39c12;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.wire-gauge-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #3a3a3a;
    color: #ccc;
    font-size: 13px;
}

.wire-gauge-table tr:hover {
    background: #3a3a3a;
}

.wire-gauge-table .recommended {
    background: rgba(243, 156, 18, 0.2);
    font-weight: bold;
}

/* Automotive Mode Styles */
.automotive-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.auto-tab-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
}

.auto-tab-btn:hover {
    background: #4a4a4a;
}

.auto-tab-btn.active {
    background: #e74c3c;
}

.auto-content {
    display: none;
}

.auto-content.active {
    display: block;
}

.auto-content h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
}

.auto-input-group {
    margin-bottom: 15px;
}

.auto-input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.auto-input-group input,
.auto-input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
}

.auto-input-group input:focus,
.auto-input-group select:focus {
    outline: none;
    border-color: #e74c3c;
}

.auto-results {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.auto-results h4 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.unit-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.unit-btn:hover {
    background: #4a4a4a;
}

.unit-btn.active {
    background: #e74c3c;
}

.fuel-calc-mode {
    display: none;
}

.fuel-calc-mode.active {
    display: block;
}

/* Speed Mode Selector */
.speed-mode-selector,
.engine-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.speed-mode-btn,
.engine-mode-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.speed-mode-btn:hover,
.engine-mode-btn:hover {
    background: #4a4a4a;
}

.speed-mode-btn.active,
.engine-mode-btn.active {
    background: #e74c3c;
}

.speed-calc-mode,
.engine-calc-mode {
    display: none;
}

.speed-calc-mode.active,
.engine-calc-mode.active {
    display: block;
}

/* Tire Comparison */
.tire-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.tire-input-section h4 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
}

/* Maintenance Schedule */
.maintenance-schedule {
    margin-top: 20px;
    overflow-x: auto;
}

.maintenance-schedule table {
    width: 100%;
    border-collapse: collapse;
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
}

.maintenance-schedule th {
    background: #e74c3c;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.maintenance-schedule td {
    padding: 10px 12px;
    border-bottom: 1px solid #3a3a3a;
    color: #ccc;
    font-size: 13px;
}

.maintenance-schedule tr:hover {
    background: #3a3a3a;
}

.maintenance-schedule .due-soon {
    background: rgba(231, 76, 60, 0.2);
    font-weight: bold;
}

.maintenance-schedule .overdue {
    background: rgba(231, 76, 60, 0.4);
    font-weight: bold;
    color: #e74c3c;
}

/* Currency Toggle */
.currency-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.currency-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.currency-btn:hover {
    background: #4a4a4a;
}

.currency-btn.active {
    background: #27ae60;
}

/* Hide display section for non-calculator modes */
body:has(#financial-mode.active) .display-section,
body:has(#electrical-mode.active) .display-section,
body:has(#automotive-mode.active) .display-section,
body:has(#graph-mode.active) .display-section,
body:has(#converter-mode.active) .display-section {
    display: none;
}

@media (max-width: 768px) {
    .automotive-tabs {
        gap: 4px;
    }
    
    .auto-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .tire-comparison {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .electrical-tabs {
        gap: 4px;
    }
    
    .elec-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .color-band-selector {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .financial-tabs {
        gap: 5px;
    }
    
    .fin-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .amortization-table,
    .depreciation-table {
        font-size: 11px;
    }
}


/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

@media (max-width: 768px) {

    .btn {
        padding: 12px;
        font-size: 14px;
    }

    .result-display {
        font-size: 32px;
    }

    .conversion-inputs {
        flex-direction: column;
    }
}

/* Pharmaceutical Mode Styles */
.pharma-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.pharma-tab-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
}

.pharma-tab-btn:hover {
    background: #4a4a4a;
}

.pharma-tab-btn.active {
    background: #16a085;
}

.pharma-content {
    display: none;
}

.pharma-content.active {
    display: block;
}

.pharma-content h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
}

.pharma-input-group {
    margin-bottom: 15px;
}

.pharma-input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.pharma-input-group input,
.pharma-input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
}

.pharma-input-group input:focus,
.pharma-input-group select:focus {
    outline: none;
    border-color: #16a085;
}

.pharma-results {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.pharma-results h4 {
    color: #16a085;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Mode Selectors */
.dosage-mode-selector,
.infusion-mode-selector,
.pediatric-mode-selector,
.renal-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.dosage-mode-btn,
.infusion-mode-btn,
.pediatric-mode-btn,
.renal-mode-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.dosage-mode-btn:hover,
.infusion-mode-btn:hover,
.pediatric-mode-btn:hover,
.renal-mode-btn:hover {
    background: #4a4a4a;
}

.dosage-mode-btn.active,
.infusion-mode-btn.active,
.pediatric-mode-btn.active,
.renal-mode-btn.active {
    background: #16a085;
}

.dosage-calc-mode,
.infusion-calc-mode,
.pediatric-calc-mode,
.renal-calc-mode {
    display: none;
}

.dosage-calc-mode.active,
.infusion-calc-mode.active,
.pediatric-calc-mode.active,
.renal-calc-mode.active {
    display: block;
}

/* Conversion Inputs */
.conversion-pharma-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.conversion-pharma-inputs .input-group {
    flex: 1;
}

.conversion-pharma-inputs .input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.conversion-pharma-inputs .input-group input,
.conversion-pharma-inputs .input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
}

/* Compatibility Note */
.compatibility-note {
    background: #2d2d2d;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
}

.compatibility-note h4 {
    color: #e74c3c;
    margin-bottom: 10px;
    font-size: 16px;
}

.compatibility-note ul {
    color: #aaa;
    margin-left: 20px;
    font-size: 14px;
}

.compatibility-note li {
    margin-bottom: 5px;
}

/* Warning/Success Messages */
.warning-message {
    background: rgba(231, 76, 60, 0.2);
    border-left: 4px solid #e74c3c;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #e74c3c;
}

.success-message {
    background: rgba(46, 204, 113, 0.2);
    border-left: 4px solid #2ecc71;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #2ecc71;
}

.caution-message {
    background: rgba(241, 196, 15, 0.2);
    border-left: 4px solid #f1c40f;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #f1c40f;
}

@media (max-width: 768px) {
    .pharma-tabs {
        gap: 4px;
    }
    
    .pharma-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .conversion-pharma-inputs {
        flex-direction: column;
    }
}

/* Bodybuilding Mode Styles */
.bb-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.bb-tab-btn {
    background: #3a3a3a;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
}

.bb-tab-btn:hover {
    background: #4a4a4a;
}

.bb-tab-btn.active {
    background: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
}

.bb-content {
    display: none;
}

.bb-content.active {
    display: block;
}

.bb-content h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
}

.bb-input-group {
    margin-bottom: 15px;
}

.bb-input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 14px;
}

.bb-input-group input,
.bb-input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #3a3a3a;
    background: #2d2d2d;
    color: white;
    font-size: 16px;
}

.bb-input-group input:focus,
.bb-input-group select:focus {
    outline: none;
    border-color: #f39c12;
}

.bb-results {
    background: #2d2d2d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.bb-results h4 {
    color: #f39c12;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Cycle Schedule Table */
.cycle-schedule {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.cycle-schedule th,
.cycle-schedule td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #3a3a3a;
}

.cycle-schedule th {
    background: #3a3a3a;
    color: #f39c12;
    font-weight: bold;
}

.cycle-schedule tr:hover {
    background: #3a3a3a;
}

/* Warning Boxes */
.bb-warning {
    background: rgba(231, 76, 60, 0.2);
    border-left: 4px solid #e74c3c;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #e74c3c;
}

.bb-info {
    background: rgba(52, 152, 219, 0.2);
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #3498db;
}

.bb-success {
    background: rgba(46, 204, 113, 0.2);
    border-left: 4px solid #2ecc71;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    color: #2ecc71;
}

/* Half-Life Chart */
.halflife-chart {
    margin-top: 20px;
    padding: 15px;
    background: #3a3a3a;
    border-radius: 8px;
}

.halflife-bar {
    height: 30px;
    background: linear-gradient(90deg, #f39c12 0%, #e74c3c 100%);
    border-radius: 5px;
    margin: 10px 0;
    position: relative;
}

.halflife-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: bold;
}

@media (max-width: 768px) {
    .bb-tabs {
        gap: 4px;
    }
    
    .bb-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Enhanced Cycle Planner Styles */
.compound-entry {
    background: #3a3a3a;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    position: relative;
}

.compound-entry h5 {
    color: #f39c12;
    margin-bottom: 10px;
    font-size: 16px;
}

.remove-compound {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.remove-compound:hover {
    background: #c0392b;
}

.compound-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

/* Graph Canvas Styles */
#bloodConcentrationGraph {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

#concentrationCanvas {
    background: #1e1e1e;
    border-radius: 8px;
    width: 100%;
    height: auto;
    max-width: 700px;
}

#graphLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
}

.legend-color {
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

/* 1RM Table Styles */
.rm-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.rm-table th,
.rm-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #3a3a3a;
}

.rm-table th {
    background: #3a3a3a;
    color: #f39c12;
    font-weight: bold;
}

.rm-table tr:hover {
    background: #3a3a3a;
}

.rm-table td:first-child {
    font-weight: bold;
    color: #f39c12;
}

/* Body Fat Visual Guide */
.bf-visual-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.bf-category {
    background: #3a3a3a;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.bf-category h5 {
    color: #f39c12;
    margin-bottom: 5px;
    font-size: 14px;
}

.bf-category p {
    color: #aaa;
    font-size: 12px;
    margin: 5px 0;
}

.bf-range {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .compound-row {
        grid-template-columns: 1fr;
    }
    
    #concentrationCanvas {
        width: 100%;
        height: 300px;
    }
    
    .bf-visual-guide {
        grid-template-columns: 1fr;
    }
}

/* ✅ Mobile optimization WITHOUT changing button order */
@media (max-width: 480px) {

    /* Keep original 6-column layout to preserve button order */
    .button-grid,
    .basic-grid,
    .scientific-grid,
    .programmer-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 5px;
    }

    /* Make buttons smaller instead of changing layout */
    .btn {
        padding: 8px;
        font-size: 12px;
    }

    /* Prevent any accidental horizontal overflow */
    .calculator-container,
    .mode-content {
        overflow-x: hidden;
    }
}
