/* Toyman Rater Mock UI - Controls Styles */

/* Button Grid Layout */
.button-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.button-row {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.button-spacer {
    width: 50px;
    height: 50px;
}

/* Base Button Styles */
.btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.95);
}

/* Navigation Buttons (Arrow keys) */
.btn-nav {
    background: linear-gradient(145deg, #3a4a5a, #2a3a4a);
    color: var(--text-primary);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-nav:hover {
    background: linear-gradient(145deg, #4a5a6a, #3a4a5a);
}

.btn-nav:active {
    background: linear-gradient(145deg, #2a3a4a, #1a2a3a);
    box-shadow:
        0 2px 3px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-nav.pressed {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* OK Button */
.btn-ok {
    background: linear-gradient(145deg, #00aa00, #008800);
    color: white;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-ok:hover {
    background: linear-gradient(145deg, #00cc00, #00aa00);
}

.btn-ok:active,
.btn-ok.pressed {
    background: linear-gradient(145deg, #006600, #004400);
    box-shadow:
        0 2px 3px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Special Buttons Row */
.button-row-special {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Menu Button */
.btn-menu {
    background: linear-gradient(145deg, #5555aa, #444499);
    color: white;
    width: 70px;
    font-size: 0.9rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-menu:hover {
    background: linear-gradient(145deg, #6666bb, #5555aa);
}

.btn-menu:active,
.btn-menu.pressed {
    background: linear-gradient(145deg, #333377, #222266);
}

/* Rate Button */
.btn-rate {
    background: linear-gradient(145deg, #009988, #007766);
    color: white;
    width: 70px;
    font-size: 0.9rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-rate:hover {
    background: linear-gradient(145deg, #00bbaa, #009988);
}

.btn-rate:active,
.btn-rate.pressed {
    background: linear-gradient(145deg, #006655, #004433);
}

/* Mode Button */
.btn-mode {
    background: linear-gradient(145deg, #aa5500, #884400);
    color: white;
    width: 70px;
    font-size: 0.9rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-mode:hover {
    background: linear-gradient(145deg, #cc6600, #aa5500);
}

.btn-mode:active,
.btn-mode.pressed {
    background: linear-gradient(145deg, #663300, #442200);
}

/* ESC Button */
.btn-esc {
    background: linear-gradient(145deg, #aa3333, #883333);
    color: white;
    width: 70px;
    font-size: 0.9rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-esc:hover {
    background: linear-gradient(145deg, #cc4444, #aa3333);
}

.btn-esc:active,
.btn-esc.pressed {
    background: linear-gradient(145deg, #662222, #441111);
}

/* Switch Group */
.switch-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.switch-group > label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Valve Toggle */
.switch-toggle {
    width: 100%;
    height: 40px;
    background: linear-gradient(145deg, #333, #222);
    border: 2px solid #444;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-toggle:hover {
    border-color: #666;
}

.switch-toggle.active {
    background: linear-gradient(145deg, #00aa00, #008800);
    border-color: #00cc00;
    color: white;
}

.switch-toggle.active .switch-label::before {
    content: 'ON';
}

.switch-toggle:not(.active) .switch-label::before {
    content: 'OFF';
}

/* Section Switches */
.section-switches {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.switch-section {
    width: 36px;
    height: 36px;
    background: linear-gradient(145deg, #333, #222);
    border: 2px solid #444;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-section:hover {
    border-color: #666;
}

.switch-section.active {
    background: linear-gradient(145deg, #00aa00, #008800);
    border-color: #00cc00;
    color: white;
}

.switch-section.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Rate Control Switch (3-position) */
.rate-switch {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-panel);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
}

.rate-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #444, #333);
    border: 2px solid #555;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.rate-btn:hover {
    background: linear-gradient(145deg, #555, #444);
    border-color: #666;
}

.rate-btn.active {
    background: linear-gradient(145deg, var(--accent-primary), #0099cc);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.rate-indicator {
    width: 40px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-primary);
}

/* E-Stop Switch */
.switch-estop {
    width: 100%;
    height: 50px;
    background: linear-gradient(145deg, #aa0000, #880000);
    border: 3px solid #cc0000;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 4px 10px rgba(255, 0, 0, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.switch-estop:hover {
    background: linear-gradient(145deg, #cc0000, #aa0000);
}

.switch-estop.active {
    background: linear-gradient(145deg, #ff0000, #cc0000);
    border-color: #ff3333;
    box-shadow:
        0 0 20px rgba(255, 0, 0, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    animation: estop-pulse 1s infinite;
}

@keyframes estop-pulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(255, 0, 0, 0.5),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow:
            0 0 40px rgba(255, 0, 0, 0.8),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    }
}

/* Config Menu Button */
.btn-config {
    width: 100%;
    height: 40px;
    background: linear-gradient(145deg, #3a5a7a, #2a4a6a);
    border: 2px solid #4a6a8a;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-config:hover {
    background: linear-gradient(145deg, #4a6a8a, #3a5a7a);
    border-color: #5a7a9a;
}

.btn-config:active {
    background: linear-gradient(145deg, #2a4a6a, #1a3a5a);
    transform: scale(0.98);
}

/* Admin Menu Button */
.btn-admin {
    width: 100%;
    height: 40px;
    background: linear-gradient(145deg, #6a3a5a, #5a2a4a);
    border: 2px solid #7a4a6a;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-admin:hover {
    background: linear-gradient(145deg, #7a4a6a, #6a3a5a);
    border-color: #8a5a7a;
}

.btn-admin:active {
    background: linear-gradient(145deg, #5a2a4a, #4a1a3a);
    transform: scale(0.98);
}

/* Sensor Controls */
.sensor-group {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.sensor-group > label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sensor-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--bg-panel);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.sensor-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sensor-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.sensor-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-success);
    text-align: right;
}

/* Checkbox group */
.checkbox-group {
    grid-template-columns: 1fr;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-success);
}

/* Touch-friendly adjustments */
@media (pointer: coarse) {
    .btn {
        width: 60px;
        height: 60px;
    }

    .switch-section {
        width: 44px;
        height: 44px;
    }

    .rate-btn {
        width: 50px;
        height: 50px;
    }
}
