/* AutrixWeb — components.css: Controles, secciones, ajustes, status, dibujo, sonido y tarjetas.
 * Rango contiguo 126-3105 del antiguo styles.css: el orden relativo
 * se conserva para no alterar la cascada. */
/* Unified Control Container */
/* Power Toggle Switch */
.power-toggle-container {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding: 5px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 44px;
    display: flex;
    align-items: center;
}

.power-toggle-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #3a5065 0%, #34495e 100%);
}

.power-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.power-toggle-text {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.power-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    flex-shrink: 0;
}

.power-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.power-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    border-radius: 30px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.power-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #ecf0f1 100%);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.power-toggle input:checked+.power-toggle-slider {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
}

.power-toggle input:checked+.power-toggle-slider:before {
    transform: translateX(30px);
    background: linear-gradient(135deg, #fff 0%, #ecf0f1 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.power-toggle:hover .power-toggle-slider {
    transform: scale(1.05);
}

.power-toggle input:checked+.power-toggle-slider:hover {
    box-shadow: 0 0 25px rgba(39, 174, 96, 0.6);
}

/* Sound Toggle Switch */
.sound-toggle-container {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding: 5px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 44px;
    display: flex;
    align-items: center;
}

.sound-toggle-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #3a5065 0%, #34495e 100%);
}

.sound-toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.sound-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
    flex-shrink: 0;
}

.sound-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sound-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    border-radius: 32px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sound-toggle-slider::before {
    position: absolute;
    content: "\f026";
    /* fa-volume-off */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #ecf0f1 100%);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    line-height: 1;
}

.sound-toggle input:checked+.sound-toggle-slider {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
}

.sound-toggle input:checked+.sound-toggle-slider::before {
    transform: translateX(28px);
    content: "\f028";
    /* fa-volume-up */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #2c3e50;
}

.sound-toggle:hover .sound-toggle-slider {
    transform: scale(1.05);
}

.sound-toggle input:checked+.sound-toggle-slider:hover {
    box-shadow: 0 0 25px rgba(39, 174, 96, 0.6);
}

/* Reboot Button */
.reboot-button-container {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding: 5px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    height: 44px;
    display: flex;
    align-items: center;
}

.reboot-button-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.reboot-button-container button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.reboot-button-container button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.reboot-button-container button:active {
    transform: scale(0.95);
}

.reboot-button-container button i {
    transition: transform 0.3s ease;
}

.reboot-button-container button:hover i {
    transform: rotate(180deg);
}

.sleep-control {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding: 5px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    height: 44px;
}

.sleep-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #3a5065 0%, #34495e 100%);
}

.sleep-control input {
    width: 50px;
    margin: 0;
    padding: 6px 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sleep-control input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.sleep-control input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.sleep-control button {
    margin: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    transition: all 0.3s ease;
}

.sleep-control button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.header h2 {
    margin: 0 0 15px 0;
    color: #273c75;
}

.sidebar input#dev_ip {
    border: none;
    background: #34495e;
    color: #ecf0f1;
    font-size: 14px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    width: auto;
}

.sidebar input#dev_ip:focus {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 2px #2c5aa0;
    outline: none;
}

.sidebar-canvas-container {
    padding: 10px 15px 15px;
    display: flex;
    justify-content: center;
}

.sidebar-canvas-container canvas {
    background: #181c21;
    border-radius: 5px;
    border: 8px solid #181c21;
    box-shadow:
        0 2px 16px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px #0a0c0e,
        inset 0 0 10px rgba(0, 0, 0, 0.4);
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
    display: block;
}

/* Sections */
.section {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
    display: none;
    width: 100%;
}

.section.active {
    display: block;
}

.section h3 {
    margin-top: 0;
    color: #273c75;
    border-bottom: 2px solid #2c5aa0;
    padding-bottom: 10px;
}

/* Form elements */
label {
    font-weight: bold;
    display: block;
    margin-top: 12px;
    color: #333;
}

input,
select,
textarea {
    margin-top: 4px;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

button {
    margin-top: 12px;
    background: #2c5aa0;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

button:hover {
    background: #1e4a8a;
}

.result {
    background: #dff9fb;
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    border: 1px solid #b2ebf2;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.colorbox {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.colpreview {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 2px solid #ccc;
}

/* Ajustes: una fila por setting (lista plana, sin desplegable) */
.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    margin-top: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.setting-row-head {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1 1 180px;
}

.setting-row-name {
    font-weight: 600;
    font-family: monospace;
    font-size: 13px;
    color: #0f172a;
}

.setting-row-desc {
    font-size: 12px;
    color: #64748b;
}

.setting-row-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2 1 220px;
}

.setting-row-ctrl input[type="number"],
.setting-row-ctrl select,
.setting-row-ctrl input[type="text"] {
    max-width: 220px;
}

.setting-row-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
}

.setting-row-check input {
    width: auto;
    margin: 0;
}

.setting-row-actions {
    display: flex;
    gap: 6px;
}

.setting-row-status {
    font-size: 12px;
    color: #475569;
    flex-basis: 100%;
}

/* Status Container - Centered and width-constrained */
.status-container {
    max-width: 750px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border-radius: 7px;
    box-shadow: 0 1px 4px #ccc;
}

/* Generic Section Container - Centered and width-constrained */
.section-container {
    max-width: 750px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border-radius: 7px;
    box-shadow: 0 1px 4px #ccc;
    width: 100%;
    box-sizing: border-box;
}

.status-preview {
    background: #fff;
    border-radius: 7px;
    box-shadow: 0 1px 4px #ccc;
    margin-bottom: 10px;
    display: block;
    width: 100%;
    padding: 20px;
}

.status-preview.active {
    display: block;
}

.canvas-with-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 0 auto 24px;
    max-width: 800px;
    width: 100%;
}

.status-preview canvas {
    background: #181c21;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.7);
    image-rendering: pixelated;
    border-radius: 7px;
    border: 12px solid #181c21;
    box-shadow:
        0 4px 32px rgba(0, 0, 0, 0.7),
        inset 0 0 0 2px #0a0c0e,
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 578px;
    width: 100%;
    height: auto;
}

.canvas-indicators {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    height: 120px;
}

.canvas-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.canvas-indicator:hover {
    border-color: #2c5aa0;
    background: #e9ecef;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.2);
}

.canvas-indicator.active {
    background: linear-gradient(135deg, #2c5aa0 0%, #273c75 100%);
    border-color: #1e3a6d;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.4);
}

.canvas-indicator-led {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.canvas-indicator-led:hover {
    transform: scale(1.1);
    border-color: #495057;
}

.canvas-indicator-led:active {
    transform: scale(0.95);
}

/* Canvas indicator LED colors */
.canvas-indicator-led-red {
    background: #ff4757;
}

.canvas-indicator-led-green {
    background: #2ed573;
}

.canvas-indicator-led-blue {
    background: #3742fa;
}

.canvas-indicator.active .canvas-indicator-led {
    border-color: white;
    box-shadow:
        0 0 16px currentColor,
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse{

    0%,
    100% {
        box-shadow:
            0 0 16px currentColor,
            0 2px 8px rgba(0, 0, 0, 0.3),
            inset 0 0 10px rgba(255, 255, 255, 0.5);
    }

    50% {
        box-shadow:
            0 0 24px currentColor,
            0 2px 8px rgba(0, 0, 0, 0.3),
            inset 0 0 14px rgba(255, 255, 255, 0.6);
    }
}

.canvas-indicator input[type="color"] {
    width: 28px;
    height: 28px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.canvas-indicator input[type="color"]:hover {
    border-color: #2c5aa0;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.3);
}

.canvas-indicator.active input[type="color"] {
    border-color: white;
}

/* Mood Lighting Controls */
.moodlight-controls {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.moodlight-header {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.moodlight-header h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.moodlight-header i {
    margin-right: 8px;
}

.moodlight-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.moodlight-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.moodlight-toggle-btn.active {
    background: #27ae60;
    border-color: #229954;
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.6);
}

.moodlight-toggle-btn.active:hover {
    background: #229954;
}

.moodlight-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.moodlight-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.moodlight-color-row label {
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.moodlight-color-row input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px;
    margin: 0;
}

.moodlight-color-row input[type="color"]:hover {
    border-color: #f39c12;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

#moodlight_color {
    transition: all 0.3s ease;
}

#moodlight_kelvin {
    transition: all 0.3s ease;
}

.moodlight-slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.moodlight-slider-group label {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.moodlight-slider-group label span {
    color: #f39c12;
    font-weight: 700;
}

.kelvin-label {
    font-size: 12px;
    padding: 2px 8px;
    background: #e67e22;
    color: white;
    border-radius: 12px;
    font-weight: 600;
}

.moodlight-slider-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #ddd 0%, #ddd 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
}

.moodlight-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f39c12;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.moodlight-slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #e67e22;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.moodlight-slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f39c12;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.moodlight-slider-group input[type="range"]::-moz-range-thumb:hover {
    background: #e67e22;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

#moodlight_brightness::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #34495e 0%, #f39c12 100%);
    height: 8px;
    border-radius: 4px;
}

#moodlight_kelvin::-webkit-slider-runnable-track {
    background: linear-gradient(to right,
            #ff6b35 0%,
            /* 1500K - Cálida/Vela */
            #ffaa5a 20%,
            /* 2700K - Incandescente */
            #ffd89b 45%,
            /* 4000K - Neutra */
            #dfe6e9 70%,
            /* 5500K - Día */
            #a4b0bd 100%
            /* 6500K - Fría */
        );
    height: 8px;
    border-radius: 4px;
}

.kelvin-markers {
    margin-top: 8px;
    padding: 0;
    position: relative;
    width: 100%;
    height: 40px;
}

.kelvin-markers span {
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 6px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    position: absolute;
    transform: translateX(-50%);
}

/* Posicionamiento proporcional basado en el rango 1500-6500K */
.kelvin-markers span[data-kelvin="1500"] {
    left: 0%;
}

.kelvin-markers span[data-kelvin="2700"] {
    left: 24%;
    /* (2700-1500)/(6500-1500) = 0.24 */
}

.kelvin-markers span[data-kelvin="4000"] {
    left: 50%;
    /* (4000-1500)/(6500-1500) = 0.50 */
}

.kelvin-markers span[data-kelvin="5500"] {
    left: 80%;
    /* (5500-1500)/(6500-1500) = 0.80 */
}

.kelvin-markers span[data-kelvin="6500"] {
    left: 100%;
}

.kelvin-markers span:hover {
    transform: translateX(-50%) scale(1.2);
    background: rgba(243, 156, 18, 0.2);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.kelvin-markers span:active {
    transform: translateX(-50%) scale(1.1);
    background: rgba(243, 156, 18, 0.4);
}

.kelvin-markers span.active-kelvin {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.5);
    transform: translateX(-50%) scale(1.15);
    animation: kelvinPulse 2s ease-in-out infinite;
}

@keyframes kelvinPulse{

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(243, 156, 18, 0.5);
    }

    50% {
        box-shadow: 0 6px 20px rgba(243, 156, 18, 0.8);
    }
}

/* Loop Apps Controls */
.loop-controls {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.loop-header {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.loop-header h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.loop-header i {
    margin-right: 8px;
}

.loop-body {
    padding: 18px;
}

.loop-transition-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: #eef7f1;
    border: 1px solid #cfe9d9;
    border-radius: 8px;
}

.loop-transition-control__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1e7a4d;
}

.loop-transition-control__label i {
    margin: 0;
}

.loop-transition-control__input {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.loop-transition-control__input input {
    width: 72px;
    padding: 6px 8px;
    border: 2px solid #cfe9d9;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    box-sizing: border-box;
}

.loop-transition-control__input input:focus {
    outline: none;
    border-color: #27ae60;
}

.loop-transition-control__unit {
    font-size: 12px;
    color: #555;
}

.loop-transition-control__apply {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #27ae60;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.loop-transition-control__apply:hover {
    background: #1e8449;
    transform: scale(1.05);
}

.loop-header .status-navigation {
    gap: 6px;
}

.loop-header .status-navigation button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    box-sizing: border-box;
}

.loop-header .status-navigation button i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.loop-header .status-navigation button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

/* Velo de pantalla en modo cloud */
.canvas-with-indicators {
    position: relative;
}

.cloud-screen-veil {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 14, 0.62);
    border-radius: 7px;
    pointer-events: none;
    z-index: 5;
}

.cloud-screen-veil span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Barra de comandos cloud (Status, solo modo cloud) */
.cloud-cmd-bar {
    background: #eef4ff;
    border: 2px solid #b9cdf3;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.cloud-cmd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3c6fd1 0%, #2c5aa0 100%);
}

.cloud-cmd-header h4 {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.cloud-cmd-header h4 i {
    margin-right: 8px;
}

.cloud-cmd-count {
    display: inline-block;
    min-width: 22px;
    text-align: center;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 11px;
    padding: 1px 7px;
    font-size: 13px;
    margin-left: 6px;
}

.cloud-cmd-actions {
    display: flex;
    gap: 8px;
}

.cloud-cmd-actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #2c5aa0;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.cloud-cmd-actions button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.cloud-cmd-actions .cloud-cmd-discard {
    padding: 7px 10px;
    color: #c0392b;
}

.cloud-cmd-list {
    padding: 8px 16px;
    display: grid;
    gap: 6px;
}

.cloud-cmd-list:empty {
    display: none;
}

.cloud-cmd-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #d4e0f5;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    color: #333;
}

.cloud-cmd-item button {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
}

.cloud-cmd-hint {
    margin: 0;
    padding: 0 16px 10px;
    font-size: 12px;
    color: #5a6d94;
}

.cloud-cmd-ts {
    margin: 0;
    padding: 2px 16px 4px;
    font-size: 12px;
    color: #5a6d94;
}

.cloud-cmd-ts span {
    font-weight: 700;
    color: #2c5aa0;
}

.loop-buttons {
    display: grid;
    gap: 12px;
    justify-content: center;
    margin: 0;
}

.loop-buttons__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.loop-buttons__row--native {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 8px;
}

.loop-buttons__row--custom {
    padding-top: 6px;
}

.loop-buttons__empty {
    font-style: italic;
    color: #666;
    margin: 0;
}

.app-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f5f6fa;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    min-width: auto;
    justify-content: space-between;
    min-height: 64px;
}

.app-card--native {
    min-width: auto;
}

.app-card--inactive {
    background: #f0f0f0;
    opacity: 0.85;
}

.app-card--custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #5a67d8;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Script cards: distinct gradient + chip icon so they read as code, not as
   a pushed app. Disabled state dims the card and swaps the toggle to a
   positive "Habilitar" affordance. */
.app-card--script {
    background: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
    border: 2px solid #2c7a51;
    box-shadow: 0 2px 8px rgba(44, 122, 81, 0.3);
    color: #fff;
    min-width: 260px;
}

.app-card--script.app-card--disabled {
    opacity: 0.55;
    filter: grayscale(0.7);
    background: linear-gradient(135deg, #4a4a4a 0%, #888 100%);
    border-color: #555;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.app-card--script .app-button--icon-script {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-card--script .app-button--icon-script:hover {
    transform: scale(1.06);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
}

.app-card--script .app-card__info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 0 6px;
}

.app-card--script .app-card__label {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-card--script .app-card__kind {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.app-card--script .app-card__actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.app-card--script .app-button--toggle {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    transition: all 0.2s ease;
}

.app-card--script .app-button--toggle:hover {
    background: rgba(255, 255, 255, 0.32);
}

.app-card--script .app-button--toggle-on {
    background: rgba(255, 196, 0, 0.85);
    border-color: rgba(255, 196, 0, 0.95);
    color: #2d2200;
}

.app-card--script .app-button--toggle-off {
    background: rgba(40, 167, 69, 0.95);
    border-color: rgba(40, 167, 69, 1);
    color: #fff;
}

.app-card--script .app-button--edit {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.95);
    color: #134e5e;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transition: all 0.2s ease;
}

.app-card--script .app-button--edit i {
    pointer-events: none;
    font-size: 13px;
}

.app-card--script .app-button--edit:hover {
    background: #fff;
    transform: scale(1.06);
}

.loop-buttons__row--scripts {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-direction: column;
    align-items: stretch;
}

.loop-buttons__row--script-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.loop-buttons__row--script-cards-disabled {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.12);
}

/* Bloque de sistema (maestro): infraestructura del modo nube, no un widget.
   Separado con línea discontinua y en gris discreto para que no se confunda
   con el resto ni se borre por accidente. */
.loop-buttons__system {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.loop-buttons__row-subtitle--system {
    color: #999;
}

.loop-buttons__system-note {
    font-size: 11px;
    color: #999;
    font-style: italic;
    margin: 0;
}

.app-card--script.app-card--maestro {
    background: #eceff1;
    border: 1px dashed #9aa5ad;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    opacity: 0.95;
}

.app-card--script.app-card--maestro.app-card--disabled {
    opacity: 0.55;
    filter: grayscale(0.7);
}

.app-card--script.app-card--maestro .app-card__label {
    color: #495057;
}

.app-card--script.app-card--maestro .app-card__kind {
    color: #868e96;
}

.app-card--maestro__badge {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px dashed rgba(0, 0, 0, 0.2);
    color: #6c757d;
    margin: 0;
}

/* Insignia estática para scripts headless (p. ej. nube_cmd): mismo sitio
   que el botón de mostrar, pero sin parecer pulsable porque no hay nada
   que fijar en pantalla. */
.app-card--script .app-card--script__badge {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
    padding: 0;
    margin: 0;
    cursor: default;
}

/* Borrar el maestro: botón fantasma para que no invite al clic; en hover
   avisa en rojo. La protección real es la doble confirmación del modal.
   (Triple clase para imponerse al .app-button--delete:hover genérico.) */
.app-button--delete.app-button--delete-subtle {
    background: transparent;
    border: 1px solid transparent;
    color: #adb5bd;
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.app-button--delete.app-button--delete-subtle:hover {
    background: #fff5f5;
    border-color: #ffc9c9;
    color: #c92a2a;
    transform: none;
    box-shadow: none;
}

.loop-buttons__row-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #2c7a51;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
}

.loop-buttons__row-subtitle {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    text-align: left;
    margin-top: 10px;
    padding-left: 4px;
}

.app-button {
    flex: 1;
    min-width: 90px;
    margin-top: 0;
    padding: 8px 12px;
    font-size: 13px;
}

.app-button--icon-native {
    flex: 0 0 auto;
    min-width: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.app-button--icon-native:hover {
    transform: scale(1.08);
}

.app-button--icon-native i {
    pointer-events: none;
}

.app-button--icon-custom {
    flex: 0 0 auto;
    min-width: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    margin: 0;
}

.app-button--icon-custom:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.app-button--icon-custom i {
    pointer-events: none;
}

.app-card__label {
    flex: 1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
}

.app-button--inactive {
    background: #dcdde1;
    color: #555;
}

.app-button--delete {
    flex: 0 0 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 13px;
    background: rgba(214, 69, 65, 0.9);
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.app-button--delete i {
    pointer-events: none;
    font-size: 14px;
}

.app-button--delete:hover {
    background: #c23616;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(214, 69, 65, 0.4);
}

.status-top-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 5px;
    width: 100%;
    flex-wrap: nowrap;
}

.status-navigation {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin: 0;
    padding: 0;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.status-navigation button {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.heading-icon {
    margin-right: 8px;
    color: #273c75;
}

.native-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.native-toggle input {
    display: none;
}

.native-toggle__indicator {
    width: 36px;
    height: 18px;
    border-radius: 999px;
    background: #dcdde1;
    position: relative;
    transition: background 0.2s ease;
}

.native-toggle__indicator::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.native-toggle input:checked+.native-toggle__indicator {
    background: #2c5aa0;
}

.native-toggle input:checked+.native-toggle__indicator::after {
    transform: translateX(18px);
}

/* Custom Tabs System - Diseño con solape */
.custom-tab-button.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-color: #7c3aed;
    border-bottom: 2px solid #fff;
    color: #fff;
    z-index: 20;
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 24px rgba(139, 92, 246, 0.35),
        0 4px 12px rgba(124, 58, 237, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.custom-tab-button.active:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 10px 28px rgba(139, 92, 246, 0.4),
        0 6px 16px rgba(124, 58, 237, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.custom-tab-content.active {
    display: block;
}

@keyframes fadeIn{
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom styles */
/* Appearance Card - Card Style like Status */
/* Appearance Mode Section */
.appearance-mode-card.active {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-color: #8e44ad;
    color: white;
    box-shadow: 0 4px 16px rgba(155, 89, 182, 0.3);
    transform: translateY(-2px);
}

.appearance-mode-card.active .appearance-mode-icon {
    transform: scale(1.1);
}

.appearance-mode-card.active .appearance-mode-desc {
    color: rgba(255, 255, 255, 0.9);
}

/* Color Controls Section */
/* Background Color Section (always visible) */
/* Gradient Color Items */
/* Color Section */
/* Color Label with Margin */
/* Large Color Picker for Gradients */
/* Gradient Section */
.section-custom .sub-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.section-custom .sub-section h4 {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 16px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Custom Modal Dialog */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

/* Avisos y confirmaciones (showAlert/showModal) siempre por encima de los
   modales de widgets: comparten z-index pero van antes en el DOM. */
#custom_modal {
    z-index: 11000;
}

.modal-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 90%;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #2c5aa0 0%, #273c75 100%);
    color: #fff;
    padding: 20px 24px;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    color: #333;
    font-size: 15px;
    line-height: 1.6;
}

.modal-body p {
    margin: 0;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e9ecef;
}

.modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0;
}

.modal-button--primary {
    background: #2c5aa0;
    color: #fff;
}

.modal-button--primary:hover {
    background: #1e4a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
}

.modal-button--secondary {
    background: #e9ecef;
    color: #495057;
}

.modal-button--secondary:hover {
    background: #dee2e6;
}

@keyframes fadeIn{
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn{
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Text Fragments */
/* Drawing Tools */
.tool-button.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.tool-button-icon {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #2c3e50;
    border: 3px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tool-button-icon:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #1a252f;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.tool-button-icon.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #2980b9;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.4), 0 0 0 3px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.tool-button-icon.active:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
}

#draw_canvas {
    display: block;
}

.undo-button {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: 3px solid #d68910;
    border-radius: 12px;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.clear-button {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 3px solid #a93226;
    border-radius: 12px;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.clear-button:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.5);
}

.connect-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
    flex-shrink: 0;
}

.connect-button:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.5);
}

.connect-button:active {
    transform: scale(1.02);
}

.undo-button:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d68910 100%);
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(243, 156, 18, 0.5);
}

.undo-button:active {
    transform: translateY(0);
}

.clear-button:active {
    transform: translateY(0);
}

#draw_commands_list {
    line-height: 1.6;
}

#draw_commands_list div {
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

#draw_commands_list div:last-child {
    border-bottom: none;
}

/* Control groups improvements */
/* Sound Section */
#melody_delete_btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Global Brightness Controls */
.brightness-controls {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.brightness-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brightness-header h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.brightness-header i {
    margin-right: 8px;
}

.auto-brightness-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.auto-brightness-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.auto-brightness-btn.active {
    background: #f39c12;
    border-color: #e67e22;
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
}

.auto-brightness-btn.active:hover {
    background: #e67e22;
}

.brightness-body {
    padding: 18px;
}

.brightness-slider-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brightness-slider-group label {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.brightness-slider-group label span {
    color: #3498db;
    font-weight: 700;
}

.brightness-slider-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #34495e 0%, #3498db 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
}

.brightness-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brightness-slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.brightness-slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brightness-slider-group input[type="range"]::-moz-range-thumb:hover {
    background: #2980b9;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.brightness-presets {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.brightness-preset-btn {
    flex: 1;
    padding: 10px;
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    color: #3498db;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brightness-preset-btn:hover {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.brightness-preset-btn:active {
    transform: translateY(0);
}

.brightness-preset-btn.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.brightness-preset-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(50%);
    pointer-events: none;
}

/* Drawing Options Card */
.drawing-options-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.drawing-options-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawing-options-header h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.drawing-options-header i {
    margin-right: 8px;
}

.drawing-options-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
