:root {
    --primary: #03dac6;
    --bg: #121212;
    --card: #1e1e1e;
    --text: #e0e0e0;
    --danger: #cf6679;
    --nav-height: 80px;
}

/* Base Reset */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* FIXED TOP NAVIGATION */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: #000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-bottom: 1px solid #333;
    z-index: 9999;
    padding-bottom: 15px;
}

nav .nav-item {
    cursor: pointer;
    opacity: 0.5;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

nav .nav-item span {
    font-size: 1.4em;
}

nav .nav-item label {
    font-size: 0.65em;
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 1px;
    font-weight: bold;
}

nav .nav-item.active {
    opacity: 1;
    color: var(--primary);
}

/* NAVIGATION LOADER STYLE */
#loader {
    display: none;
    position: absolute;
    bottom: 8px;
    width: 100%;
    text-align: center;
    color: var(--primary);
    font-size: 0.7em;
    font-weight: bold;
    letter-spacing: 1.5px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* MAIN SCROLLABLE CONTENT */
main {
    margin-top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.view {
    display: none;
    width: 100%;
    max-width: 600px;
    padding-bottom: 30px;
}

.view.active {
    display: block;
}

/* CARDS & CONTAINERS */
.card {
    background: var(--card);
    padding: 15px;
    border-radius: 12px;
    border-top: 4px solid var(--primary);
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#status {
    font-size: 1.05em;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 15px;
    text-align: center;
    min-height: 4em;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #333;
}

/* INPUTS & BUTTONS */
input, select {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #2a2a2a;
    color: white;
    outline: none;
    font-size: 16px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

button {
    padding: 12px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8em;
    transition: opacity 0.2s, transform 0.1s;
}

button:active {
    opacity: 0.7;
    transform: scale(0.98);
}

/* LIST ITEMS */
.item {
    background: #252525;
    margin: 8px 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid transparent;
}

.item.active {
    border-color: var(--primary);
    background: #2a2a2a;
}

.item-info {
    flex: 1;
    padding: 12px;
    overflow: hidden;
}

.item-info b {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
}

.btn-icon {
    background: transparent;
    font-size: 1.2em;
    padding: 10px;
}

/* DRAG & DROP HANDLE */
.handle {
    touch-action: none;
    padding: 15px 20px;
    background: rgba(255,255,255,0.03);
    color: var(--primary);
    cursor: grab;
}

.dragging {
    opacity: 0.3;
    border: 1px dashed var(--primary);
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    width: 94%;
    max-width: 450px;
    position: relative;
    border-top: 4px solid var(--primary);
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #333;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: none;
    cursor: pointer;
    z-index: 10001;
}

/* DARKENED HIGH-CONTRAST CHECKBOXES */
input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    appearance: none;
    background: #000;
    border: 2px solid #444;
    border-radius: 4px;
    position: relative;
    outline: none;
    transition: 0.2s;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(3, 218, 198, 0.4);
}

input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    color: #000;
    font-size: 16px;
    left: 4px;
    top: 0px;
    font-weight: bold;
}

/* SPECIAL BUTTON CLASSES */
.btn-danger-outline {
    background: rgba(207,102,121,0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-close-modal {
    background: #333;
    color: #fff;
}

.list-container {
    margin-top: 10px;
    width: 100%;
}

/* --- PLAYLIST VIEW LAYOUT FIXES --- */

/* Side-by-side Edit/Delete (Delete to Right) */
.header-actions-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important; /* Identical gap for both rows */
    margin-top: 10px;
    width: 100%;
}

.header-actions-row button {
    flex: 1 !important;
}

/* Title room for X */
#viewPlaylistTitle {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 85%;
}

.queue-loader-container {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #333;
}

/* Side-by-side Save/Close */
#viewPlaylistModal .footer-actions {
    display: flex !important;
    flex-direction: row !important; /* Forces row alignment */
    justify-content: space-between !important;
    gap: 20px;
    margin-top: 20px;
}

#viewPlaylistModal .footer-actions button {
    flex: 1; /* Equal width */
    padding: 14px;
    font-size: 0.9em;
}

