/* ================================================================
   TEA Voting Engine — Frontend Styles
   Theme: Taifa Excellence Awards | Gold × Black × Deep Navy
   ================================================================ */

:root {
    --tea-gold:      #FFD700;
    --tea-gold-dark: #C9A800;
    --tea-black:     #0d0d0d;
    --tea-navy:      #0a1628;
    --tea-card:      #111827;
    --tea-border:    rgba(255,215,0,0.2);
    --tea-text:      #f0f0f0;
    --tea-muted:     #9ca3af;
    --tea-green:     #22c55e;
    --tea-red:       #ef4444;
    --tea-radius:    14px;
    --tea-shadow:    0 8px 32px rgba(0,0,0,0.5);
}

/* ── Page Wrap ──────────────────────────────────────────────── */
.tve-page-wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px 60px; }

/* ── Brand Header ───────────────────────────────────────────── */
.tve-brand-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #0a0a0a 0%, #0a1628 100%);
    border: 1px solid var(--tea-border);
    border-radius: 16px;
    margin-bottom: 28px;
    position: relative;
}
.tve-brand-header img { width: 80px; height: 80px; object-fit: contain; border-radius: 12px; flex-shrink: 0; }
.tve-brand-header h2  { color: #fff; font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.tve-brand-header p   { color: var(--tea-gold); font-size: 0.85rem; margin: 0; text-transform: uppercase; letter-spacing: .5px; }
.tve-live-pill {
    position: absolute; right: 20px; top: 20px;
    background: rgba(239,68,68,.15); border: 1px solid #ef4444; color: #ef4444;
    padding: 4px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 700;
    animation: tve-pulse 2s ease-in-out infinite;
}
@keyframes tve-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Filter Bar ─────────────────────────────────────────────── */
.tve-filter-bar {
    display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
}
.tve-filter-bar input,
.tve-filter-bar select {
    flex: 1; min-width: 200px; padding: 12px 16px;
    background: #1a1a2e; border: 1px solid var(--tea-border);
    border-radius: 8px; color: var(--tea-text); font-size: 14px; outline: none;
    transition: border-color .2s;
}
.tve-filter-bar input:focus,
.tve-filter-bar select:focus { border-color: var(--tea-gold); }

/* ── Contestants Grid ───────────────────────────────────────── */
.tve-grid { display: grid; gap: 20px; }
.tve-grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tve-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Contestant Card ────────────────────────────────────────── */
.tve-card {
    background: var(--tea-card); border: 1px solid var(--tea-border);
    border-radius: var(--tea-radius); overflow: hidden; position: relative;
    transition: transform .25s, box-shadow .25s, border-color .25s;
    box-shadow: var(--tea-shadow);
}
.tve-card:hover { transform: translateY(-5px); border-color: var(--tea-gold); box-shadow: 0 16px 40px rgba(255,215,0,.15); }
.tve-medal { position: absolute; top: 10px; left: 10px; font-size: 22px; z-index: 2; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
.tve-card-photo { height: 200px; overflow: hidden; background: var(--tea-navy); }
.tve-card-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s; }
.tve-card:hover .tve-card-photo img { transform: scale(1.06); }
.tve-card-body { padding: 16px; }
.tve-card-name { font-size: 1rem; font-weight: 700; margin: 0 0 5px; }
.tve-card-name a { color: #fff; text-decoration: none; }
.tve-card-name a:hover { color: var(--tea-gold); }
.tve-card-award { font-size: 0.75rem; color: var(--tea-gold); font-weight: 600; margin: 0 0 10px; line-height: 1.3; }
.tve-card-votes { font-size: 0.88rem; color: var(--tea-text); margin-bottom: 14px; }
.tve-card-vote-num { color: var(--tea-gold); font-size: 1.1rem; }
.tve-vote-btn {
    width: 100%; padding: 11px; background: linear-gradient(135deg, var(--tea-gold), var(--tea-gold-dark));
    color: #000; border: none; border-radius: 8px; font-weight: 700; font-size: 0.88rem;
    cursor: pointer; transition: opacity .2s, transform .1s; letter-spacing: .3px;
}
.tve-vote-btn:hover { opacity: .9; transform: scale(1.02); }

/* ── Modal ──────────────────────────────────────────────────── */
.tve-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tve-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.8); backdrop-filter: blur(4px); }
body.tve-modal-open { overflow: hidden; }
.tve-modal-box {
    position: relative; background: var(--tea-card); border: 1px solid var(--tea-border);
    border-radius: 18px; padding: 28px; width: 100%; max-width: 500px;
    max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,.8); z-index: 1;
}
.tve-modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--tea-muted); font-size: 24px; cursor: pointer; transition: color .2s; line-height: 1; }
.tve-modal-close:hover { color: #fff; }
.tve-modal-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--tea-border); }
.tve-modal-brand img { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.tve-modal-brand span { font-size: 0.75rem; font-weight: 700; color: var(--tea-gold); text-transform: uppercase; letter-spacing: 1px; }
.tve-modal-contestant { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--tea-border); }
.tve-modal-contestant img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--tea-gold); flex-shrink: 0; }
.tve-modal-contestant h3 { margin: 0 0 4px; color: #fff; font-size: 1.05rem; }
.tve-modal-contestant p  { margin: 0; color: var(--tea-gold); font-size: 0.78rem; }
.tve-modal-votes { color: var(--tea-text) !important; font-size: 0.82rem !important; margin-top: 4px !important; }

/* ── Vote Summary ───────────────────────────────────────────── */
.tve-vote-summary { background: rgba(255,215,0,.05); border: 1px solid var(--tea-border); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }
.tve-summary-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.85rem; color: var(--tea-muted); border-bottom: 1px solid rgba(255,255,255,.04); }
.tve-summary-row:last-child { border-bottom: none; }
.tve-summary-row strong { color: var(--tea-text); }

/* ── Form Groups ────────────────────────────────────────────── */
.tve-form-group { margin-bottom: 16px; }
.tve-form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--tea-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.tve-form-group input { width: 100%; padding: 12px 14px; background: rgba(255,255,255,.05); border: 1px solid var(--tea-border); border-radius: 8px; color: #fff; font-size: 15px; outline: none; box-sizing: border-box; transition: border-color .2s; }
.tve-form-group input:focus { border-color: var(--tea-gold); }
.tve-form-group small { display: block; font-size: 0.73rem; color: var(--tea-muted); margin-top: 5px; }

/* ── Presets ────────────────────────────────────────────────── */
.tve-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.tve-preset {
    padding: 9px 4px; background: rgba(255,215,0,.07); border: 1px solid var(--tea-border);
    border-radius: 8px; color: var(--tea-gold); font-size: 0.72rem; font-weight: 600;
    cursor: pointer; text-align: center; line-height: 1.3; transition: background .2s;
}
.tve-preset small { display: block; color: var(--tea-muted); font-size: 0.64rem; font-weight: 400; margin-top: 2px; }
.tve-preset:hover, .tve-preset.active { background: var(--tea-gold); color: #000; border-color: var(--tea-gold); }
.tve-preset.active small { color: #333; }

/* ── Pay Button ─────────────────────────────────────────────── */
.tve-pay-btn {
    width: 100%; padding: 15px; background: linear-gradient(135deg, #00b300, #007a00);
    color: #fff; border: none; border-radius: 10px; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: opacity .2s; margin-top: 6px; letter-spacing: .3px;
}
.tve-pay-btn:hover:not(:disabled) { opacity: .9; }
.tve-pay-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Messages ───────────────────────────────────────────────── */
.tve-msg-success, .tve-msg-error { margin-top: 12px; padding: 12px 16px; border-radius: 8px; font-size: 0.86rem; line-height: 1.5; }
.tve-msg-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.tve-msg-error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

/* ── STK Waiting ────────────────────────────────────────────── */
.tve-stk-waiting { text-align: center; padding: 20px; border: 1px dashed var(--tea-gold); border-radius: 10px; margin-top: 14px; color: var(--tea-text); }
.tve-stk-waiting p { margin: 8px 0 4px; }
.tve-stk-waiting small { color: var(--tea-muted); font-size: 0.78rem; }

/* ── Spinner ────────────────────────────────────────────────── */
.tve-spinner { width: 38px; height: 38px; border: 3px solid rgba(255,215,0,.15); border-top-color: var(--tea-gold); border-radius: 50%; animation: tve-spin .75s linear infinite; margin: 0 auto 10px; }
@keyframes tve-spin { to { transform: rotate(360deg); } }
.tve-loading { text-align: center; padding: 48px; color: var(--tea-muted); }
.tve-error, .tve-empty-state { text-align: center; padding: 40px; color: var(--tea-muted); }

/* ── Leaderboard ────────────────────────────────────────────── */
.tve-lb-filters { margin-bottom: 20px; }
.tve-lb-filters select { width: 100%; max-width: 380px; padding: 12px 16px; background: #1a1a2e; border: 1px solid var(--tea-border); border-radius: 8px; color: var(--tea-text); font-size: 14px; outline: none; }
.tve-lb-list { display: flex; flex-direction: column; gap: 8px; }
.tve-lb-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--tea-card); border: 1px solid var(--tea-border); border-radius: 12px; padding: 14px 16px;
    transition: border-color .2s;
}
.tve-lb-row:hover   { border-color: var(--tea-gold); }
.tve-lb-top         { border-color: rgba(255,215,0,.4); background: rgba(255,215,0,.03); }
.tve-lb-rank        { font-size: 1.25rem; min-width: 36px; text-align: center; font-weight: 800; color: var(--tea-muted); }
.tve-lb-photo       { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid var(--tea-border); flex-shrink: 0; }
.tve-lb-info        { flex: 1; min-width: 0; }
.tve-lb-name        { font-weight: 700; color: #fff; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tve-lb-name a      { color: inherit; text-decoration: none; }
.tve-lb-name a:hover{ color: var(--tea-gold); }
.tve-lb-award       { font-size: 0.72rem; color: var(--tea-gold); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tve-lb-bar-wrap    { background: rgba(255,255,255,.06); border-radius: 4px; height: 4px; margin-top: 8px; overflow: hidden; }
.tve-lb-bar         { height: 100%; background: linear-gradient(90deg, var(--tea-gold), var(--tea-gold-dark)); border-radius: 4px; transition: width .6s ease; }
.tve-lb-stat        { text-align: right; flex-shrink: 0; }
.tve-lb-votes       { font-weight: 800; color: var(--tea-gold); font-size: 1rem; }
.tve-lb-votes small { font-weight: 400; color: var(--tea-muted); font-size: 0.7rem; display: block; }
.tve-lb-vote-btn    { display: inline-block; margin-top: 5px; padding: 4px 12px; background: var(--tea-gold); color: #000; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-decoration: none; transition: opacity .2s; }
.tve-lb-vote-btn:hover { opacity: .85; }
.tve-refresh-note   { text-align: center; font-size: 0.73rem; color: var(--tea-muted); margin-top: 16px; }

/* ── Single Contestant Page ─────────────────────────────────── */
.tve-back-link { display: inline-block; color: var(--tea-gold); text-decoration: none; font-size: 0.85rem; margin-bottom: 20px; }
.tve-back-link:hover { opacity: .8; }
.tve-single-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: start; }
.tve-profile-card { background: var(--tea-card); border: 1px solid var(--tea-border); border-radius: var(--tea-radius); padding: 32px; text-align: center; }
.tve-profile-photo-wrap { margin-bottom: 20px; }
.tve-profile-photo { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; border: 3px solid var(--tea-gold); box-shadow: 0 0 40px rgba(255,215,0,.2); }
.tve-profile-name { color: #fff; font-size: 1.5rem; margin: 0 0 8px; }
.tve-profile-award { color: var(--tea-gold); font-size: 0.88rem; font-weight: 600; margin: 0 0 16px; }
.tve-profile-votes { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.1rem; color: var(--tea-text); }
.tve-vote-star  { font-size: 1.2rem; }
.tve-vote-number{ font-weight: 800; color: var(--tea-gold); font-size: 1.4rem; }
.tve-profile-bio { margin-top: 20px; font-size: 0.88rem; color: var(--tea-muted); line-height: 1.6; text-align: left; }
.tve-vote-form-card { background: var(--tea-card); border: 1px solid var(--tea-border); border-radius: var(--tea-radius); padding: 32px; }
.tve-vote-form-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--tea-border); }
.tve-vote-form-header img { width: 50px; height: 50px; object-fit: contain; border-radius: 8px; }
.tve-vote-form-header h2 { margin: 0 0 4px; color: var(--tea-gold); font-size: 1.1rem; }
.tve-vote-form-header p  { margin: 0; color: var(--tea-muted); font-size: 0.8rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tve-single-layout { grid-template-columns: 1fr; }
    .tve-presets       { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .tve-grid-4, .tve-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .tve-brand-header  { flex-direction: column; text-align: center; }
    .tve-lb-award      { display: none; }
    .tve-presets       { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .tve-grid-4, .tve-grid-3 { grid-template-columns: 1fr; }
    .tve-modal-box { padding: 18px; }
}

/* ── Crown & Leader Card ─────────────────────────────────────── */
.tve-crown {
    position: absolute; top: 8px; right: 10px;
    font-size: 26px; z-index: 3;
    filter: drop-shadow(0 2px 6px rgba(255,215,0,.7));
    animation: tve-float 2.5s ease-in-out infinite;
}
@keyframes tve-float {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}
.tve-card-leader {
    border-color: var(--tea-gold) !important;
    box-shadow: 0 0 30px rgba(255,215,0,.25) !important;
}
.tve-card-leader .tve-card-photo::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(255,215,0,.15));
    pointer-events: none;
}

/* ── Most Popular Preset ─────────────────────────────────────── */
.tve-preset { position: relative; }
.tve-preset.tve-popular {
    border-color: var(--tea-gold) !important;
    background: rgba(255,215,0,.15) !important;
    transform: scale(1.05);
}
.tve-pop-badge {
    font-size: 0.6rem; font-weight: 800;
    color: var(--tea-gold); text-transform: uppercase;
    letter-spacing: .4px; margin-bottom: 3px;
}
.tve-preset-amount { font-weight: 700; font-size: 0.82rem; }
.tve-preset-votes  { font-size: 0.66rem; color: var(--tea-muted); margin-top: 2px; }
.tve-preset.active .tve-preset-votes,
.tve-preset.tve-popular.active .tve-pop-badge { color: #333; }

/* ── Presets grid (dynamic count) ───────────────────────────── */
.tve-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 7px; margin-bottom: 12px;
}

/* ── Voting Closed Banner ────────────────────────────────────── */
.tve-closed-banner {
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5; padding: 14px 20px; border-radius: 10px;
    text-align: center; font-weight: 600; margin-bottom: 20px;
    font-size: 0.95rem;
}

/* ── Settings preview popular card ──────────────────────────── */
.tve-preview-card.popular {
    border: 2px solid #FFD700; background: #fffbeb; position: relative;
}
.tve-popular-badge {
    font-size: 10px; font-weight: 700; color: #C9A800;
    text-transform: uppercase; margin-bottom: 4px; letter-spacing: .3px;
}
.tve-callback-code {
    background: #1a1a1a; color: #FFD700; padding: 8px 14px;
    border-radius: 6px; display: inline-block; word-break: break-all;
    font-size: 12px; margin-bottom: 6px;
}
