/* ═══════════════════════════════════════════════════
   CONTEST PLATFORM — Clean Light UI
   AI Startup aesthetic · No gradients · No shadows
   Minimal · Crisp · Modern
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Design Tokens ─────────────────────────────── */
:root {
    --font-body: 'Inter', -apple-system, system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --black: #09090b;
    --gray-950: #18181b;
    --gray-900: #27272a;
    --gray-800: #3f3f46;
    --gray-700: #52525b;
    --gray-600: #71717a;
    --gray-500: #a1a1aa;
    --gray-400: #d4d4d8;
    --gray-300: #e4e4e7;
    --gray-200: #e8e8ec;
    --gray-100: #f4f4f5;
    --gray-50:  #fafafa;
    --white:    #ffffff;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-muted: #dbeafe;

    --green: #16a34a;
    --green-light: #f0fdf4;
    --yellow: #ca8a04;
    --yellow-light: #fefce8;
    --red: #dc2626;
    --red-light: #fef2f2;

    --radius: 8px;
    --radius-lg: 12px;
    --border: #e4e4e7;
}

* {
    font-family: var(--font-body);
}
code, pre, .font-mono {
    font-family: var(--font-mono);
}

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ══════════════════════════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════════════════════════ */

/* ── Sidebar ───────────────────────────────────── */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--border);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.admin-sidebar .brand-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-sidebar .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--black);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.admin-sidebar nav a:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.admin-sidebar nav a.active {
    color: var(--black);
    background: var(--gray-50);
    border-left-color: var(--black);
    font-weight: 600;
}

.admin-sidebar nav a .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

/* ── Content Area ──────────────────────────────── */
.admin-content {
    margin-left: 240px;
    min-height: 100vh;
    background: var(--gray-50);
}

.admin-topbar {
    height: 56px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    padding: 0 28px;
    justify-content: space-between;
}

/* ── Stat Cards ────────────────────────────────── */
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.15s;
}

.stat-card:hover {
    border-color: var(--gray-400);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--black);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.stat-card.accent .stat-value {
    color: var(--accent);
}

/* ── Glass Cards ───────────────────────────────── */
.glass-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.glass-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Tables ────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 10px 20px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody td {
    padding: 12px 20px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.data-table tbody td a {
    color: var(--black);
    text-decoration: none;
    font-weight: 600;
}

.data-table tbody td a:hover {
    color: var(--accent);
}

/* ── Badges ────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success { background: var(--green-light); color: var(--green); }
.badge-warning { background: var(--yellow-light); color: var(--yellow); }
.badge-danger  { background: var(--red-light); color: var(--red); }
.badge-info    { background: var(--accent-light); color: var(--accent); }
.badge-muted   { background: var(--gray-100); color: var(--gray-600); }

/* ── Buttons ───────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--black);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--gray-800);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--gray-50);
    color: var(--black);
    border-color: var(--gray-400);
}

.btn-danger {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-icon:hover {
    background: var(--gray-50);
    color: var(--black);
    border-color: var(--gray-400);
}

/* ── Form Controls ─────────────────────────────── */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--black);
    font-size: 0.875rem;
    transition: border-color 0.15s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--black);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 32px;
}

input[type="color"].form-input {
    padding: 3px;
    height: 38px;
    cursor: pointer;
}

input[type="file"].form-input {
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--gray-600);
}

input[type="file"].form-input::file-selector-button {
    background: var(--black);
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
}

/* ── Alerts ────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    animation: alertSlide 0.25s ease;
}

.alert-success {
    background: var(--green-light);
    border: 1px solid #bbf7d0;
    color: var(--green);
}

.alert-danger {
    background: var(--red-light);
    border: 1px solid #fecaca;
    color: var(--red);
}

@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Segment Builder ───────────────────────────── */
.segment-row {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}

.segment-row:hover {
    border-color: var(--gray-400);
}

/* ── Pagination ────────────────────────────────── */
nav[aria-label="Pagination Navigation"] span,
nav[aria-label="Pagination Navigation"] a,
.pagination a, .pagination span {
    background: var(--white) !important;
    border-color: var(--border) !important;
    color: var(--gray-600) !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
}
nav[aria-label="Pagination Navigation"] span[aria-current],
.pagination .active span {
    background: var(--black) !important;
    color: var(--white) !important;
    border-color: var(--black) !important;
}

/* ── Audit Log ─────────────────────────────────── */
.log-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.log-item:last-child { border-bottom: none; }
.log-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--black);
    margin-top: 6px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   PUBLIC PAGES
   ══════════════════════════════════════════════════ */

/* ── Navigation ────────────────────────────────── */
.public-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ── Hero ──────────────────────────────────────── */
.public-hero {
    background: var(--white);
    position: relative;
    overflow: hidden;
    padding: 72px 0 56px;
    border-bottom: 1px solid var(--border);
}

.public-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, var(--gray-200) 1px, transparent 0);
    background-size: 32px 32px;
    opacity: 0.5;
}

.public-hero .hero-grid {
    display: none;
}

/* ── Contest Cards ─────────────────────────────── */
.contest-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s ease;
    position: relative;
}

.contest-card::before {
    display: none;
}

.contest-card:hover {
    border-color: var(--gray-400);
    transform: translateY(-2px);
}

.contest-card .card-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.type-roulette { background: #fef2f2; color: #dc2626; }
.type-lottery  { background: #f0fdf4; color: #16a34a; }
.type-quiz     { background: #eff6ff; color: #2563eb; }

/* ── Roulette ──────────────────────────────────── */
.roulette-stage {
    position: relative;
    width: 360px;
    height: 360px;
    margin: 0 auto;
}

.roulette-glow {
    display: none;
}

.roulette-ring {
    position: absolute;
    inset: -4px;
    border: 2px solid var(--black);
    border-radius: 50%;
}

.roulette-canvas {
    width: 360px;
    height: 360px;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.06, 0.98);
}

.roulette-pointer {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 24px solid var(--black);
}

.spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--black);
    color: white;
    border: 3px solid var(--white);
    font-weight: 800;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.spin-button:hover {
    transform: translate(-50%, -50%) scale(1.06);
    background: var(--gray-800);
}

.spin-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: translate(-50%, -50%);
}

/* ── Result Modal ──────────────────────────────── */
.result-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.result-overlay.active { display: flex; }

.result-modal {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.result-emoji {
    font-size: 56px;
    margin-bottom: 8px;
    animation: bounceEmoji 0.5s ease 0.2s both;
}

@keyframes bounceEmoji {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ── Form Card (public) ────────────────────────── */
.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 420px;
    margin: 0 auto;
}

/* ── Winners Table ─────────────────────────────── */
.winners-table {
    width: 100%;
    border-collapse: collapse;
}

.winners-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--border);
}

.winners-table td {
    padding: 14px 20px;
    color: var(--gray-700);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
}

.winners-table tr { transition: background 0.1s; }
.winners-table tr:hover { background: var(--gray-50); }

/* ── Animations ────────────────────────────────── */
.fade-in { animation: fadeIn 0.4s ease both; }
.fade-in-up { animation: fadeInUp 0.4s ease both; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.08s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.16s; }

/* ── Mobile ────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-content { margin-left: 0; }
    .roulette-stage { width: 300px; height: 300px; }
    .roulette-canvas { width: 300px; height: 300px; }
}
