/* ============================================================
   HOW RICH ARE YOU — SPIN WHEEL  (re-skinned on base.css)
   Wheel family, unique markup, so it keeps its own CSS file.
   No global :root theme here: the tool's local variables are
   scoped to .rich-wheel-wrapper and mapped to base.css tokens,
   so every existing rule (var(--primary-color), etc.) picks up
   the SpinNumbers purple look and follows light/dark.
   HTML, JS and class names are unchanged.
   ============================================================ */

/* ---------- Local variables mapped to base.css tokens ---------- */
.rich-wheel-wrapper {
    --primary-color:   var(--purple);
    --secondary-color: var(--secondary);
    --success-color:   var(--success);
    --warning-color:   #F59E0B;
    --danger-color:    var(--accent);
    --dark-color:      var(--text);
    --light-color:     var(--card-bg);
    /* --border-color is already defined globally by base.css and is reused as-is */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.15);
    --shadow-md: 0 4px 6px rgba(0,0,0,.2);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.25);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.35);
    --radius-sm: .375rem;
    --radius-md: .5rem;
    --radius-lg: .75rem;
    --radius-xl: 1rem;
    --transition: all .3s cubic-bezier(.4,0,.2,1);
    --pointer-h: 64px;

    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    color: var(--text);
    font-family: var(--font-head);
    transition: background 0.5s;
}

/* Intro paragraphs under the title follow the theme (readable in light + dark) */
.rich-wheel-wrapper > p { color: var(--text-muted); line-height: 1.7; }

/* ---------- Intro header (real classes from the shortcode markup) ---------- */
.rich-wheel-wrapper .tool-instructions-wrapper { text-align: center; margin-bottom: 24px; }
.rich-wheel-wrapper .tool-section-title {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    line-height: 1.2;
    letter-spacing: -0.3px;
    color: var(--text);
    margin: 0 0 12px;
}
.rich-wheel-wrapper .text-primary-red { color: var(--accent-2); }
.rich-wheel-wrapper .tool-section-texte {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 760px;
    margin: 0 auto;
}

/* ================================================
   BASE CONTAINER
   ================================================ */
.rich-wheel-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
    font-family: var(--font-head);
    color: var(--text);
}

/* ================================================
   WHEEL SECTION
   ================================================ */
.wheel-section { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.wheel-outer-wrapper { display: flex; flex-direction: column; align-items: center; }

#rich-wheel-pointer {
    display: block;
    width: 500px;
    height: var(--pointer-h);
    flex-shrink: 0;
    pointer-events: none;
    margin-bottom: -2px;
    z-index: 10;
    position: relative;
}

.wheel-wrapper { position: relative; width: 500px; height: 500px; flex-shrink: 0; }

.fortune-wheel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 0 6px rgba(255,255,255,.12),
        0 0 0 10px var(--border-color),
        var(--shadow-xl),
        0 0 50px rgba(168,70,247,.25);
    will-change: transform;
}

/* Spin button — accent gradient to match the SpinNumbers hero */
.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--gradient-accent);
    border: 3px solid var(--purple);
    border-radius: 50%;
    box-shadow: var(--shadow-lg), 0 0 0 6px rgba(168,85,247,0.15);
    cursor: pointer;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: var(--transition);
    font-weight: 700;
    color: #fff;
    user-select: none;
}
.wheel-center:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: var(--shadow-xl), 0 0 0 8px rgba(168,85,247,.25);
    border-color: var(--accent-2);
}
.wheel-center:active:not(:disabled) { transform: translate(-50%, -50%) scale(.97); }
.wheel-center:disabled { opacity: .65; cursor: not-allowed; }
.wheel-center.spinning .spin-icon { animation: spinIcon .3s linear infinite; }
@keyframes spinIcon { to { transform: rotate(360deg); } }
.wheel-center .spin-text { font-size: 1rem; letter-spacing: .08em; line-height: 1; color: #fff; }
.wheel-center .spin-icon { font-size: 1.4rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ================================================
   RESULT MODAL
   ================================================ */
.result-modal { position: fixed; inset: 0; z-index: 10000; display: none; opacity: 0; transition: opacity .3s ease; }
.result-modal.show { display: block; opacity: 1; }
.result-modal-overlay { position: absolute; inset: 0; background: rgba(10,6,30,.72); backdrop-filter: blur(8px); }
.confetti-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.result-modal-content {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 10001; animation: modalZoomIn .5s cubic-bezier(.34,1.56,.64,1);
    width: min(440px, calc(100vw - 2rem));
}
@keyframes modalZoomIn {
    from { transform: translate(-50%,-50%) scale(.5); opacity: 0; }
    to   { transform: translate(-50%,-50%) scale(1);  opacity: 1; }
}
.result-modal-inner {
    background: var(--panel-bg);
    border: 3px solid var(--purple);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px rgba(0,0,0,.4);
    text-align: center;
}
.result-icon { font-size: 4rem; margin-bottom: 1.5rem; animation: bounce 1s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
.result-label {
    font-size: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--accent-2); margin: 0 0 1rem;
}
.result-amount {
    font-size: 3.5rem; font-weight: 800; color: var(--text);
    line-height: 1; margin: 0 0 2rem;
}
.result-actions { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1.5rem; }
.btn-action {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .875rem 1.5rem; border: 2px solid var(--purple); background: transparent; color: var(--text);
    border-radius: var(--radius-md); font-weight: 600; font-size: .95rem; cursor: pointer; transition: var(--transition);
}
.btn-action:hover { background: var(--gradient-accent); color: #fff; border-color: transparent; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-action:active { transform: translateY(0); }
.btn-action .btn-icon { font-size: 1.25rem; }
.btn-close-modal {
    width: 100%; padding: .875rem; background: var(--card-bg); color: var(--text);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font-weight: 600; font-size: .95rem; cursor: pointer; transition: var(--transition);
}
.btn-close-modal:hover { background: var(--border-color); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-close-modal:active { transform: translateY(0); }

/* ================================================
   HISTORY PANEL
   ================================================ */
.history-panel {
    width: 100%; max-width: 500px; background: var(--panel-bg);
    border: 1px solid var(--panel-border); border-radius: var(--radius-lg);
    padding: 1.5rem; box-shadow: var(--shadow-md);
}
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.history-title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 600; color: var(--text); margin: 0; }
.history-icon { font-size: 1.25rem; }
.btn-clear-history {
    background: transparent; border: none; cursor: pointer; padding: .5rem;
    border-radius: var(--radius-md); transition: var(--transition); font-size: 1.25rem; opacity: .6;
}
.btn-clear-history:hover { opacity: 1; background: rgba(231,76,60,.15); }
.history-list { display: flex; flex-direction: column; gap: .5rem; min-height: 80px; max-height: 200px; overflow-y: auto; }
.history-empty { text-align: center; padding: 1.5rem; color: var(--text-muted); font-style: italic; font-size: .9rem; }
.history-item {
    display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .75rem;
    padding: .6rem 1rem; background: var(--card-bg); border-radius: var(--radius-md); font-size: .875rem; transition: var(--transition);
}
.history-item:hover { background: var(--border-color); transform: translateX(4px); }
.history-item-index  { font-weight: 700; color: var(--accent-2); }
.history-item-amount { font-weight: 700; color: var(--text); }
.history-item-time   { font-size: .72rem; color: var(--text-muted); }
.btn-delete-history-item {
    background: transparent; border: none; color: var(--text-muted); cursor: pointer;
    padding: .2rem .4rem; border-radius: var(--radius-sm); transition: var(--transition); font-size: .75rem;
}
.btn-delete-history-item:hover { color: var(--accent); background: rgba(231,76,60,.15); }

/* ================================================
   CONTROL PANEL
   ================================================ */
.control-panel {
    background: var(--panel-bg); border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    overflow: hidden; position: sticky; top: 1rem;
}
.panel-header { background: var(--card-bg); padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--panel-border); }
.panel-title { display: flex; align-items: center; gap: .75rem; font-size: 1.125rem; font-weight: 700; margin: 0; color: var(--text); }
.panel-icon { font-size: 1.4rem; }
.panel-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.control-group { display: flex; flex-direction: column; gap: .5rem; }
.control-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; color: var(--text); }
.label-icon { font-size: 1.1rem; }

.prize-list {
    list-style: none; padding: .5rem; margin: 0; display: flex; flex-direction: column; gap: .4rem;
    max-height: 280px; overflow-y: auto; border: 2px solid var(--border-color); border-radius: var(--radius-md);
    background: var(--card-bg); scroll-behavior: smooth;
}
.prize-item { display: flex; align-items: center; gap: .5rem; animation: fadeSlideIn .2s ease-out; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.prize-input {
    flex: 1; padding: .45rem .75rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    font-size: .875rem; transition: var(--transition); background: var(--panel-bg); color: var(--text);
}
.prize-input:focus { outline: none; border-color: var(--accent); background: var(--panel-bg); box-shadow: 0 0 0 3px rgba(231,76,60,.15); }
.btn-delete-prize {
    background: var(--danger-color); color: #fff; border: none; padding: .45rem .6rem;
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-size: .8rem; line-height: 1;
}
.btn-delete-prize:hover { background: var(--accent-hover); transform: scale(1.05); }
.control-help { font-size: .72rem; color: var(--text-muted); font-style: italic; }

.control-select {
    width: 100%; padding: .7rem 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md);
    background: var(--card-bg); color: var(--text); font-size: .875rem; font-weight: 500; cursor: pointer;
    transition: var(--transition); height: 48px;
}
.control-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(231,76,60,.15); }

.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.btn-control {
    display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1rem;
    border: none; border-radius: var(--radius-md); font-weight: 600; font-size: .875rem; cursor: pointer; transition: var(--transition);
}
.btn-primary {
    grid-column: 1 / -1; background: var(--gradient-accent); color: #fff;
    box-shadow: 0 4px 12px rgba(168,85,247,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(168,85,247,.45); }
.btn-secondary { background: var(--card-bg); color: var(--text); border: 2px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); transform: translateY(-2px); }
.btn-control:active { transform: translateY(0) !important; }
.btn-control .btn-icon { font-size: 1.1rem; }
#add-prize-btn { align-self: flex-start; padding: .5rem 1rem; font-size: .8rem; }

/* Toggle switch */
.control-switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; padding: .75rem; border-radius: var(--radius-md); transition: var(--transition); border: 2px solid transparent; }
.control-switch:hover { background: var(--card-bg); border-color: var(--border-color); }
.control-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-slider { position: relative; width: 50px; height: 26px; background: var(--border-color); border-radius: 13px; transition: var(--transition); flex-shrink: 0; }
.switch-slider::before { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: var(--transition); box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.control-switch input:checked + .switch-slider { background: var(--purple); }
.control-switch input:checked + .switch-slider::before { transform: translateX(24px); }
.switch-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; color: var(--text); }
.switch-icon { font-size: 1.1rem; }

/* ================================================
   DISCLAIMER
   ================================================ */
.disclaimer {
    display: flex; align-items: flex-start; gap: .5rem; padding: .875rem 1.25rem;
    background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.4); border-radius: var(--radius-md);
    font-size: .8rem; line-height: 1.5; color: var(--warning-color); max-width: 500px; width: 100%; margin: 0;
}
.disclaimer-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ================================================
   TOAST
   ================================================ */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .75rem; pointer-events: none; }
.toast {
    min-width: 260px; padding: .875rem 1.125rem; background: var(--panel-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); display: flex; align-items: center; gap: .75rem; animation: slideInRight .3s ease-out;
    pointer-events: auto; border-left: 4px solid var(--success-color); transition: opacity .3s, transform .3s;
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left-color: var(--success-color); }
.toast.error   { border-left-color: var(--danger-color); }
.toast.info    { border-left-color: var(--primary-color); }
.toast-icon    { font-size: 1.25rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-message { font-size: .85rem; font-weight: 500; color: var(--text); margin: 0; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
    .rich-wheel-container { grid-template-columns: 1fr; gap: 2rem; }
    .control-panel { position: static; order: 2; }
    .wheel-section { order: 1; }
}
@media (max-width: 600px) {
    .rich-wheel-wrapper { padding: .5rem; }
    .wheel-wrapper      { width: 300px; height: 300px; }
    #rich-wheel-pointer { width: 300px !important; }
    .wheel-center { width: 68px; height: 68px; }
    .wheel-center .spin-text { font-size: .8rem; }
    .wheel-center .spin-icon { font-size: 1.2rem; }
    .result-modal-inner { padding: 2rem 1.25rem; }
    .result-amount { font-size: 2.5rem; }
    .result-actions { flex-direction: column; }
    .panel-body { padding: 1rem; }
    .button-grid { grid-template-columns: 1fr; }
    .btn-primary { grid-column: 1; }
    .toast-container { left: 1rem; right: 1rem; }
    .toast { min-width: auto; }
}

/* ================================================
   ACCESSIBILITY
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
*:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
@media print {
    .control-panel, .result-actions, .wheel-center, .toast-container { display: none !important; }
    .rich-wheel-container { grid-template-columns: 1fr; }
}