/* ============================================
   SevenDrip Raffle Spinner — Stylesheet
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-panel: #16162a;
    --bg-panel-hover: #1c1c3a;
    --text-primary: #f0f0f5;
    --text-secondary: #8888aa;
    --text-muted: #55557a;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.3);
    --accent-secondary: #ff6b6b;
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.3);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 64px rgba(0,0,0,0.5);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Background Particles --- */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles .particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    animation: floatParticle 12s ease-in-out infinite;
}

@keyframes floatParticle {
    0%, 100% { opacity: 0; transform: translateY(100vh) scale(0); }
    20% { opacity: 0.15; }
    50% { opacity: 0.08; }
    80% { opacity: 0.12; }
    90% { opacity: 0; transform: translateY(-20vh) scale(1); }
}

/* --- App Container --- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 28px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--bg-panel) 0%, rgba(233, 69, 96, 0.05) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
}

.brand {
    flex-shrink: 0;
}

.brand-logo {
    height: 68px;
    width: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: #fff;
    padding: 6px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.brand-logo:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4);
}

.header-text {
    flex: 1;
}

.title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-name {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.header-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #2ecc71;
    letter-spacing: 0.08em;
    animation: liveFlash 2s ease-in-out infinite;
}

@keyframes liveFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.badge-text {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    min-height: 0;
}

/* --- Panels --- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* --- Input Panel --- */
.input-panel {
    max-height: calc(100vh - 200px);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.panel-icon {
    font-size: 1.2rem;
}

.participant-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 26px;
    padding: 0 8px;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    transition: var(--transition);
}

.names-input {
    flex: 1;
    min-height: 280px;
    resize: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    line-height: 1.7;
    padding: 16px;
    outline: none;
    transition: var(--transition);
}

.names-input::placeholder {
    color: var(--text-muted);
}

.names-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    flex: 1;
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    background: #d63650;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

/* --- Spinner Panel --- */
.spinner-panel {
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.spinner-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* --- Spinner Container --- */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.wheel-outer {
    position: relative;
    width: 460px;
    height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    transition: transform 0.06s ease-out;
}

.wheel-pointer.ticking {
    /* Kept for backward compat, now using inline style transitions */
    animation: pointerTick 0.08s ease-in-out;
}

@keyframes pointerTick {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    50% { transform: translateX(-50%) rotate(5deg); }
}

#wheelCanvas {
    width: 440px;
    height: 440px;
    border-radius: 50%;
    box-shadow:
        0 0 0 6px var(--bg-secondary),
        0 0 0 8px var(--accent),
        0 0 40px var(--accent-glow),
        var(--shadow-lg);
    transition: box-shadow 0.4s ease;
    will-change: transform;
    image-rendering: auto;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 4px var(--bg-secondary), 0 0 20px rgba(0,0,0,0.5);
    z-index: 5;
    overflow: hidden;
}

.wheel-center-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 50%;
}

/* --- Spin Button --- */
.spin-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent) 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-family: var(--font-display);
    overflow: hidden;
    box-shadow: 0 6px 30px var(--accent-glow);
    transition: var(--transition);
}

.spin-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    border-radius: inherit;
}

.spin-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 40px var(--accent-glow);
}

.spin-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spin-btn-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    line-height: 1;
}

.spin-btn-subtitle {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
    letter-spacing: 0.03em;
}

/* --- Winner Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    transform: scale(0.8) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(500px) rotate(720deg) scale(0.3); }
}

.trophy {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: trophyBounce 0.6s ease-out;
}

@keyframes trophyBounce {
    0% { transform: scale(0) rotate(-20deg); }
    60% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 20px;
}

.winner-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(233,69,96,0.1), rgba(255,215,0,0.1));
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    word-break: break-word;
    text-shadow: 0 0 30px var(--gold-glow);
}

.winner-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions .btn {
    min-width: 120px;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 20px 0 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .input-panel {
        max-height: none;
    }

    .names-input {
        min-height: 160px;
    }

    .wheel-outer {
        width: 340px;
        height: 340px;
    }

    #wheelCanvas {
        width: 320px;
        height: 320px;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-badge {
        flex-direction: row;
        gap: 10px;
    }
}

@media (max-width: 500px) {
    .app-container {
        padding: 12px;
    }

    .panel {
        padding: 16px;
    }

    .wheel-outer {
        width: 290px;
        height: 290px;
    }

    #wheelCanvas {
        width: 270px;
        height: 270px;
    }

    .wheel-center {
        width: 50px;
        height: 50px;
    }

    .wheel-center-logo {
        width: 38px;
        height: 38px;
    }

    .title {
        font-size: 1.35rem;
    }

    .winner-name {
        font-size: 1.5rem;
    }
}

/* --- Scrollbar --- */
.names-input::-webkit-scrollbar {
    width: 6px;
}

.names-input::-webkit-scrollbar-track {
    background: transparent;
}

.names-input::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.names-input::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Spinning state glow --- */
.spinning #wheelCanvas {
    box-shadow:
        0 0 0 6px var(--bg-secondary),
        0 0 0 8px var(--accent),
        0 0 60px var(--accent-glow),
        0 0 120px rgba(233, 69, 96, 0.15),
        var(--shadow-lg);
}

