/* Giveaway UI Styles */

.giveaway-participation-modal-content {
    max-width: 400px;
    background: linear-gradient(165deg, #1a1425, #0f0a1a);
    border: 1px solid rgba(255, 42, 245, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 42, 245, 0.15);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overscroll-behavior: contain;
}

#giveawayParticipationModal {
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.giveaway-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
    animation: giveawayFadeIn 0.3s ease-out;
}

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

.giveaway-timer-large {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 42, 245, 0.6), 0 0 40px rgba(255, 42, 245, 0.2);
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    line-height: 1;
}

.giveaway-participants-counter {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon);
    background: rgba(255, 42, 245, 0.1);
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 42, 245, 0.2);
}

.giveaway-description {
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* Code Phase */
.giveaway-code-input-wrap {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.giveaway-code-input-wrap input {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.giveaway-code-accepted {
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(46, 209, 107, 0.14);
    border: 1px solid rgba(46, 209, 107, 0.38);
    color: #dcffe9;
    font-weight: 700;
    line-height: 1.35;
}

#giveawayCodeInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 42, 245, 0.3);
    border-radius: 12px;
    padding: 14px;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.3em;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#giveawayCodeInput:focus {
    border-color: var(--neon);
    box-shadow: 0 0 12px rgba(255, 42, 245, 0.3);
}

/* Participants List */
.giveaway-participants-list-wrap {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.giveaway-participants-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #b8a8e0;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.giveaway-participants-mini-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 4px;
}

.giveaway-participants-mini-list::-webkit-scrollbar {
    width: 4px;
}
.giveaway-participants-mini-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.participant-chip {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    color: #eee;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Results */
.giveaway-results-status {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.giveaway-winners-list-wrap {
    width: 100%;
}

.giveaway-winners-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--gold);
    text-align: center;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.giveaway-winners-list {
    display: grid;
    gap: 8px;
    width: 100%;
}

.winner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), transparent);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
}

.winner-name {
    font-weight: 700;
    color: #fff;
}

.winner-prize {
    color: var(--gold);
    font-weight: 800;
}

.winner-row.is-me {
    background: linear-gradient(90deg, rgba(46, 209, 107, 0.15), transparent);
    border-color: rgba(46, 209, 107, 0.4);
    box-shadow: 0 0 15px rgba(46, 209, 107, 0.1);
}

/* Utility */
.w-full { width: 100%; }

#regStreamBtn,
#codeStreamBtn {
    justify-content: center;
    text-align: center;
}

.giveaway-static-field {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 11px 13px;
    border-radius: 12px;
    border: 2px solid rgba(255, 42, 245, 0.28);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.giveaway-static-count {
    margin-top: 8px;
    color: var(--neon);
    font-weight: 800;
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.btn-unified-primary {
    background: linear-gradient(135deg, #ff4d8d, #ff2af5);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 42, 245, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-unified-primary.is-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.giveaway-inline-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: giveawaySpin 0.7s linear infinite;
    flex: 0 0 auto;
}

@keyframes giveawaySpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-unified-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 42, 245, 0.4);
}

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

.btn-unified-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.ref-wheel-code-badge {
    margin-top: 10px;
    padding: 8px;
    background: rgba(46, 209, 107, 0.1);
    border: 1px dashed rgba(46, 209, 107, 0.4);
    border-radius: 8px;
    color: #2ed16b;
    font-weight: 800;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.ref-wheel-code-badge span {
    letter-spacing: 0.1em;
}

.creator-code-box {
    background: rgba(255, 42, 245, 0.1);
    border: 1px solid rgba(255, 42, 245, 0.3);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    width: 100%;
}

.creator-code-box span {
    display: block;
    font-size: 0.75rem;
    color: var(--neon);
    font-weight: 700;
    margin-bottom: 4px;
}

.creator-code-box strong {
    font-size: 1.8rem;
    color: #fff;
    letter-spacing: 0.2em;
    font-family: var(--font-mono);
}

.creator-code-box p {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--text-light);
}

.ref-wheel-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.ref-wheel-pay-btn {
    flex: 1 1 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 800;
}

.ref-wheel-free-btn {
    flex: 1 1 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 800;
}

.ref-wheel-pay-btn.is-loading,
.ref-wheel-free-btn.is-loading {
    opacity: 0.8;
    pointer-events: none;
    filter: saturate(0.85);
}

/* History collapsible */
.my-giveaway-history {
    margin-top: 10px;
}

.my-giveaway-history summary {
    cursor: pointer;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #b8a8e0;
    list-style: none;
    user-select: none;
}

.my-giveaway-history summary::before {
    content: '▶ ';
    font-size: 0.7rem;
    opacity: 0.7;
}

.my-giveaway-history[open] summary::before {
    content: '▼ ';
}

.my-giveaway-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.ref-wheel-stream-row {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.ref-wheel-stream-meta {
    display: grid;
    gap: 4px;
}

.ref-wheel-stream-platform {
    font-size: 0.74rem;
    font-weight: 700;
    color: #9fb4ff;
}

.ref-wheel-stream-link-text {
    font-size: 0.78rem;
    color: #d6ddff;
    word-break: break-all;
    line-height: 1.35;
}

.ref-wheel-stream-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 700;
}

.ref-wheel-winners {
    margin-top: 10px;
}

.ref-wheel-winners summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: #b8a8e0;
    font-size: 0.8rem;
    font-weight: 700;
}

.ref-wheel-winners summary::before {
    content: '▶ ';
    font-size: 0.65rem;
    opacity: 0.7;
}

.ref-wheel-winners[open] summary::before {
    content: '▼ ';
}

.ref-wheel-winners-list {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
    color: #e7edff;
    font-size: 0.78rem;
}

.ref-wheel-winners-empty {
    color: #aeb8d8;
    list-style: none;
    margin-left: -18px;
}

/* Organizer countdown timer */
.ref-wheel-timer {
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffe97a;
}

/* Giveaway creation modal — stable size, no jumping */
#giveawayCreationModal .modal-content {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

#giveawayCreationForm {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#giveawayCreationForm .giveaway-modal-actions {
    margin-top: auto;
    padding-top: 12px;
}

/* Prevent size jump when spinner replaces button text */
#createPromoWheelBtn,
#publishGiveawayBtn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
    box-sizing: border-box;
}

/* Inline spinner for giveaway buttons */
.giveaway-inline-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: giveawaySpinAnim 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

@keyframes giveawaySpinAnim {
    to { transform: rotate(360deg); }
}

.giveaway-prize-pool {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    background: rgba(255, 215, 0, 0.1);
    padding: 8px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    text-align: center;
    margin-top: -10px;
    margin-bottom: 5px;
}

.copy-code-btn-style {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background-color 0.15s, transform 0.1s;
}

.copy-code-btn-style:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.copy-code-btn-style:active {
    transform: scale(0.92);
}

/* Ensure giveawayCreationModal stacks above referralsModal when opened from it */
#giveawayCreationModal {
    z-index: 10001;
}

/* Animation for blinking tab headers when wheel transitions to code active / input code phase */
.blink-glow-tab {
    animation: tabBlinkGlow 1s ease-in-out infinite alternate !important;
}

@keyframes tabBlinkGlow {
    0% {
        color: rgba(255, 255, 255, 0.44);
        border-bottom-color: transparent;
        text-shadow: none;
    }
    100% {
        color: #ff2af5;
        border-bottom-color: #ff2af5;
        text-shadow: 0 0 8px rgba(255, 42, 245, 0.8), 0 0 15px rgba(255, 42, 245, 0.4);
    }
}
