:root {
    --primary-color: #80b3ff;
    --primary-dark: #6da0f0;
    --primary-light: #a3cbff;
    --secondary-color: #E1FF80;
    --accent-color: #7effa0;
    --bg-color: #f2f2f2;
    --card-bg: white;
    --text-color: #333;
    --border-color: #e0e0e0;
    --base-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

@font-face {
    font-family: 'evermore';
    src: url(../assets/evermore/Evermore.ttf);
}

@font-face {
    font-family: technotot;
    src: url(../assets/technotot/Technotot.otf);
}

body {
    font-family: var(--base-font-stack);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 60px);
    width: 100%;
}

.logo {
    width: 200px;
    margin: 0;
    overflow: hidden;
}

.logo iframe, .splash-logo iframe {
    width: 100%;
    height: 100%;
    border: none;
    overflow: hidden;
}

.logo object, .splash-logo object {
    display: none;
}

button {
    cursor: pointer;
}

.splash-logo {
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulse 2s infinite alternate;
    overflow: hidden;
}

#splash-screen.fade-out {
    opacity: 0;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-in-out;
}

@keyframes pulse {
    from {
        transform: scale(0.95);
    }

    to {
        transform: scale(1.05);
    }
}

.sequencer-view {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    height: 100%;
    width: 100%;
}

header, .top-bar, .side-bar, #main-view, .track, .keyboard-helper, .modal-content, #instrument-list, #browser {
    background: var(--card-bg);
    transition: background-color 0.3s ease;
}

header {
    color: var(--text-color);
    text-align: left;
    padding: 10px 15px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid var(--primary-color);
}

.header-controls {
    display: flex;
    align-items: center;
}

h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #333;
    font-family: technotot;
}

.top-bar, .side-bar, .main-view {
    padding: 15px;
}

.top-bar {
    border-bottom: 2px solid var(--border-color);
    padding: 15px 20px;
}

.section-header {
    display: flex;
    margin: 0;
    padding-bottom: 15px;
    justify-content: space-between;
    align-items: center;
}

button:not(.fun-button):not(.count-button):not(#play-button):not(#pattern-button):active {
    animation: buttonPress 0.2s ease;
}

.count-button, #pattern-button {
    width: 36px;
    height: 36px;
    padding: 0;
}

.count-button {
    transition: all 0.15s ease;
}

.count-button:hover {
    transform: translateY(-1px);
}

.count-button:active, #pattern-button:active, #play-button-sequence:active {
    transform: translateY(1px);
}

#play-button {
    display: block;
}

#pattern-section {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

#patterns-holder {
    display: flex;
    margin-left: 5px;
    border-left: #80b3ff 2px solid;
    padding-left: 10px;
}

#main-view {
    display: flex;
    flex-direction: column;
    margin: 15px;
    border: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 20px;
    height: fit-content;
    overflow: scroll;
}

#bpm-text-field {
    border: none;
    border-bottom: 2px solid var(--primary-color);
    border-left: none;
    font-size: 16px;
    padding: 5px;
    margin: 0 15px;
    width: 60px;
    text-align: center;
}

.track {
    display: flex;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    padding: 12px;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.track-buttons {
    display: flex;
    align-items: center;
}

.track-fields {
    display: flex;
    align-items: center;
    width: 100%;
}

.track button {
    margin-right: 8px;
}

input {
    font-family: var(--base-font-stack);
}

.track input {
    margin-right: 8px;
    width: 100%;
    border: 1px solid #ddd;
    padding: 8px 4px;
    transition: border-color 0.3s;
}

.track input:focus {
    border-bottom: 2px solid #80b3ff;
    outline: none;
}

#track-text-field.active-note {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 8px var(--primary-light);
    border: 1px solid var(--primary-light);
    transform: scale(1.05);
    transition: all 0.1s ease;
}

.side-bar {
    display: flex;
    flex-direction: column;
    padding: 20px;
    width: 20%;
    border-bottom: none;
}

#instrument-section, #browser-section {
    margin-bottom: 25px;
}

#instrument-list, #browser {
    background-color: rgba(0,0,0,0.05);
    border: none;
    padding: 12px;
}

#instrument-list p {
    margin: 5px 0;
    font-size: 13px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#instrument-section h3 {
    margin-bottom: 5px;
}

#instrument-list button {
    width: 100%;
    color: var(--text-color);
    text-align: left;
    margin-bottom: 5px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.03);
    position: relative;
    padding-left: 15px;
}

#instrument-list button::before {
    content: attr(data-slot);
    position: relative;
    margin-right: 10px;
    font-weight: bold;
    font-size: 12px;
    color: var(--primary-color);
}

#instrument-list button:empty::after {
    content: "Empty slot";
    color: var(--text-muted);
    font-style: italic;
}

#instrument-list button[data-selected="true"] {
    background: var(--primary-color-light);
    border: 1px solid var(--primary-color);
}

#instrument-list button.drag-over {
    background-color: var(--primary-light);
    border: 2px dashed var(--primary-color);
}

#add-pattern-button, #add-track-button, #play-button-sequence {
    background: var(--primary-color);
    color: white;
}

#add-pattern-button, #add-track-button {
    min-height: 36px;
}

#remove-pattern-button, #remove-track-button, #pattern-button {
    background: var(--border-color);
}

#add-pattern-button:active, #add-track-button:active {
    border-bottom: 1px solid #5a87cc;
}

#pattern-button {
    margin: 0 4px;
    color: var(--text-color);
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
}

#pattern-button:hover {
    transform: translateY(-1px);
    border-bottom: 3px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#pattern-button:active {
    border-bottom: 1px solid #ccc;
}

#pattern-button.selected {
    background: var(--primary-color);
    color: white;
    transform: none;
    box-shadow: 0 2px 6px rgba(128, 179, 255, 0.3);
    border: none;
}

@keyframes buttonPress {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.theme-selector-wrapper {
    display: flex;
    align-items: center;
    align-self: center;
    justify-self: flex-end;
    margin-top: auto;
    margin-bottom: 30px;
}

.theme-label {
    margin-right: 5px;
    color: var(--primary-color);
    cursor: pointer;
}

.theme-selector {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 5px 8px;
    font-size: 12px;
    color: var(--text-color);
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
}

.theme-selector:hover {
    border-color: var(--primary-color);
}

.theme-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(128, 179, 255, 0.2);
}

#browser button[draggable="true"] {
    cursor: grab;
}

#browser button[draggable="true"]:active {
    cursor: grabbing;
}

#browser button[draggable="true"].dragging {
    opacity: 0.5;
    border: 1px dashed var(--primary-color);
}

#notification {
    background: var(--primary-color);
    color: var(--text-color);
    padding: 10px;
}

.keyboard-helper {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    z-index: 1000;
    display: none;
    max-width: 90%;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.keyboard-helper.visible {
    display: block;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.keyboard-helper h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary-color);
    text-align: center;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.key .note-name {
    font-weight: bold;
    font-size: 14px;
}

.key .keyboard-key {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 10px;
    color: var(--primary-color);
}

.keyboard-helper .help-text {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

#pattern-sequencer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

#pattern-sequencer input {
    width: 30px;
    height: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    margin: 0 4px;
}

#pattern-sequencer input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 3px var(--primary-light);
    outline: none;
    transform: translateY(-2px);
}

#play-button-sequence {
    margin-left: 10px;
    padding: 8px 16px;
    transition: all 0.15s ease;
    border: none;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0,0,0,0.4);
}

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 60px auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    position: relative;
    color: var(--text-color);
    border: none;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary-color);
    text-align: center;
}

.modal-content .close {
    position: absolute;
    right: 18px;
    top: 12px;
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
}

.help-sections {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 20px;
}

.help-tabs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 180px;
    border-right: 1px solid var(--border-color, #e0e0e0);
    padding-right: 10px;
}

.help-tab {
    background: var(--primary-light, #e0eaff);
    color: var(--primary-dark, #333);
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    outline: none;
}

.help-tab.active,
.help-tab:focus {
    background: var(--primary-color, #80b3ff);
    color: #fff;
    font-weight: bold;
}

.help-content {
    flex: 1;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
}

.help-content h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.help-content ul {
    margin: 0;
    padding-left: 20px;
}

.help-content ul li {
    margin-bottom: 10px;
}

#help-button {
    width: fit-content;
    min-width: 0;
}