/* ============================================
   CalSim Web - Skeuomorphic Industrial UI
   ============================================ */

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #121212;
}

/* ---- Instrument Panel Container ---- */
.instrument-panel {
    background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 50%, #181818 100%);
    border-radius: 12px;
    border: 2px solid #444;
    padding: 16px;
    box-shadow:
        0 6px 20px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.08),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    position: relative;
}

.instrument-panel::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 12px;
    right: 12px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.instrument-label {
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #03dac6;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(3,218,198,0.3);
}

/* ---- LCD Display ---- */
.lcd-display {
    background: #0a0e0a;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 6px 12px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.8);
}

.lcd-value {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 8px currentColor;
}

.lcd-unit {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    margin-left: 4px;
}

/* ---- Industrial Buttons ---- */
.industrial-btn {
    display: block;
    padding: 10px 8px;
    border-radius: 6px;
    border: 1px solid #555;
    color: white;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow:
        0 3px 0 #111,
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.15);
}

.industrial-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 1px 0 #111,
        0 2px 4px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.industrial-btn-primary {
    background: linear-gradient(180deg, #7c3aed, #5b21b6);
    border-color: #8b5cf6;
}
.industrial-btn-primary:hover {
    background: linear-gradient(180deg, #8b5cf6, #6d28d9);
}

.industrial-btn-secondary {
    background: linear-gradient(180deg, #4a4a4a, #333);
    border-color: #666;
}
.industrial-btn-secondary:hover {
    background: linear-gradient(180deg, #555, #3a3a3a);
}

.industrial-btn-danger {
    background: linear-gradient(180deg, #d32f2f, #b71c1c);
    border-color: #ef5350;
}
.industrial-btn-danger:hover {
    background: linear-gradient(180deg, #e53935, #c62828);
}

/* ---- Beamex Device Buttons ---- */
.device-btn {
    display: block;
    padding: 8px 6px;
    border-radius: 4px;
    border: 1px solid #666;
    color: white;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow:
        0 2px 0 #111,
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.device-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #111;
}

.device-btn:hover {
    filter: brightness(1.15);
}

/* ---- Trim Pot Buttons (Zero/Span) ---- */
.trim-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #555;
    color: white;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 0 #111, inset 0 1px 0 rgba(255,255,255,0.1);
}

.trim-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #111;
}

.trim-btn-teal {
    background: linear-gradient(180deg, #00695c, #004d40);
    border-color: #00897b;
}
.trim-btn-teal:hover { background: linear-gradient(180deg, #00796b, #00695c); }

.trim-btn-purple {
    background: linear-gradient(180deg, #4a148c, #311b92);
    border-color: #7b1fa2;
}
.trim-btn-purple:hover { background: linear-gradient(180deg, #6a1b9a, #4a148c); }

/* ---- LED Indicators ---- */
.led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.5);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.5);
}

.led-green {
    background: radial-gradient(circle at 40% 35%, #81c784, #2e7d32);
    box-shadow: 0 0 6px #4caf50, 0 0 12px rgba(76,175,80,0.3), inset 0 -1px 2px rgba(0,0,0,0.5);
}

.led-amber {
    background: radial-gradient(circle at 40% 35%, #ffcc02, #e65100);
    box-shadow: 0 0 6px #ff9800, 0 0 12px rgba(255,152,0,0.3), inset 0 -1px 2px rgba(0,0,0,0.5);
}

.led-red {
    background: radial-gradient(circle at 40% 35%, #ef5350, #b71c1c);
    box-shadow: 0 0 6px #f44336, 0 0 12px rgba(244,67,54,0.4), inset 0 -1px 2px rgba(0,0,0,0.5);
    animation: led-blink 1s ease-in-out infinite;
}

@keyframes led-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   Pump Body - Physical appearance
   ============================================ */
.pump-body {
    background: linear-gradient(180deg, #3a3a3a, #2a2a2a, #1e1e1e);
    border: 2px solid #555;
    border-radius: 12px;
    padding: 10px;
    position: relative;
    box-shadow: 0 6px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Handle area (top of pump) */
.pump-handle-area {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}
.pump-handle {
    transition: transform 0.3s ease-out;
}
.pump-handle-grip {
    width: 80px;
    height: 14px;
    background: linear-gradient(180deg, #666, #444, #333);
    border-radius: 7px;
    border: 1px solid #777;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    cursor: grab;
}
.pump-handle-rod {
    width: 8px;
    height: 18px;
    background: linear-gradient(90deg, #777, #aaa, #777);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 1px 0 2px rgba(0,0,0,0.3);
}

/* Gauge housing (circular bezel mount) */
.pump-gauge-housing {
    display: flex;
    justify-content: center;
    padding: 4px;
    background: radial-gradient(circle, #3a3a3a, #2a2a2a);
    border-radius: 50%;
    width: 182px;
    height: 182px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid #555;
}

/* Hose connector at bottom */
.pump-hose {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    gap: 0;
}
.pump-hose-connector {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 40% 35%, #999, #555);
    border-radius: 50%;
    border: 2px solid #777;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.pump-hose-line {
    height: 4px;
    width: 60px;
    border-radius: 2px;
}

/* ============================================
   Needle Animation (CSS driven)
   ============================================ */
.needle-animated {
    transform: rotate(var(--needle-deg));
    transform-origin: 100px 100px;
    animation: needle-settle 0.8s cubic-bezier(0.3, 1.5, 0.5, 1) forwards;
}

@keyframes needle-settle {
    0%   { transform: rotate(calc(var(--needle-deg) - 8deg)); }
    30%  { transform: rotate(calc(var(--needle-deg) + 3deg)); }
    60%  { transform: rotate(calc(var(--needle-deg) - 1.5deg)); }
    100% { transform: rotate(var(--needle-deg)); }
}

/* Pump button press animation */
.pump-btn-animate:active {
    animation: pump-press 0.15s ease-out;
}
@keyframes pump-press {
    0%   { transform: scale(1); }
    50%  { transform: scale(0.95) translateY(2px); }
    100% { transform: scale(1); }
}

/* Pulse glow when pressure > 80% of gauge */
@keyframes pressure-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3); }
    50%      { box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3), 0 0 15px rgba(244,67,54,0.3); }
}

/* ---- Calibrator Buttons ---- */
.mc2-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border: 2px solid #555;
    color: white;
    font-size: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 3px 0 #111, 0 4px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.mc2-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #111, inset 0 1px 0 rgba(255,255,255,0.1);
}
.mc2-btn-label {
    font-size: 7px;
    opacity: 0.6;
    display: block;
    margin-bottom: 1px;
}
.mc2-btn-green {
    background: linear-gradient(180deg, #2e7d32, #1b5e20);
    border-color: #4caf50;
}
.mc2-btn-green:hover { background: linear-gradient(180deg, #388e3c, #2e7d32); }
.mc2-btn-gray {
    background: linear-gradient(180deg, #555, #333);
    border-color: #777;
}
.mc2-btn-gray:hover { background: linear-gradient(180deg, #666, #444); }
.mc2-btn-red {
    background: linear-gradient(180deg, #c62828, #b71c1c);
    border-color: #ef5350;
}
.mc2-btn-red:hover { background: linear-gradient(180deg, #d32f2f, #c62828); }

/* ---- HTMX Transitions ---- */
.htmx-swapping {
    opacity: 0.7;
    transition: opacity 0.1s ease-out;
}

/* ---- Scrollbar (dark) ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ---- Data table hover ---- */
tr:hover td {
    background-color: rgba(139, 92, 246, 0.08);
}
