/* dj.vedo.ba — zajednički stil za javni player i admin panel. Bez build koraka, bez vanjskih fontova. */

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1c1c1c;
    --border: #2a2a2a;
    --text: #ffffff;
    --text-dim: #9a9a9a;
    --accent: #ff6a00;
    --accent-dim: #b34a00;
    --radius: 10px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

img, svg {
    max-width: 100%;
    display: block;
}

button, input, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

a {
    color: var(--accent);
}

::selection {
    background: var(--accent-dim);
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- Layout osnove ---------- */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 12px 96px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- Topbar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    max-width: 960px;
    margin: 0 auto;
}

.topbar h1 {
    font-size: 18px;
    margin: 0;
    letter-spacing: 0.02em;
}

.topbar h1 .accent {
    color: var(--accent);
}

.topbar a.admin-link {
    color: var(--text-dim);
    font-size: 13px;
    text-decoration: none;
}

.topbar a.admin-link:hover {
    color: var(--accent);
}

/* ---------- Video ---------- */

.video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-wrap.collapsed {
    aspect-ratio: unset;
    height: 0;
    border: 0;
}

.video-toggle {
    display: none;
    width: 100%;
    margin-top: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    padding: 8px;
    min-height: 44px;
}

@media (max-width: 1023px) {
    .video-toggle {
        display: block;
    }
}

@media (min-width: 1024px) {
    .video-wrap {
        position: sticky;
        top: 12px;
        z-index: 5;
    }
}

/* ---------- Kontrole ---------- */

.controls {
    margin-top: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.now-playing {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing .title {
    color: var(--text);
    font-weight: 600;
}

.seek-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--text-dim);
}

.seek {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-2);
    cursor: pointer;
}

.seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.6);
    cursor: pointer;
}

.seek::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.6);
    cursor: pointer;
}

.seek::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
}

.transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 15px;
    transition: background-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.btn:hover {
    background: #242424;
}

.btn:active {
    transform: translateY(1px);
}

.btn-icon {
    padding: 8px;
    font-size: 18px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #ff7e1f;
}

.btn.active,
.btn[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent-dim);
    box-shadow: 0 0 10px rgba(255, 106, 0, 0.35);
}

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

.volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.volume-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-2);
}

.volume-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* ---------- Pretraga i tagovi ---------- */

.filters {
    margin-top: 16px;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px;
    min-height: 44px;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    min-height: 32px;
}

.chip.active {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: rgba(255, 106, 0, 0.12);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.25);
}

/* ---------- Tabovi (Lista / Red čekanja) ---------- */

.tabs {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 10px 14px;
    min-height: 44px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 14px;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    display: none;
    margin-top: 10px;
}

.tab-panel.active {
    display: block;
}

/* ---------- Lista pjesama ---------- */

.track-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.track-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    user-select: none;
}

.track-item.playing {
    border-color: var(--accent-dim);
    box-shadow: 0 0 10px rgba(255, 106, 0, 0.2);
}

.track-item.playing .track-title {
    color: var(--accent);
}

.track-main {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-dim);
}

.track-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.track-tag {
    background: var(--surface-2);
    border-radius: 999px;
    padding: 2px 8px;
}

.track-add {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 32px 12px;
}

/* ---------- Red čekanja ---------- */

.queue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.queue-item.dragging {
    opacity: 0.5;
    border-color: var(--accent-dim);
}

.queue-handle {
    cursor: grab;
    color: var(--text-dim);
    padding: 4px 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.queue-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.queue-remove:hover {
    color: var(--accent);
}

.queue-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* ---------- Toasts ---------- */

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 380px);
}

.toast {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: toast-in .2s ease;
}

.toast.error {
    border-left-color: #ff4747;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Kontekstni meni (long-press) ---------- */

.context-menu {
    position: fixed;
    z-index: 200;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    min-width: 180px;
}

.context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    padding: 12px 14px;
    min-height: 44px;
    cursor: pointer;
}

.context-menu button:hover {
    background: var(--surface);
    color: var(--accent);
}

/* ================================================================
   ADMIN
   ================================================================ */

.admin-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 12px 64px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.admin-header h1 {
    font-size: 18px;
    margin: 0;
}

/* Login ekran sa keypadom */

.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-screen h1 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-dim);
}

.pin-dots {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 16px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    transition: background-color .1s ease, box-shadow .1s ease;
}

.pin-dot.filled {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.6);
    border-color: var(--accent);
}

.login-message {
    min-height: 20px;
    color: #ff8a5c;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: min(88vw, 280px);
}

.keypad button {
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    min-height: 44px;
}

.keypad button:hover {
    background: var(--surface-2);
}

.keypad button:active {
    box-shadow: 0 0 12px rgba(255, 106, 0, 0.4);
    border-color: var(--accent-dim);
}

.keypad .key-enter {
    color: var(--accent);
}

/* Forma za unos/izmjenu pjesme */

.admin-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 20px;
}

.form-row {
    margin-bottom: 12px;
}

.form-row label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-row input[type="text"],
.form-row input[type="url"] {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    min-height: 44px;
}

.form-row-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row-inline .form-row {
    flex: 1;
    min-width: 140px;
}

.field-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

.field-hint.warn {
    color: var(--accent);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.autocomplete-list.open {
    display: block;
}

.autocomplete-list button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    padding: 8px 12px;
    cursor: pointer;
    min-height: 36px;
}

.autocomplete-list button:hover {
    background: var(--surface);
    color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* Tabela pjesama */

.table-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.admin-table th {
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
    background: var(--surface);
    position: sticky;
    top: 0;
}

.admin-table th.sorted {
    color: var(--accent);
}

.admin-table tbody tr:hover {
    background: var(--surface);
}

.row-actions {
    display: flex;
    gap: 6px;
}

.row-actions .btn {
    padding: 6px 10px;
    min-height: 36px;
    font-size: 12px;
}

.import-export {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.import-scan-panel {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}

.text-warn {
    color: var(--accent);
}

.text-error {
    color: #ff4747;
}

/* ---------- Breakpointi ---------- */

@media (min-width: 640px) {
    .container {
        padding: 0 20px 96px;
    }

    .transport {
        gap: 10px;
    }
}

/* ---------- Reducirano kretanje ---------- */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
