* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-heading: #007bff;
    --color-attribution: #666666;
    --color-section-label: #666666;
    --color-lyrics: #ffffff;
    --color-nav-label: #666666;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Control Panel Layout */
.control-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #1a1a1a;
    color: #fff;
}

.header {
    padding: 10px 20px;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    background: #444;
    color: #aaa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.header-btn:hover {
    background: #555;
    color: #fff;
}

.header-btn.active {
    background: #007bff;
    color: #fff;
}

.item-selector {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 16px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
}

.show-selector:focus {
    outline: none;
    border-color: #007bff;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Navigation Pane */
.nav-pane {
    width: 250px;
    background: #222;
    border-right: 1px solid #444;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-placeholder {
    padding: 20px;
    color: #888;
    text-align: center;
}

.nav-arrangement {
    border-bottom: 1px solid #333;
}

.nav-arrangement-title {
    padding: 12px 15px;
    font-weight: bold;
    background: #2a2a2a;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-arrangement-title:hover {
    background: #3a3a3a;
}

.nav-section {
    padding: 8px 15px 8px 12px;
    cursor: pointer;
    color: #ccc;
    transition: background 0.2s, color 0.2s;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    position: relative;
}

.nav-section-checkbox {
    position: absolute;
    top: 8px;
    left: 12px;
    width: 14px;
    height: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: #333;
    border: 1px solid #444;
    border-radius: 2px;
}

.nav-section-checkbox:checked {
    background: #333;
    border-color: #444;
}

.nav-section-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #888;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.nav-section-label,
.nav-section-lyrics {
    padding-left: 22px;
}

.nav-section-label {
    font-size: 11px;
    color: var(--color-nav-label);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.nav-section-lyrics {
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.4;
}

.nav-section-lyrics span {
    font-size: 80%;
}

.nav-section-lyrics span.women {
    font-style: italic;
}

.nav-section:hover {
    background: #333;
    color: #fff;
}

.nav-section.active {
    background: #007bff;
    color: #fff;
}

/* Lyrics Area */
.lyrics-area {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: auto;
    position: relative;
    --bg-image: none;
    --bg-color: #000;
    background-color: var(--bg-color);
    clip-path: inset(0);
}

.lyrics-area::before {
    content: '';
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    bottom: 0;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.lyrics-content {
    padding: 120px 40px 50px 40px;
    min-height: 100%;
    position: relative;
    z-index: 1;
}

.lyrics-placeholder {
    color: #666;
    text-align: center;
    font-size: 24px;
    padding-top: 100px;
}

.arrangement-block {
    margin-bottom: 60px;
}

.arrangement-title {
    font-size: 42px;
    font-weight: bold;
    color: var(--color-heading);
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
}

.title-slide {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

.title-slide .arrangement-title {
    margin-bottom: 15px;
    padding-bottom: 0;
    border-bottom: none;
}

.title-slide-attributions {
    font-size: 14px;
    color: var(--color-attribution);
    line-height: 1.6;
}

.title-slide-author {
    margin-bottom: 4px;
}

.title-slide-copyright {
    font-style: italic;
}

.title-slide-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.title-slide-ccli {
    font-size: 14px;
    color: var(--color-attribution);
    text-align: right;
    white-space: nowrap;
}

.section-block {
    margin-bottom: 40px;
}

.section-label {
    font-size: 18px;
    color: var(--color-section-label);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left;
}

.section-lyrics {
    font-size: 32px;
    line-height: 1.6;
    color: var(--color-lyrics);
    white-space: pre-wrap;
    text-align: center;
}

.section-lyrics span {
    font-size: 80%;
}

.section-lyrics span.women {
    font-style: italic;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: #2a2a2a;
    border-top: 1px solid #444;
}

.control-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: #555;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-start {
    background: #28a745;
}

#btn-start:hover:not(:disabled) {
    background: #218838;
}

#btn-stop {
    background: #dc3545;
}

#btn-stop:hover:not(:disabled) {
    background: #c82333;
}

.popup-btn {
    background: #007bff;
}

.popup-btn:hover {
    background: #0056b3;
}

.speed-display {
    color: #aaa;
    font-size: 14px;
    margin-left: 10px;
}

.settings-btn {
    margin-left: auto;
    background: #6c757d;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: #5a6268;
}

.settings-btn svg {
    display: block;
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-dialog {
    background: #2a2a2a;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #444;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section > h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.settings-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row label {
    color: #ccc;
    font-size: 14px;
    flex: 1;
}

.settings-header-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.settings-header-row h3 {
    margin: 0;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.settings-column-header {
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 50px;
    text-align: center;
}

.settings-row input[type="color"] {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #444;
    padding: 2px;
}

.settings-input {
    width: 100px;
    padding: 6px 10px;
    font-size: 14px;
    background: #444;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    -moz-appearance: textfield;
}

.settings-input::-webkit-outer-spin-button,
.settings-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.settings-input::placeholder {
    color: #888;
}

.settings-file-btn {
    padding: 8px 16px;
    font-size: 14px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-file-btn:hover {
    background: #555;
}

.settings-clear-btn {
    padding: 8px 10px;
    font-size: 14px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-clear-btn:hover {
    background: #dc3545;
}

.settings-reload-btn {
    padding: 8px 12px;
    font-size: 14px;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-reload-btn:hover {
    background: #0b5ed7;
}

.settings-btn-group {
    display: flex;
}

.settings-row > input[type="color"]:last-child {
    margin-left: auto;
}

.settings-btn-group .grouped {
    border-radius: 0;
    border-left: 1px solid #555;
}

.settings-btn-group .grouped:first-child {
    border-radius: 4px 0 0 4px;
    border-left: none;
}

.settings-btn-group .grouped:last-child:not([hidden]) {
    border-radius: 0 4px 4px 0;
}

/* When reload button is hidden, clear button gets rounded corners */
.settings-btn-group .settings-reload-btn[hidden] + .settings-clear-btn {
    border-radius: 0 4px 4px 0;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-top: 1px solid #444;
}

.modal-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.reset-btn {
    background: #6c757d;
    color: #fff;
}

.reset-btn:hover {
    background: #5a6268;
}

.apply-btn {
    background: #28a745;
    color: #fff;
}

.apply-btn:hover {
    background: #218838;
}

.modal-dialog.color-picker-active .modal-close,
.modal-dialog.color-picker-active .modal-btn,
.modal-dialog.color-picker-active .settings-file-btn,
.modal-dialog.color-picker-active .settings-clear-btn,
.modal-dialog.color-picker-active .settings-reload-btn {
    pointer-events: none;
    opacity: 0.5;
}

.modal-overlay.color-picker-active {
    pointer-events: none;
}

.modal-overlay.color-picker-active .modal-dialog {
    pointer-events: auto;
}

/* Projector Window */
.projector,
.projector * {
    cursor: none !important;
    pointer-events: none;
    user-select: none;
}

.projector {
    background: #000;
    height: 100vh;
    overflow: hidden;
}

body.projector {
    display: flex;
    flex-direction: column;
    background: #000;
}

.projector-lyrics {
    flex: 1;
    height: 100%;
}

.projector .lyrics-content {
    padding: 80px 60px;
}

.projector .arrangement-title {
    font-size: 64px;
}

.projector .section-lyrics {
    font-size: 56px;
    line-height: 1.5;
}

.projector .section-label {
    font-size: 24px;
}

.projector .lyrics-area::before {
    left: 0;
}

.projector .title-slide-attributions {
    font-size: 18px;
}

.projector .title-slide-ccli {
    font-size: 18px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Spacer between songs so they don't appear together */
.song-spacer {
    height: 100vh;
}

/* Spacer at end for scrolling past last section */
.lyrics-spacer {
    height: 80vh;
}
