/* ============================================================
   Lucky Wheel — Frontend CSS
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
    --lw-primary:     #e44d26;
    --lw-primary-h:   #c03d1b;
    --lw-secondary:   #555555;
    --lw-bg:          #ffffff;
    --lw-border:      #e0e0e0;
    --lw-radius:      12px;
    --lw-shadow:      0 8px 32px rgba(0,0,0,.12);
    --lw-font:        Arial, sans-serif;
    --lw-text:        #333333;
    --lw-text-light:  #777777;
    --lw-success:     #27ae60;
    --lw-warning:     #f39c12;
    --lw-danger:      #e74c3c;
}

/* ── Conteneur principal ──────────────────────────────────── */
.lw-wheel-wrap {
    font-family: var(--lw-font);
    max-width: 520px;
    margin: 0 auto;
    padding: 32px 24px;
    background: var(--lw-bg);
    border-radius: var(--lw-radius);
    box-shadow: var(--lw-shadow);
    text-align: center;
    color: var(--lw-text);
    position: relative;
    overflow: hidden;
}

/* ── Titres ───────────────────────────────────────────────── */
.lw-wheel-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--lw-primary);
}
.lw-wheel-subtitle {
    font-size: 1rem;
    color: var(--lw-text-light);
    margin: 0 0 20px;
}

/* ── Zone Canvas ──────────────────────────────────────────── */
.lw-canvas-wrap {
    position: relative;
    display: inline-block;
    margin: 12px auto;
}
.lw-canvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    max-width: 100%;
    height: auto;
}
.lw-pointer {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.4rem;
    color: var(--lw-primary);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

/* ── Email gate ───────────────────────────────────────────── */
.lw-email-gate,
.lw-review-gate {
    background: #f8f8f8;
    border: 1px solid var(--lw-border);
    border-radius: var(--lw-radius);
    padding: 20px;
    margin: 16px 0;
}
.lw-field-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.lw-email-input,
.lw-code-input,
.lw-magic-email-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--lw-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--lw-font);
    box-sizing: border-box;
    transition: border-color .2s;
}
.lw-email-input:focus,
.lw-code-input:focus,
.lw-magic-email-input:focus {
    outline: none;
    border-color: var(--lw-primary);
}
.lw-code-input {
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Séparateur mode A / B ────────────────────────────────── */
.lw-mode-separator {
    position: relative;
    text-align: center;
    margin: 16px 0;
    color: var(--lw-text-light);
}
.lw-mode-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: var(--lw-border);
}
.lw-mode-separator span {
    position: relative;
    background: #f8f8f8;
    padding: 0 12px;
    font-size: .9rem;
}

/* ── Boutons ──────────────────────────────────────────────── */
.lw-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--lw-font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s;
    text-decoration: none;
    color: #fff !important;
}
.lw-btn:active { transform: scale(.97); }
.lw-btn--primary   { background: var(--lw-primary);   }
.lw-btn--primary:hover { background: var(--lw-primary-h); }
.lw-btn--secondary { background: var(--lw-secondary); }
.lw-btn--cart      { background: var(--lw-success); margin: 4px; }
.lw-btn--rewards   { background: var(--lw-secondary); margin: 4px; }

.lw-validate-code-btn,
.lw-request-link-btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 13px;
}

.lw-spin-btn-wrap { margin: 16px 0 8px; }
.lw-spin-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    border: none;
    color: #fff;
    cursor: pointer;
    font-family: var(--lw-font);
    transition: opacity .2s, transform .1s;
}
.lw-spin-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.lw-spin-btn:not(:disabled):hover { opacity: .9; }
.lw-spin-btn:not(:disabled):active { transform: scale(.97); }

/* ── Bouton connexion ─────────────────────────────────────── */
.lw-login-switch {
    font-size: .9rem;
    color: var(--lw-text-light);
    margin: 12px 0 0;
}
.lw-login-btn {
    color: var(--lw-primary);
    font-weight: 600;
    text-decoration: underline;
}

/* ── Résultat ─────────────────────────────────────────────── */
.lw-result {
    margin-top: 20px;
    animation: lw-fadein .4s ease;
}
.lw-result-inner {
    padding: 20px;
    background: #f0fff4;
    border: 1px solid #a8e6c0;
    border-radius: var(--lw-radius);
}
.lw-result-inner.lw-result--lose {
    background: #fff5f5;
    border-color: #f5c6cb;
}
.lw-result-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 12px;
}
.lw-result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

/* ── Loader / spinner ─────────────────────────────────────── */
.lw-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--lw-radius);
    z-index: 10;
}
.lw-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--lw-border);
    border-top-color: var(--lw-primary);
    border-radius: 50%;
    animation: lw-spin 0.8s linear infinite;
    display: inline-block;
}

/* ── My Rewards (espace client) ───────────────────────────── */
.lw-my-rewards h2 { margin-bottom: 20px; }

.lw-rewards-table { width: 100%; border-collapse: collapse; }
.lw-rewards-table th,
.lw-rewards-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--lw-border);
    text-align: left;
    font-size: .9rem;
    vertical-align: middle;
}
.lw-rewards-table th {
    background: #f8f8f8;
    font-weight: 700;
}
.lw-reward--nowin td { opacity: .6; }

.lw-coupon-code {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .85rem;
    letter-spacing: 1px;
}
.lw-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    background: #fff3cd;
    color: #856404;
    margin-left: 6px;
}
.lw-status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.lw-status-badge--pending { background: #fff3cd; color: #856404; }
.lw-status-badge--claimed { background: #d4edda; color: #155724; }
.lw-status-badge--expired { background: #f8d7da; color: #721c24; }
.lw-expiry-soon { color: var(--lw-warning); font-size: .8rem; }
.lw-gdpr-text {
    font-size: .78rem;
    color: var(--lw-text-light);
    margin: 8px 0 0;
    text-align: left;
}
.lw-empty-rewards { padding: 30px; background: #f8f8f8; border-radius: var(--lw-radius); color: var(--lw-text-light); }

/* ── Animations ───────────────────────────────────────────── */
@keyframes lw-spin {
    to { transform: rotate(360deg); }
}
@keyframes lw-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .lw-wheel-wrap { padding: 20px 14px; }
    .lw-wheel-title { font-size: 1.3rem; }
    .lw-spin-btn { padding: 12px 28px; font-size: 1rem; }
    .lw-rewards-table th,
    .lw-rewards-table td { padding: 8px; font-size: .8rem; }
}
