/**
 * MAESTRO SIMULATOR - CSS
 * Visual 8-bit melhorado com estética de orquestra real
 */

/* Fonte 8-bit */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Container principal */
#maestro-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a2e 100%);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
}

/* Cabeçalho */
.maestro-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    animation: glow-pulse 3s ease-in-out infinite;
}

.maestro-title {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    color: #fff;
    text-shadow:
        2px 2px 0 #000,
        4px 4px 0 rgba(0,0,0,0.5),
        0 0 20px rgba(255,255,255,0.5);
    animation: title-flicker 2s infinite;
}

.maestro-subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 8px 40px rgba(102, 126, 234, 0.6); }
}

@keyframes title-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

/* Instruções */
.maestro-instructions {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 0 0 30px 0;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.maestro-instructions h3 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.control-groups {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.control-group {
    flex: 1;
    min-width: 200px;
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    font-size: 0.65rem;
    line-height: 1.8;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.control-group strong {
    display: block;
    margin-bottom: 10px;
    font-size: 0.75rem;
    color: #FFD700;
}

.control-key {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    padding: 5px 10px;
    border-radius: 6px;
    margin: 2px 3px;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.control-key:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Canvas wrapper */
#maestro-canvas-wrapper {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 30px 0;
}

/* Canvas */
#maestro-canvas {
    display: block;
    margin: 0 auto;
    border: 6px solid #667eea;
    border-radius: 15px;
    background: #0a0a1a;
    cursor: crosshair;
    box-shadow:
        0 10px 40px rgba(102, 126, 234, 0.5),
        inset 0 0 20px rgba(0,0,0,0.5);
    transition: transform 0.1s ease, box-shadow 0.3s ease;

    /* Pixel art perfeito */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#maestro-canvas:active {
    transform: scale(0.99);
    box-shadow:
        0 8px 35px rgba(102, 126, 234, 0.6),
        inset 0 0 20px rgba(0,0,0,0.5);
}

/* Loading state */
.maestro-loading {
    text-align: center;
    padding: 60px 40px;
}

.maestro-loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.maestro-loading-text {
    margin-top: 20px;
    font-size: 0.8rem;
    color: #667eea;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Botão voltar */
.btn-maestro-back {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 12px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 5px 20px rgba(231, 76, 60, 0.4),
        inset 0 -3px 0 rgba(0,0,0,0.2);
    text-transform: uppercase;
    display: block;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.btn-maestro-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn-maestro-back:hover::before {
    left: 100%;
}

.btn-maestro-back:hover {
    transform: translateY(-4px);
    box-shadow:
        0 8px 25px rgba(231, 76, 60, 0.6),
        inset 0 -3px 0 rgba(0,0,0,0.2);
}

.btn-maestro-back:active {
    transform: translateY(0);
    box-shadow:
        0 3px 12px rgba(231, 76, 60, 0.4),
        inset 0 3px 5px rgba(0,0,0,0.3);
}

/* Responsividade */
@media (max-width: 768px) {
    #maestro-container {
        padding: 15px;
    }

    .maestro-title {
        font-size: 1.2rem;
    }

    .maestro-subtitle {
        font-size: 0.65rem;
    }

    .maestro-instructions {
        padding: 20px 15px;
    }

    .maestro-instructions h3 {
        font-size: 0.85rem;
    }

    .control-groups {
        flex-direction: column;
        gap: 10px;
    }

    .control-group {
        min-width: 100%;
        font-size: 0.6rem;
    }

    .control-group strong {
        font-size: 0.7rem;
    }

    .control-key {
        padding: 4px 8px;
        font-size: 0.55rem;
    }

    #maestro-canvas {
        max-width: 100%;
        height: auto !important;
        border-width: 4px;
    }

    .btn-maestro-back {
        font-size: 0.65rem;
        padding: 12px 25px;
    }
}

@media (max-width: 480px) {
    #maestro-container {
        padding: 10px;
    }

    .maestro-title {
        font-size: 1rem;
    }

    .maestro-subtitle {
        font-size: 0.6rem;
    }

    .maestro-instructions h3 {
        font-size: 0.75rem;
    }

    .control-group {
        font-size: 0.55rem;
        padding: 12px;
    }

    .control-group strong {
        font-size: 0.65rem;
    }

    .control-key {
        padding: 3px 6px;
        font-size: 0.5rem;
    }

    .btn-maestro-back {
        font-size: 0.6rem;
        padding: 10px 20px;
    }
}

/* Animações 8-bit extras */
@keyframes blink-8bit {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

.blink-8bit {
    animation: blink-8bit 1s infinite;
}

@keyframes bounce-8bit {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce-8bit {
    animation: bounce-8bit 0.6s infinite;
}

/* Modo escuro forçado */
#maestro-container,
#maestro-container * {
    color-scheme: dark;
}

/* Override de seleção */
#maestro-container ::selection {
    background: rgba(102, 126, 234, 0.5);
    color: white;
}

/* Desabilitar seleção de texto no canvas */
#maestro-canvas-wrapper {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
