/* styles.css */

/* Reset some default styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #ddd;
    background-color: #1e1e1e;
    overflow: hidden;
    position: relative;
}

/* Graphical Display: behind everything else */
#graphicalDisplay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* behind controls and hints */
    overflow: hidden;
}

/* Control Panel */
#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    padding: 20px;
    background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
    border: 1px solid #444;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
}

#controls h2 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
}

/* Group sections for clarity */
.control-section {
    border: 1px solid #555;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 15px;
}

.control-section legend {
    color: #ccc;
    font-size: 0.95em;
    padding: 0 5px;
}

.control-group {
    margin-bottom: 10px;
}

/* Labels and Inputs */
label {
    display: block;
    margin-bottom: 3px;
    font-size: 0.9em;
    color: #ccc;
}

input[type="range"],
select, button {
    width: 100%;
    max-width: 280px;  /* limit max width so they don't overflow */
    background: #333;
    border: 1px solid #555;
    border-radius: 8px;
    color: #fff;
    padding: 6px 8px;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    font-size: 0.9em;
}

input[type="range"] {
    accent-color: #00bfff;
}

/* Adjust slider container to prevent overflow */
.control-group input[type="range"] {
    width: 100%;
}

/* Buttons */
button {
    cursor: pointer;
    background: linear-gradient(145deg, #444, #2c2c2c);
    transition: background 0.3s, transform 0.2s;
    padding: 8px 0;
    font-size: 0.9em;
    border: none;
    border-radius: 5px;
}

button:hover {
    background: #00bfff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.5);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* Play Button Highlight */
#playButton {
    background: #00bfff;
    color: #fff;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.7);
}
#playButton:hover {
    background: #009acd;
}

/* Arrow Hints */
#arrowHints {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: #f0f0f0;
    font-size: 0.95em;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 99;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: left;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.6);
    z-index: 10;
    font-size: 0.85em;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
}

/* Walkthrough Overlay */
#walkthroughOverlay.hidden {
    display: none;
}

#walkthroughOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300; /* Increased to be above all other elements */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Walkthrough Tooltip */
#walkthroughTooltip {
    position: absolute;
    max-width: 400px;
    background: #ffffff;
    color: #333;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 301; /* Ensure it's above the highlight box */
    font-size: 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease;
    overflow: hidden;
    word-wrap: break-word;
}

#walkthroughTooltip p {
    margin: 0 0 20px 0;
    text-align: center;
    line-height: 1.5;
}

#walkthroughTooltip button {
    margin-top: 10px;
}

/* Walkthrough Buttons */
.walkthrough-primary-button {
    background: #28a745; /* Green */
    color: #fff;
    min-width: 100px;
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.walkthrough-primary-button:hover {
    background: #218838;
}

.walkthrough-secondary-button {
    background: #dc3545; /* Red */
    color: #fff;
    min-width: 100px;
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.walkthrough-secondary-button:hover {
    background: #c82333;
}

/* Walkthrough Highlight */
#walkthroughHighlight {
    position: absolute;
    border: 3px solid #00bfff;
    border-radius: 8px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 299; /* Below the walkthrough tooltip */
    transition: all 0.3s ease;
}

/* Class to identify extra buttons (like skip) */
.walkthrough-extra-button {
    /* No special styling needed, just a hook to remove them */
}

@media (max-width: 768px) {
    #walkthroughTooltip {
        max-width: 90%;
        padding: 20px 15px;
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* MIDI Modal */
#midiModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 400; /* Above everything */
    display: flex;
    align-items: center;
    justify-content: center;
}

#midiModal.hidden {
    display: none;
}

#midiModalContent {
    background: #ffffff;
    color: #333;
    padding: 30px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideDown 0.5s ease;
}

#midiModalContent p {
    margin-bottom: 20px;
    font-size: 1.1em;
}

.midi-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.midi-primary-button {
    background: #28a745; /* Green */
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.midi-primary-button:hover {
    background: #218838;
}

.midi-secondary-button {
    background: #dc3545; /* Red */
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.midi-secondary-button:hover {
    background: #c82333;
}

/* Slide Down Animation for MIDI Modal */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #controls {
        width: 90%;
        left: 50%;
        transform: translateX(-50%);
    }

    #walkthroughTooltip {
        max-width: 90%;
        padding: 20px 15px;
    }

    #midiModalContent {
        max-width: 90%;
        padding: 20px 15px;
    }

    #arrowHints {
        bottom: 10px;
        right: 10px;
        font-size: 0.8em;
        padding: 8px 12px;
    }

    .walkthrough-primary-button,
    .walkthrough-secondary-button,
    .midi-primary-button,
    .midi-secondary-button {
        min-width: 80px;
        padding: 8px 16px;
    }
}

/* Additional Aesthetic Enhancements */
#walkthroughTooltip {
    border-top: 4px solid #00bfff;
}

#midiModalContent p {
    font-weight: bold;
}

.walkthrough-primary-button,
.walkthrough-secondary-button,
.midi-primary-button,
.midi-secondary-button {
    font-weight: bold;
}
