/* Baraoke-inspired dark theme: purple, cyan, pink */
:root {
    --bg-dark: #13041c;
    --bg-card: #1e0a2e;
    --bg-input: #2a1240;
    --text: #f0e6ff;
    --text-muted: #a89bc0;
    --cyan: #19efef;
    --pink: #ff6bb5;
    --green: #4ade80;
    --yellow: #fbbf24;
    --red: #f87171;
    --border: #3d1f5c;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-y: scroll; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}
body > *:first-child { flex: 1; width: 100%; }

/* Layout */
.container { max-width: 640px; margin: 0 auto; padding: 24px 16px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* Header */
.header {
    text-align: center;
    padding: 32px 0 24px;
}
.header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.header .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.header .event-date {
    color: var(--cyan);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 8px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

/* Form elements */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.95rem;
}
label .en { font-weight: 400; font-style: italic; color: var(--text-muted); }
label .required { color: var(--pink); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="tel"], textarea, select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--cyan);
}
/* Override browser autofill yellow background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--text);
    transition: background-color 5000s ease-in-out 0s;
}
textarea { resize: vertical; min-height: 80px; }

/* Radio buttons */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
}
.radio-option:hover { border-color: var(--cyan); }
.radio-option input[type="radio"] { accent-color: var(--cyan); }

/* Song input with autocomplete */
.song-field { position: relative; margin-bottom: 12px; }
.song-field input { padding-right: 40px; }
.song-field .status-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-badge.available { background: var(--green); }
.status-badge.sunvig-only { background: var(--yellow); }
.status-badge.not-found { background: var(--red); }

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.autocomplete-dropdown.active { display: block; }
.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}
.autocomplete-item:hover { background: var(--bg-input); }
.autocomplete-item .song-title { font-weight: 600; }
.autocomplete-item .song-artist { color: var(--text-muted); font-size: 0.85rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary {
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    color: var(--bg-dark);
}
.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Section heading */
.section-heading {
    background: linear-gradient(90deg, var(--cyan), transparent);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--bg-dark);
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.badge-yellow { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.badge-red { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.badge-cyan { background: rgba(25, 239, 239, 0.15); color: var(--cyan); }

/* Stats row */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat .value { font-size: 1.8rem; font-weight: 700; color: var(--cyan); }
.stat .label { font-size: 0.8rem; color: var(--text-muted); }

/* Navigation (admin) */
.nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.nav a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.nav a:hover, .nav a.active { color: var(--cyan); }
.nav .brand { font-weight: 700; color: var(--text); margin-right: auto; text-decoration: none; }
.nav-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 0;
    min-height: auto;
}
.nav-logout:hover { color: var(--cyan); }

/* Alert / warning */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-warning { background: rgba(251, 191, 36, 0.1); border: 1px solid var(--yellow); color: var(--yellow); }
.alert-success { background: rgba(74, 222, 128, 0.1); border: 1px solid var(--green); color: var(--green); }

/* Billing */
.bill-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.bill-item .item-desc { flex: 1; }
.bill-item .item-price { font-weight: 600; color: var(--cyan); white-space: nowrap; }

/* Settlement */
.settlement-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.settlement-row.settled { opacity: 0.5; }

/* Event cards */
a.event-card { transition: border-color 0.2s; }
a.event-card:hover { border-color: var(--cyan); }
.event-card {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.event-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Share link */
.share-card { }
.share-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.share-row input { min-width: 0; }

/* Room vote rows */
.room-vote-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.vote-bar {
    width: 200px;
    height: 24px;
    background: var(--bg-input);
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Room checkboxes */
.room-checkboxes { display: flex; flex-direction: column; gap: 8px; }

/* Table scroll for mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* File upload */
.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.file-upload input[type="file"] {
    display: none;
}
.file-upload-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    min-height: 44px;
}
.file-upload-btn:hover { border-color: var(--cyan); }
.file-upload-name {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Dialog */
.dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    max-width: 480px;
    width: 90%;
    padding: 0;
}
.dialog::backdrop { background: rgba(0,0,0,0.6); }

/* Touch targets */
input, select, textarea, .btn, .radio-option {
    min-height: 44px;
}

/* Responsive */
@media (max-width: 600px) {
    .container { padding: 16px 12px; }
    .container-wide { padding: 16px 12px; }
    .header h1 { font-size: 1.5rem; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stat { padding: 12px; }
    .stat .value { font-size: 1.4rem; }
    .nav { gap: 8px; }
    .nav a { font-size: 0.8rem; }
    .nav .brand { font-size: 0.9rem; }
    .nav-user { display: none; }
    .vote-bar { width: 100px; }
    .event-card { flex-direction: column; align-items: flex-start; }
    .share-row { flex-direction: column; }
    .share-row input { width: 100%; }
    .share-row .btn { width: 100%; }
    table { font-size: 0.85rem; }
    th, td { padding: 8px 10px; }
    h2 { font-size: 1.3rem; }
    .btn-sm { padding: 8px 14px; }
}

@media (max-width: 360px) {
    .stats { grid-template-columns: 1fr; }
}

/* Item assignment */
.assign-item {
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.assign-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 4px;
}
.assign-people {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
/* Bill assignment tags with steppers */
.assign-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 8px;
}
.assign-tag-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--cyan);
    border-radius: 20px;
    background: rgba(25, 239, 239, 0.08);
    overflow: hidden;
}
.tag-name {
    font-size: 0.85rem;
    color: var(--cyan);
    padding: 0 4px 0 12px;
    white-space: nowrap;
}
.tag-step {
    width: 40px;
    height: 44px;
    min-height: 44px;
    background: none;
    border: none;
    color: var(--cyan);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.tag-step:active { background: rgba(25, 239, 239, 0.15); }
.tag-qty {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    min-width: 20px;
    text-align: center;
}
.tag-x {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 10px 0 4px;
    min-height: auto;
    line-height: 1;
    opacity: 0.5;
}
.tag-x:hover { opacity: 1; color: var(--red); }
.assign-select {
    font-size: 0.85rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 16px 32px;
    margin-top: 48px;
    border-top: 1px solid var(--border);
}
.footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.footer a:hover { color: var(--cyan); }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: flex; }
.htmx-request.htmx-indicator { display: flex; }

/* Scan progress */
.scan-progress {
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
}
.scan-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.scan-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    border-radius: 2px;
    animation: scan-slide 1.2s ease-in-out infinite;
}
@keyframes scan-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}
