/* ═══════════════════════════════════════════════════════════════
   Fortune Wheel – Frontend Styles
   ═══════════════════════════════════════════════════════════════ */

.fw-widget *,
.fw-widget *::before,
.fw-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Container ────────────────────────────────────────────────── */
.fw-widget {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    width: 100%;
    position: relative;
}

/* ── Wheel ───────────────────────────────────────────────────── */
.fw-wheel-col {
    width: 100%;
    min-width: 0;
}

.fw-wheel-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.fw-wheel-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
    border: var(--fw-wheel-border-width, 3px) solid var(--fw-wheel-border-color, #ffffff);
}

/* ── Pointer ───────────────────────────────────────────────────── */
.fw-pointer {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Размеры задаются через динамический CSS (font-size, width, height) */
    font-size: 28px; /* fallback */
    color: var(--fw-wheel-pointer-color, #000);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

/* Символ ▼ по умолчанию через псевдоэлемент */
.fw-pointer::before {
    content: '▼';
    display: block;
}

/* Если загружено изображение, скрываем псевдоэлемент */
.fw-pointer.has-image::before {
    display: none;
}

.fw-pointer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Позиции указателя */
.fw-pointer.pos-top {
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
}

.fw-pointer.pos-right {
    top: 50%;
    right: -2px;
    transform: translateY(-50%);
}

.fw-pointer.pos-right::before {
    content: '▶';
}

.fw-pointer.pos-bottom {
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
}

.fw-pointer.pos-bottom::before {
    content: '▲';
}

.fw-pointer.pos-left {
    top: 50%;
    left: -2px;
    transform: translateY(-50%);
}

.fw-pointer.pos-left::before {
    content: '◀';
}

/* ── Content ──────────────────────────────────────────────────── */
.fw-content-col {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fw-initial-state {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fw-title {
    font-weight: 800;
    line-height: 1.25;
}

.fw-text {
    line-height: 1.65;
}

/* Honeypot */
.fw-hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.fw-spin-btn,
.fw-submit-btn {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.4px;
    border: none;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease,
        filter 0.15s ease;
}

.fw-spin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    white-space: nowrap;
}

.fw-spin-btn:hover:not(:disabled) {
    background:  var(--fw-btn-hover-bg, #c0392b) !important;
    color:       var(--fw-btn-hover-color, #fff)  !important;
    box-shadow:  var(--fw-btn-hover-shadow, 0 8px 24px rgba(0,0,0,0.22)) !important;
    transform:   translateY(-2px);
    filter:      none;
}

.fw-spin-btn:active:not(:disabled) {
    transform: translateY(0);
}

.fw-spin-btn:disabled,
.fw-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fw-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
}

.fw-submit-btn:hover:not(:disabled) {
    background: var(--fw-btn-hover-bg, #c0392b) !important;
    color:      var(--fw-btn-hover-color, #fff)  !important;
    box-shadow: var(--fw-btn-hover-shadow, 0 8px 24px rgba(0,0,0,0.22)) !important;
    transform:  translateY(-1px);
}

/* ── Result ────────────────────────────────────────────────── */
.fw-result-state {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fw-fadeInUp 0.45s ease both;
}

.fw-won-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.fw-won-bonus {
    font-weight: 800;
    line-height: 1.2;
}

/* Bonus description */
.fw-won-description {
    color:        var(--fw-desc-color,          #444);
    background:   var(--fw-desc-bg,             rgba(231,76,60,0.06));
    padding:      var(--fw-desc-padding,        10px 14px);
    border:       var(--fw-desc-border-width,   0px) solid var(--fw-desc-border-color, #e74c3c);
    border-left-width: var(--fw-desc-border-left, 3px);
    border-radius: 0 6px 6px 0;
    line-height:  1.55;
}

.fw-won-description:empty {
    display: none;
}

.fw-result-text {
    line-height: 1.6;
}

/* ── Form ────────────────────────────────────────────────────── */
.fw-lead-form {
    display: flex;
    flex-direction: column;
    gap: var(--fw-form-field-mb, 12px);
}

.fw-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fw-label {
    font-size:   var(--fw-form-label-size,  13px);
    font-weight: 600;
    color:       var(--fw-form-label-color, #444);
}

.fw-required {
    color: var(--fw-input-focus-color, #e74c3c);
    margin-left: 2px;
}

.fw-input {
    width: 100%;
    padding:       var(--fw-input-padding,       11px 14px);
    border:        var(--fw-input-border-width,  2px) solid var(--fw-input-border-color, #e0e0e0);
    border-radius: var(--fw-input-radius,        8px);
    font-size:     var(--fw-input-font-size,     15px);
    color:         var(--fw-input-color,         #333);
    background:    var(--fw-input-bg,            #fff);
    transition:    border-color 0.2s ease, box-shadow 0.2s ease;
    outline:       none;
    font-family:   inherit;
    appearance:    none;
    -webkit-appearance: none;
}

.fw-input:focus {
    border-color: var(--fw-input-focus-color, #e74c3c);
    box-shadow:   0 0 0 3px color-mix(in srgb, var(--fw-input-focus-color, #e74c3c) 15%, transparent);
}

.fw-input--error {
    border-color: #e74c3c !important;
    box-shadow:   0 0 0 3px rgba(231, 76, 60, 0.12) !important;
}

.fw-field-error {
    font-size: 12px;
    color: #e74c3c;
    line-height: 1.4;
    display: block;
}

.fw-field-error:empty {
    display: none;
}

.fw-form-error {
    font-size: 13px;
    color: #e74c3c;
    text-align: center;
    padding: 8px 12px;
    background: #fef5f5;
    border-radius: 6px;
    border: 1px solid #fad7d3;
}

.fw-form-error:empty {
    display: none;
}

/* ── Consent ─────────────────────────────────────────────────── */
.fw-field--consent {
    margin-top: 2px;
}

.fw-consent-label {
    display:     flex;
    align-items: flex-start;
    gap:         10px;
    cursor:      pointer;
    font-weight: normal;
    color:       var(--fw-consent-color, #555);
    font-size:   13px;
    line-height: 1.5;
}

.fw-consent-cb {
    flex-shrink:  0;
    width:        18px;
    height:       18px;
    margin-top:   2px;
    cursor:       pointer;
    accent-color: var(--fw-consent-accent, #e74c3c);
}

.fw-consent-text {
    flex: 1;
}

.fw-consent-link {
    color:           var(--fw-consent-link-color, #e74c3c);
    text-decoration: underline;
    transition:      opacity 0.2s;
}

.fw-consent-link:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* ── Success ────────────────────────────────────────────────────── */
.fw-success {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    text-align:     center;
    padding:        24px 16px;
    animation:      fw-fadeInUp 0.4s ease both;
}

.fw-success-icon {
    font-size:     var(--fw-success-icon-size, 56px);
    margin-bottom: 14px;
    animation:     fw-bounce 0.7s ease;
    line-height:   1;
}

.fw-success-text {
    font-weight: 600;
    line-height: 1.5;
}

/* ── Overlay "already spun" ─────────────────────────────────────── */
.fw-overlay-msg {
    position:        absolute;
    inset:           0;
    background:      var(--fw-overlay-bg, rgba(255,255,255,0.96));
    display:         flex;
    align-items:     center;
    justify-content: center;
    z-index:         100;
    padding:         32px;
    animation:       fw-fadeInUp 0.3s ease both;
    border-radius:   inherit;
}

.fw-overlay-msg p {
    color:       var(--fw-overlay-color, #333);
    font-weight: 600;
    text-align:  center;
    line-height: 1.55;
    max-width:   420px;
}

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes fw-fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fw-bounce {
    0%, 100% { transform: scale(1);    }
    35%       { transform: scale(1.35);}
    65%       { transform: scale(0.9); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .fw-widget { gap: 20px; }
}

@media (max-width: 640px) {
    .fw-widget {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .fw-wheel-col {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .fw-wheel-wrap {
        width: 100%;
    }

    .fw-spin-btn {
        width: 100%;
        align-self: stretch;
    }

    .fw-pointer {
        font-size: 24px;
    }

    .fw-overlay-msg {
        padding: 20px;
    }
}