/* ══════════════════════════════════════
   RESET & BASE
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #0f0f0f;
    --bg-card:    #1a1a1a;
    --bg-input:   #222222;
    --border:     #333333;
    --primary:    #00d4ff;
    --primary-dk: #00a8cc;
    --accent:     #ff6b00;
    --text:       #ffffff;
    --text-muted: #888888;
    --success:    #00cc66;
    --radius:     12px;
    --radius-sm:  8px;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,15,15,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
}

.header-inner {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
    font-weight: 700;
}

.logo-icon { font-size: 1.4em; }
.logo-text { color: var(--primary); }

/* ══════════════════════════════════════
   SECTIONS
══════════════════════════════════════ */
main { max-width: 600px; margin: 0 auto; padding: 0 16px 100px; }

.section { display: none; }
.section.active { display: block; }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ══════════════════════════════════════
   HERO
══════════════════════════════════════ */
.hero {
    text-align: center;
    padding: 40px 0 32px;
}

.hero-title {
    font-size: 2.2em;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
}

.highlight { color: var(--primary); }

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.05em;
}

/* ══════════════════════════════════════
   EVENT LIST
══════════════════════════════════════ */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
}

.event-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.event-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.event-card:active { transform: scale(0.98); }

.event-card-info h3 {
    font-size: 1.1em;
    margin-bottom: 4px;
}

.event-card-info p {
    color: var(--text-muted);
    font-size: 0.9em;
}

.event-card-arrow {
    color: var(--primary);
    font-size: 1.3em;
}

.event-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    margin-top: 6px;
}

.event-status.live {
    background: rgba(0,204,102,0.15);
    color: var(--success);
}

/* ══════════════════════════════════════
   TABS
══════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,212,255,0.08);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════
   TIPS BOX
══════════════════════════════════════ */
.tips-box {
    background: rgba(0,212,255,0.06);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.tips-title {
    font-size: 0.85em;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ══════════════════════════════════════
   SELFIE BOX
══════════════════════════════════════ */
.selfie-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selfie-box:hover { border-color: var(--primary); }
.selfie-box:active { transform: scale(0.99); }
.selfie-box.small { padding: 20px 16px; min-height: 100px; }

.selfie-placeholder { pointer-events: none; }
.selfie-icon { font-size: 2.5em; display: block; margin-bottom: 8px; }
.selfie-box.small .selfie-icon { font-size: 1.8em; }

.selfie-placeholder p {
    color: var(--text-muted);
    font-size: 0.95em;
}

.selfie-sub {
    font-size: 0.8em;
    color: var(--border);
    margin-top: 4px;
}

.selfie-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════
   BIB INPUT
══════════════════════════════════════ */
.bib-label {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.bib-input {
    width: 100%;
    padding: 18px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 2em;
    text-align: center;
    letter-spacing: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.bib-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn-primary {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: var(--radius);
    padding: 14px 24px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 24px;
    font-size: 0.95em;
    cursor: pointer;
    transition: border-color 0.2s;
}

.btn-secondary:hover { border-color: var(--primary); }

.btn-full { width: 100%; }

.btn-back {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-back:hover { border-color: var(--primary); color: var(--primary); }

/* ══════════════════════════════════════
   RESULT META
══════════════════════════════════════ */
.result-meta { display: flex; flex-direction: column; }

.result-count {
    font-size: 1em;
    font-weight: 600;
    color: var(--primary);
}

.search-time {
    font-size: 0.75em;
    color: var(--text-muted);
}

/* ══════════════════════════════════════
   CATEGORY FILTER
══════════════════════════════════════ */
.category-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.category-filter::-webkit-scrollbar { display: none; }

.cat-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    padding: 6px 16px;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.cat-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,212,255,0.08);
}

/* ══════════════════════════════════════
   GALLERY
══════════════════════════════════════ */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 20px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    background: var(--bg-card);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.photo-card:hover img { transform: scale(1.05); }

.photo-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.7);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.65em;
    display: flex;
    gap: 4px;
}

.badge-face { color: var(--primary); }
.badge-bib  { color: var(--accent); }
.badge-combo { color: var(--success); }

/* ══════════════════════════════════════
   LOAD MORE & BULK ACTIONS
══════════════════════════════════════ */
.load-more { text-align: center; margin: 16px 0; }

.bulk-actions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

/* ══════════════════════════════════════
   NO RESULTS
══════════════════════════════════════ */
.no-results {
    text-align: center;
    padding: 48px 16px;
}

.no-results-icon { font-size: 3em; margin-bottom: 16px; }

.no-results h3 {
    font-size: 1.3em;
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.no-results-tips {
    list-style: none;
    margin-bottom: 24px;
    text-align: left;
    display: inline-block;
}

.no-results-tips li {
    color: var(--text-muted);
    font-size: 0.9em;
    padding: 4px 0;
}

/* ══════════════════════════════════════
   LOADING
══════════════════════════════════════ */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

.spinner.large {
    width: 52px;
    height: 52px;
    border-width: 4px;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content { text-align: center; color: var(--text-muted); }
.loading-content p { margin-top: 16px; font-size: 1.05em; }

/* ══════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 600px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lb-img-container {
    position: relative;
    width: 100%;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-img-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.lb-close {
    position: absolute;
    top: -8px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1em;
    z-index: 2;
}

.lb-prev, .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.1em;
    z-index: 2;
}

.lb-prev { left: 0; }
.lb-next { right: 0; }

.lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 12px;
}

.lb-counter { color: var(--text-muted); font-size: 0.9em; }

.lb-badges {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
}

.btn-download {
    background: var(--primary);
    color: #000;
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: 0.9em;
    font-weight: 700;
    text-decoration: none;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 24px;
    font-size: 0.9em;
    z-index: 400;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 400px) {
    .gallery { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 1.8em; }
    .bib-input { font-size: 1.5em; letter-spacing: 4px; }
}

@media (min-width: 600px) {
    .gallery { grid-template-columns: repeat(4, 1fr); }
}
