/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0a1628;
    --bg-secondary: #0f1f3a;
    --bg-card: rgba(15, 31, 58, 0.7);
    --border-glow: rgba(212, 175, 55, 0.3);
    --gold: #d4af37;
    --gold-light: #f0d060;
    --gold-dark: #b8960c;
    --blue-accent: #1e90ff;
    --blue-dark: #0d47a1;
    --green-accent: #00c853;
    --text-primary: #f0f0f0;
    --text-secondary: #a0b4cc;
    --text-muted: #6d8299;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.15);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font-main: 'Outfit', sans-serif;
    --font-arabic: 'Amiri', serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

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

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(30, 60, 114, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(10, 22, 40, 1) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* ===== Particles ===== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    opacity: 0;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        opacity: 0;
        transform: translateY(-20vh) scale(1);
    }
}

/* ===== Banner ===== */
.banner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 0;
}

.banner-img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), 0 0 60px rgba(212, 175, 55, 0.15);
    border: 1px solid var(--border-glow);
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 32px 16px 80px;
}

/* ===== Title Section ===== */
.title-section {
    text-align: center;
    margin-bottom: 32px;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* ===== Section Title ===== */
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--gold-light);
}

.section-title .icon {
    font-size: 1.3rem;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hint {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 0.8rem;
}

textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

textarea::placeholder {
    color: var(--text-muted);
}

.number-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 200px;
}

.num-btn {
    width: 48px;
    height: 48px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold-light);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.num-btn.minus {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.num-btn.plus {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.num-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

.num-btn:active {
    transform: scale(0.95);
}

input[type="number"] {
    width: 80px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-right: none;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--gold);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1a1a2e;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.4);
}

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

.btn-draw {
    background: linear-gradient(135deg, #1e90ff, #0d47a1);
    color: white;
    box-shadow: 0 4px 20px rgba(30, 144, 255, 0.3);
    font-size: 1.15rem;
    padding: 18px 32px;
}

.btn-draw:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(30, 144, 255, 0.45);
}

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

.btn-draw:disabled {
    background: linear-gradient(135deg, #3a4a5a, #2a3a4a);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.1rem;
}

/* ===== Error Message ===== */
.error-msg {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
    text-align: center;
    transition: var(--transition);
}

/* ===== Raffle Panel ===== */
.raffle-info {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    justify-content: center;
}

.info-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    text-align: center;
    flex: 1;
    max-width: 180px;
}

.info-badge.accent {
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.08);
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.info-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold-light);
}

/* ===== Slot Machine ===== */
.slot-machine {
    margin: 28px auto;
    text-align: center;
}

.slot-window {
    width: 100%;
    max-width: 400px;
    height: 90px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border-glow);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.slot-window::before,
.slot-window::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 25px;
    z-index: 2;
    pointer-events: none;
}

.slot-window::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(10, 22, 40, 0.9), transparent);
}

.slot-window::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(10, 22, 40, 0.9), transparent);
}

.slot-reel {
    transition: transform 0.1s linear;
}

.slot-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gold-light);
    padding: 8px 16px;
    white-space: nowrap;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.slot-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
    font-weight: 300;
}

/* Spinning state */
.slot-machine.spinning .slot-window {
    border-color: var(--blue-accent);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(30, 144, 255, 0.3);
}

.slot-machine.spinning .slot-name {
    color: var(--blue-accent);
    text-shadow: 0 0 20px rgba(30, 144, 255, 0.5);
}

/* Revealed state */
.slot-machine.revealed .slot-window {
    border-color: var(--gold);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(212, 175, 55, 0.4);
    animation: glow-pulse 1s ease-in-out 3;
}

.slot-machine.revealed .slot-name {
    font-size: 1.8rem;
    color: var(--gold-light);
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.7);
    animation: name-pop 0.5s ease-out;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(212, 175, 55, 0.4);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 0 0 50px rgba(212, 175, 55, 0.6);
    }
}

@keyframes name-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== Names Pool ===== */
.names-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.name-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 6px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.name-chip.highlighted {
    background: rgba(30, 144, 255, 0.2);
    border-color: var(--blue-accent);
    color: white;
    transform: scale(1.05);
}

.name-chip.selected {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold);
    color: var(--gold-light);
    animation: chip-selected 0.5s ease;
}

.name-chip.removed {
    opacity: 0;
    transform: scale(0);
    margin: 0;
    padding: 0 0;
    width: 0;
    border: none;
    overflow: hidden;
}

@keyframes chip-selected {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ===== Selected Winners ===== */
.selected-winners {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.winners-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gold-light);
    margin-bottom: 16px;
    text-align: center;
}

.winners-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.winner-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.03));
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    animation: winner-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes winner-enter {
    0% {
        opacity: 0;
        transform: translateX(-40px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.winner-rank {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a2e;
    flex-shrink: 0;
}

.winner-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.winner-trophy {
    font-size: 1.3rem;
}

/* ===== Raffle Actions ===== */
.raffle-actions {
    margin-top: 20px;
}

/* ===== Celebration ===== */
.celebration {
    text-align: center;
}

.celebration-content {
    padding: 20px 0;
}

.trophy {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: trophy-bounce 1s ease-in-out infinite;
}

@keyframes trophy-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(-5deg);
    }

    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.celebration-title {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.celebration-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.final-winners {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
}

.final-winner-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    animation: final-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-fill-mode: both;
}

.final-winner-card:nth-child(1) {
    animation-delay: 0.1s;
}

.final-winner-card:nth-child(2) {
    animation-delay: 0.3s;
}

.final-winner-card:nth-child(3) {
    animation-delay: 0.5s;
}

.final-winner-card:nth-child(4) {
    animation-delay: 0.7s;
}

.final-winner-card:nth-child(5) {
    animation-delay: 0.9s;
}

.final-winner-card:nth-child(6) {
    animation-delay: 1.1s;
}

.final-winner-card:nth-child(7) {
    animation-delay: 1.3s;
}

.final-winner-card:nth-child(8) {
    animation-delay: 1.5s;
}

.final-winner-card:nth-child(9) {
    animation-delay: 1.7s;
}

.final-winner-card:nth-child(10) {
    animation-delay: 1.9s;
}

@keyframes final-enter {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.final-rank {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #1a1a2e;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.final-name {
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
    text-align: left;
}

.final-trophy {
    font-size: 1.5rem;
}

/* ===== Confetti Canvas ===== */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

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

/* ===== Footer ===== */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 20px 12px 60px;
    }

    .glass-card {
        padding: 24px 18px;
        border-radius: var(--radius-md);
    }

    .main-title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .banner {
        padding: 16px 12px 0;
    }

    .banner-img {
        border-radius: var(--radius-md);
    }

    .slot-window {
        height: 75px;
    }

    .slot-name {
        font-size: 1.3rem;
    }

    .info-badge {
        padding: 10px 16px;
    }

    .info-value {
        font-size: 1.5rem;
    }

    .btn {
        padding: 12px 24px;
    }

    .btn-draw {
        padding: 16px 24px;
        font-size: 1.05rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Sound wave animation on button during spin */
.btn-draw.spinning {
    background: linear-gradient(135deg, #ff6b35, #e04000);
    animation: btn-pulse 0.6s ease-in-out infinite;
}

@keyframes btn-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    }

    50% {
        box-shadow: 0 4px 30px rgba(255, 107, 53, 0.6);
    }
}