/* Core Variables & Design System */
:root {
    --bg-dark: #03000b;
    --panel-bg: rgba(9, 6, 21, 0.45);
    --panel-border: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Neon gradients & highlights */
    --accent-violet: #a855f7;
    --accent-pink: #f43f5e;
    --accent-gold: #f59e0b;
    --accent-green: #10b981;
    --accent-danger: #f43f5e;
    
    --grad-primary: linear-gradient(135deg, #c084fc 0%, #f43f5e 100%);
    --grad-button: linear-gradient(135deg, #a855f7 0%, #f43f5e 100%);
    --grad-button-hover: linear-gradient(135deg, #9333ea 0%, #e11d48 100%);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-neon: 0 0 25px rgba(168, 85, 247, 0.35);
    --shadow-panel: 0 10px 40px rgba(0, 0, 0, 0.6);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Glowing Orbs */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.12;
    pointer-events: none;
}

.bg-glow-1 {
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
    top: -150px;
    left: -150px;
    animation: orbFloat 22s infinite alternate ease-in-out;
}

.bg-glow-2 {
    background: radial-gradient(circle, var(--accent-pink) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation: orbFloat 28s infinite alternate-reverse ease-in-out;
}

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1350px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
    justify-content: center;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 4px;
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    cursor: default;
    user-select: none;
}

.gradient-text {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    filter: drop-shadow(0 2px 10px rgba(167, 139, 250, 0.2));
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Three-Column Workspace Grid */
.app-main {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 1050px) {
    .app-main {
        grid-template-columns: 1fr;
    }
    .panel-center {
        order: -1; /* Display wheel at top on mobile layout */
    }
    .app-container {
        padding: 16px;
    }
}

/* Panels (Glassmorphism) */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-left, .panel-right {
    min-height: 480px;
}

.panel-center {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

/* Panel Sections */
.panel-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--grad-button);
    color: white;
    box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
    background: var(--grad-button-hover);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.18);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-success {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.35);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* Inputs */
.input-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

input[type="text"],
input[type="password"],
textarea,
select {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-violet);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

/* Bulk Input Area */
.bulk-toggle-container {
    display: flex;
    justify-content: flex-end;
}

.bulk-input-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bulk-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lists Styling */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.list-wrapper {
    flex-grow: 1;
    max-height: 260px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
    padding: 4px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Participants list elements */
.participant-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.02);
    animation: fadeIn 0.25s ease-out;
}

.participant-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.participant-name {
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.btn-delete-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-delete-item:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Prizes list elements (themed Pink/Gold) */
.prize-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prize-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(236, 72, 153, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(236, 72, 153, 0.05);
    animation: fadeIn 0.25s ease-out;
}

.prize-item:hover {
    background: rgba(236, 72, 153, 0.06);
    border-color: rgba(236, 72, 153, 0.12);
}

.prize-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #f472b6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Wheel Container & Canvas */
.wheel-outer-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    width: 100%;
    max-width: 480px;
}

.canvas-container {
    position: relative;
    border-radius: 50%;
    padding: 8px;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.35) 100%);
    box-shadow: 0 0 50px rgba(0,0,0,0.65), 0 0 25px rgba(168, 85, 247, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.5s ease;
    will-change: transform;
}

.canvas-container.spinning {
    box-shadow: 0 0 60px rgba(0,0,0,0.7), 0 0 35px rgba(168, 85, 247, 0.3);
}

/* Neon ring that pulses during spin - applied via shake-active */
.canvas-container.shake-active {
    box-shadow:
        0 0 0 3px rgba(168, 85, 247, 0.6),
        0 0 0 6px rgba(244, 63, 94, 0.3),
        0 0 60px rgba(0,0,0,0.7),
        0 0 50px rgba(168, 85, 247, 0.5);
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 50%;
}

/* Wheel Pointer/Pin */
.wheel-pointer-container {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

.wheel-pointer {
    width: 30px;
    height: 36px;
    background: linear-gradient(185deg, var(--accent-gold), #d97706);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 4px 5px rgba(0,0,0,0.5));
    border-radius: 3px;
    animation: pointerPulse 2s infinite alternate ease-in-out;
}

/* Spin Button Overlay (Center) */
.btn-spin {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, #f43f5e 0%, #be123c 100%);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.45), inset 0 2px 4px rgba(255,255,255,0.4);
    border: 4px solid #1f2937;
    z-index: 15;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-spin:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 0 30px rgba(244, 63, 94, 0.7), inset 0 2px 6px rgba(255,255,255,0.5);
    background: radial-gradient(circle, #ff4d6d 0%, #e11d48 100%);
}

.btn-spin:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-spin:disabled {
    background: #374151;
    color: #6b7280;
    box-shadow: none;
    border-color: #1f2937;
    cursor: not-allowed;
    transform: scale(0.95);
}

.btn-spin-text {
    letter-spacing: 0.05em;
    text-shadow: 0 2px 3px rgba(0,0,0,0.4);
}

/* Modal Overlay & Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 16, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(139, 92, 246, 0.08);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 440px;
    padding: 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden,
.modal-content.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.9);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: white;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 10px;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
}

.form-select option {
    background: #111827;
    color: var(--text-primary);
}

.error-text {
    font-size: 0.85rem;
    color: #f87171;
    font-weight: 500;
}

/* Custom Switch for settings modal */
.switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.switch-label input {
    display: none;
}

.switch-custom {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s ease;
}

.switch-custom::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.switch-label input:checked + .switch-custom {
    background: var(--accent-green);
}

.switch-label input:checked + .switch-custom::after {
    transform: translateX(20px);
}

.label-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* Winner Celebration Overlay */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 16, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.4s ease-out;
}

.winner-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px;
    max-width: 500px;
    animation: popWinnerContent 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.winner-label {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.winner-name {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.65), 0 0 40px rgba(236, 72, 153, 0.45);
    line-height: 1.2;
    word-break: break-word;
    animation: pulseWinner 1.5s infinite alternate ease-in-out;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popWinnerContent {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseWinner {
    0% { transform: scale(0.98); text-shadow: 0 0 20px rgba(139, 92, 246, 0.6), 0 0 40px rgba(236, 72, 153, 0.4); }
    100% { transform: scale(1.04); text-shadow: 0 0 30px rgba(139, 92, 246, 0.85), 0 0 60px rgba(236, 72, 153, 0.65); }
}

/* Confetti Canvas */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 140;
}

/* Hidden Utility class */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes pointerPulse {
    0% { transform: translateX(-50%) translateY(0); }
    100% { transform: translateX(-50%) translateY(-2px); }
}

/* Lightning Screen Flash & Overlay */
.lightning-flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 135;
    background-color: rgba(255, 255, 255, 0);
}

.lightning-flash-overlay.flash-active {
    animation: lightningFlash 0.5s ease-out;
}

@keyframes lightningFlash {
    0% { background-color: rgba(255, 255, 255, 0); }
    5% { background-color: rgba(225, 242, 255, 0.95); }
    10% { background-color: rgba(255, 255, 255, 0.15); }
    15% { background-color: rgba(235, 245, 255, 0.9); }
    100% { background-color: rgba(255, 255, 255, 0); }
}

/* Premium pulse glowing cards and transitions */
.panel {
    transition: filter 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), 
                opacity 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}

.panel:hover {
    border-color: rgba(168, 85, 247, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(168, 85, 247, 0.05);
}

/* Sidebar Blur and Focus states during spin */
.blur-active {
    filter: blur(6px);
    opacity: 0.3;
    pointer-events: none;
}

/* Chaotic Shaking Animation for the center wheel container */
.shake-active {
    animation: chaoticShake 0.12s infinite linear;
}

@keyframes chaoticShake {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    10% { transform: translate(-2px, -3px) rotate(-0.5deg) scale(1.005); }
    20% { transform: translate(3px, 0px) rotate(0.8deg) scale(0.995); }
    30% { transform: translate(0px, 2px) rotate(0deg) scale(1); }
    40% { transform: translate(2px, -2px) rotate(0.5deg) scale(1.002); }
    50% { transform: translate(-3px, 2px) rotate(-0.8deg) scale(0.998); }
    60% { transform: translate(-2px, 1px) rotate(0.3deg) scale(1); }
    70% { transform: translate(3px, 2px) rotate(-0.5deg) scale(1.004); }
    80% { transform: translate(-1px, -2px) rotate(0.8deg) scale(0.996); }
    90% { transform: translate(2px, 3px) rotate(0deg) scale(1.002); }
    100% { transform: translate(0px, 0px) rotate(0deg) scale(1); }
}

