/* ================================================================
   BoozeBattle — Dark Cocktail Theme
   ================================================================ */

:root {
    --bg:             #0f0e17;
    --bg-card:        #1a1928;
    --bg-card-hover:  #232238;
    --bg-input:       #16152a;
    --border:         #2d2b4a;
    --text:           #e8e6f0;
    --text-muted:     #9896ab;
    --primary:        #ff6b35;
    --primary-hover:  #ff8c5a;
    --accent:         #c44dff;
    --accent-hover:   #d87aff;
    --success:        #2ecc71;
    --danger:         #e74c3c;
    --warning:        #f1c40f;
    --radius:         10px;
    --radius-lg:      16px;
    --shadow:         0 4px 24px rgba(0,0,0,.35);
    --transition:     .2s ease;
    --font:           'Outfit', system-ui, -apple-system, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────── */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

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

/* ── Layout ────────────────────────────────────────────────────── */

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }

.main-content { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

/* ── Navbar ────────────────────────────────────────────────────── */

.navbar {
    background: rgba(15,14,23,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    padding: .75rem 0;
}

.navbar-inner { display: flex; align-items: center; justify-content: space-between; }

.logo {
    font-size: 1.4rem; font-weight: 800; color: var(--text);
    display: flex; align-items: center; gap: .4rem;
}
.logo:hover { color: var(--primary); }
.logo-icon { font-size: 1.6rem; }

.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: .95rem; }
.nav-links a:hover { color: var(--text); }

.nav-toggle {
    display: none; background: none; border: none; cursor: pointer;
    flex-direction: column; gap: 5px; padding: 4px;
}
.nav-toggle span {
    display: block; width: 24px; height: 2px; background: var(--text);
    border-radius: 2px; transition: var(--transition);
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-links {
        display: none; flex-direction: column;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--bg-card); border-bottom: 1px solid var(--border);
        padding: 1rem 1.25rem; gap: .75rem;
    }
    .nav-links.open { display: flex; }
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font); font-weight: 600; font-size: .95rem;
    padding: .65rem 1.5rem; border-radius: var(--radius);
    border: 2px solid transparent; cursor: pointer;
    transition: all var(--transition); text-align: center;
    gap: .4rem;
}

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

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

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }

.btn-sm { padding: .4rem 1rem; font-size: .85rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* ── Cards ─────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-flat:hover { transform: none; box-shadow: none; }

.card-header { margin-bottom: 1.25rem; }
.card-header h2 { font-size: 1.3rem; font-weight: 700; }

/* ── Forms ─────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block; font-weight: 500; margin-bottom: .35rem;
    color: var(--text-muted); font-size: .9rem;
}

.form-control {
    width: 100%; padding: .7rem 1rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: .95rem;
    transition: border-color var(--transition);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239896ab' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-help { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Alerts ────────────────────────────────────────────────────── */

.alert {
    padding: .85rem 1.25rem; border-radius: var(--radius);
    margin-bottom: 1.5rem; font-weight: 500; font-size: .95rem;
}
.alert-success { background: rgba(46,204,113,.12); border: 1px solid var(--success); color: var(--success); }
.alert-error   { background: rgba(231,76,60,.12);  border: 1px solid var(--danger);  color: var(--danger); }
.alert-warning { background: rgba(241,196,15,.12); border: 1px solid var(--warning); color: var(--warning); }
.alert-info    { background: rgba(196,77,255,.1);  border: 1px solid var(--accent);  color: var(--accent); }

/* ── Badges ────────────────────────────────────────────────────── */

.badge {
    display: inline-block; font-size: .75rem; font-weight: 600;
    padding: .25rem .65rem; border-radius: 50px; text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-draft       { background: rgba(152,150,171,.15); color: var(--text-muted); }
.badge-submissions { background: rgba(255,107,53,.15);  color: var(--primary); }
.badge-voting      { background: rgba(196,77,255,.15);  color: var(--accent); }
.badge-closed      { background: rgba(231,76,60,.15);   color: var(--danger); }
.badge-results     { background: rgba(46,204,113,.15);  color: var(--success); }
.badge-host        { background: rgba(255,107,53,.15);  color: var(--primary); }

/* ── Hero / Landing ────────────────────────────────────────────── */

.hero {
    text-align: center; padding: 4rem 0 3rem;
}
.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800;
    line-height: 1.15; margin-bottom: 1rem;
}
.hero h1 .highlight { color: var(--primary); }
.hero p {
    font-size: 1.15rem; color: var(--text-muted);
    max-width: 600px; margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; margin: 2rem 0 3rem;
}
.feature-card { text-align: center; padding: 2rem 1.5rem; }
.feature-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.feature-card h3 { margin-bottom: .5rem; font-weight: 600; }
.feature-card p  { color: var(--text-muted); font-size: .9rem; }

/* ── Page headers ──────────────────────────────────────────────── */

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: .25rem; }
.page-header p  { color: var(--text-muted); }

/* ── Grid helpers ──────────────────────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }

/* ── Battle card (dashboard) ───────────────────────────────────── */

.battle-card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: .4rem; }
.battle-card .battle-meta { color: var(--text-muted); font-size: .85rem; margin-bottom: .75rem; }
.battle-card .battle-meta span { margin-right: .75rem; }
.battle-card .battle-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ── Battle detail page ────────────────────────────────────────── */

.battle-hero {
    text-align: center; padding: 2rem 0;
    border-bottom: 1px solid var(--border); margin-bottom: 2rem;
}
.battle-hero h1 { font-size: 2rem; margin-bottom: .5rem; }
.battle-hero .theme-label { color: var(--accent); font-weight: 500; font-size: 1.05rem; margin-bottom: .75rem; }
.battle-hero .battle-desc { color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.battle-info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; margin-bottom: 2rem;
}
.info-tile { text-align: center; padding: 1rem; }
.info-tile .info-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.info-tile .info-value { font-size: 1.2rem; font-weight: 600; }

/* ── Members list ──────────────────────────────────────────────── */

.members-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.members-list li {
    background: var(--bg-input); padding: .35rem .85rem;
    border-radius: 50px; font-size: .85rem;
}

/* ── Entries grid ──────────────────────────────────────────────── */

.entry-card { position: relative; }
.entry-card h3 { font-size: 1.1rem; margin-bottom: .3rem; }
.entry-card .entry-author { color: var(--text-muted); font-size: .85rem; margin-bottom: .75rem; }
.entry-card .entry-section { margin-bottom: .75rem; }
.entry-card .entry-section h4 { font-size: .8rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: .04em; margin-bottom: .25rem; }
.entry-card .entry-section p { font-size: .9rem; }

.entry-image {
    width: 100%; height: 200px; object-fit: cover;
    border-radius: var(--radius); margin-bottom: 1rem;
}

/* ── Voting ────────────────────────────────────────────────────── */

.vote-entry { margin-bottom: 2rem; }
.vote-entry h3 { margin-bottom: 1rem; }

.score-row {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: .75rem; flex-wrap: wrap;
}
.score-row label { min-width: 120px; font-weight: 500; font-size: .9rem; }
.score-row input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--primary); }
.score-value {
    min-width: 36px; text-align: center; font-weight: 700; font-size: 1.1rem;
    color: var(--primary);
}

.voted-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    color: var(--success); font-weight: 600; font-size: .9rem;
}

/* ── Leaderboard ───────────────────────────────────────────────── */

.leaderboard-table {
    width: 100%; border-collapse: collapse; margin-top: 1rem;
}
.leaderboard-table th,
.leaderboard-table td {
    padding: .85rem 1rem; text-align: left;
    border-bottom: 1px solid var(--border);
}
.leaderboard-table th {
    font-size: .8rem; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: .04em;
}
.leaderboard-table tbody tr:hover { background: var(--bg-card-hover); }

.rank-cell { font-weight: 700; font-size: 1.2rem; }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.total-score { font-weight: 700; color: var(--primary); font-size: 1.1rem; }

/* Responsive leaderboard */
@media (max-width: 640px) {
    .leaderboard-table, .leaderboard-table thead,
    .leaderboard-table tbody, .leaderboard-table th,
    .leaderboard-table td, .leaderboard-table tr {
        display: block;
    }
    .leaderboard-table thead { display: none; }
    .leaderboard-table tr { margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
    .leaderboard-table td { padding: .3rem 0; border: none; display: flex; justify-content: space-between; }
    .leaderboard-table td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; }
}

/* ── Profile ───────────────────────────────────────────────────── */

.profile-header {
    display: flex; align-items: center; gap: 1.5rem;
    margin-bottom: 2rem; flex-wrap: wrap;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--accent); display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: #fff;
}

/* ── Utility ───────────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; }

.invite-code {
    font-family: 'Courier New', monospace; font-size: 1.5rem; font-weight: 700;
    letter-spacing: .15em; color: var(--primary);
    background: var(--bg-input); padding: .5rem 1.25rem;
    border-radius: var(--radius); display: inline-block;
    border: 1px dashed var(--border);
}

.section-title {
    font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem;
    padding-bottom: .5rem; border-bottom: 1px solid var(--border);
}

.empty-state {
    text-align: center; padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }

/* ── Auth card centering ───────────────────────────────────────── */

.auth-wrapper {
    max-width: 440px; margin: 2rem auto;
}

/* ── Mode selector (create battle) ─────────────────────────────── */

.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.mode-option { cursor: pointer; }
.mode-option input[type="radio"] { display: none; }

.mode-card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 1.25rem 1rem; border-radius: var(--radius-lg);
    border: 2px solid var(--border); background: var(--bg-input);
    transition: all var(--transition); gap: .3rem;
}
.mode-option input:checked + .mode-card {
    border-color: var(--primary);
    background: rgba(255,107,53,.06);
    box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.mode-card:hover { border-color: var(--text-muted); }
.mode-icon { font-size: 2rem; margin-bottom: .25rem; }

@media (max-width: 480px) {
    .mode-selector { grid-template-columns: 1fr; }
}

/* ── Presenting mode ───────────────────────────────────────────── */

.badge-presenting { background: rgba(255,107,53,.2); color: var(--primary); animation: pulse-badge 2s ease-in-out infinite; }
@keyframes pulse-badge { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

.presenting-progress { margin-top: 1rem; }
.progress-bar {
    width: 100%; height: 8px; background: var(--bg-input);
    border-radius: 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px; transition: width .5s ease;
}
.progress-label { margin-top: .4rem; font-size: .9rem; }

.presenting-card {
    text-align: center; position: relative;
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255,107,53,.04) 100%);
}
.presenting-badge {
    display: inline-block; background: var(--primary); color: #fff;
    font-weight: 700; font-size: .8rem; text-transform: uppercase;
    letter-spacing: .08em; padding: .3rem .9rem;
    border-radius: 50px; margin-bottom: .75rem;
}
.presenting-number {
    font-size: 3rem; font-weight: 800; color: var(--primary);
    opacity: .15; position: absolute; top: .5rem; right: 1.25rem;
}

/* Presentation order list */
.presentation-order { display: flex; flex-direction: column; gap: .4rem; }

.order-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: .9rem; transition: all var(--transition);
}
.order-item.order-current {
    border-color: var(--primary);
    background: rgba(255,107,53,.06);
}
.order-item.order-done { opacity: .5; }

.order-num {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border-radius: 50%;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.order-current .order-num { background: var(--primary); color: #fff; }

/* ── Waiting state ─────────────────────────────────────────────── */

.waiting-card { border-color: var(--accent); }

.waiting-pulse {
    font-size: 3.5rem; margin: .5rem 0;
    animation: waiting-bob 2s ease-in-out infinite;
}
@keyframes waiting-bob {
    0%,100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

/* ── Ranked voting (dropdown fallback, used by vote.php for online) ── */

.rank-table { display: flex; flex-direction: column; gap: .5rem; }

.rank-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }

.rank-entry-name { flex: 1; min-width: 0; }
.rank-entry-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-select {
    width: 70px; text-align: center; flex-shrink: 0;
    font-weight: 600; font-size: 1rem;
}

/* ── Rank tabs (rank.php) ─────────────────────────────────────── */

.rank-tabs {
    display: flex; gap: .35rem; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .25rem;
}
.rank-tab {
    flex-shrink: 0; padding: .5rem 1.1rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 50px; color: var(--text-muted);
    font-family: var(--font); font-size: .85rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; gap: .3rem;
}
.rank-tab:hover { border-color: var(--text-muted); color: var(--text); }
.rank-tab.active {
    background: var(--primary); border-color: var(--primary);
    color: #fff;
}
.tab-check { font-size: .75rem; }

.rank-panel { display: none; }
.rank-panel.active { display: block; }

/* ── Rank list (reorderable) ──────────────────────────────────── */

.rank-list { display: flex; flex-direction: column; gap: .4rem; }

.rank-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem 1rem; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.rank-item:active { transform: scale(.99); }

.rank-position {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border-radius: 50%;
    font-weight: 800; font-size: .95rem; flex-shrink: 0;
    color: var(--primary);
}
.rank-item:first-child .rank-position { background: var(--primary); color: #fff; }

.rank-item-info { flex: 1; min-width: 0; }
.rank-item-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-arrows { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }

.rank-arrow {
    width: 32px; height: 24px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text);
    font-size: .7rem; cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}
.rank-arrow:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.rank-arrow:disabled { opacity: .25; cursor: default; }

/* ── Footer ────────────────────────────────────────────────────── */

.site-footer {
    text-align: center; padding: 1.5rem 0;
    color: var(--text-muted); font-size: .85rem;
    border-top: 1px solid var(--border); margin-top: auto;
}
