/*
 * fm-spin-wheel.css
 * Spin Wheel (Çarkıfelek) Module — visitor + admin UI
 * All selectors prefixed with .fmsw- to avoid conflicts.
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.fmsw-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Company header ───────────────────────────────────────────────────────── */
.fmsw-header {
    text-align: center;
}
.fmsw-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: #1b3a5c;
}
.fmsw-subtitle {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

/* ── Canvas wrapper (wheel + pin) ─────────────────────────────────────────── */
.fmsw-canvas-wrap {
    position: relative;
    width: 320px;
    max-width: 100%;
}
.fmsw-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}

/* ── Pin (pointer at top) ─────────────────────────────────────────────────── */
.fmsw-pin {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 28px solid #e11d48;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 2;
}

/* ── Spin button ──────────────────────────────────────────────────────────── */
.fmsw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 36px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.fmsw-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}
.fmsw-btn:active:not(:disabled) {
    transform: translateY(0);
}
.fmsw-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Spins counter ────────────────────────────────────────────────────────── */
.fmsw-spins-info {
    font-size: 13px;
    color: #64748b;
    text-align: center;
}
.fmsw-spins-info strong {
    color: #1b3a5c;
}

/* ── Already-won badge ────────────────────────────────────────────────────── */
.fmsw-won-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4);
}

/* ── Result modal ─────────────────────────────────────────────────────────── */
.fmsw-result-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.fmsw-result-modal.fmsw-open {
    display: flex;
}
.fmsw-result-inner {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: fmsw-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes fmsw-pop {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.fmsw-result-icon {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 12px;
}
.fmsw-result-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #1b3a5c;
}
.fmsw-result-slice {
    font-size: 15px;
    color: #374151;
    margin: 0 0 16px;
}
.fmsw-coupon-card {
    background: #f0fdf4;
    border: 2px dashed #16a34a;
    border-radius: 12px;
    padding: 14px 20px;
    margin: 16px 0;
}
.fmsw-coupon-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #16a34a;
    font-weight: 600;
}
.fmsw-coupon-code {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #15803d;
    word-break: break-all;
}
.fmsw-coupon-expires {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}
.fmsw-result-close {
    margin-top: 16px;
    padding: 10px 28px;
    background: #1b3a5c;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.fmsw-result-close:hover {
    background: #2563eb;
}

/* ── Confetti ─────────────────────────────────────────────────────────────── */
.fmsw-confetti-wrap {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}
.fmsw-confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: fmsw-confetti-fall linear forwards;
}
@keyframes fmsw-confetti-fall {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── My Coupons table ─────────────────────────────────────────────────────── */
.fmsw-coupons-section {
    width: 100%;
    max-width: 560px;
}
.fmsw-coupons-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1b3a5c;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}
.fmsw-coupon-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
}
.fmsw-coupon-row-code {
    font-weight: 700;
    font-size: 15px;
    color: #1b3a5c;
    letter-spacing: 0.06em;
}
.fmsw-coupon-row-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.fmsw-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.fmsw-badge-active   { background: #dcfce7; color: #15803d; }
.fmsw-badge-used     { background: #f1f5f9; color: #64748b; }
.fmsw-badge-expired  { background: #fee2e2; color: #b91c1c; }

/* ── Admin panel (inside exhibitor dashboard) ─────────────────────────────── */
.fmsw-admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.fmsw-admin-tab {
    padding: 8px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.fmsw-admin-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}
.fmsw-admin-panel {
    display: none;
}
.fmsw-admin-panel.active {
    display: block;
}

/* Slice list */
.fmsw-slice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* Slice column header row */
.fmsw-slice-header {
    display: grid;
    grid-template-columns: 40px 1fr 64px 80px 36px;
    gap: 8px;
    padding: 0 10px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fmsw-slice-row {
    display: grid;
    grid-template-columns: 40px 1fr 64px 80px 36px;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
}
.fmsw-slice-color {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
}
.fmsw-slice-label-input {
    min-width: 0;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
}
.fmsw-slice-weight {
    width: 64px;
    max-width: 64px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
}
.fmsw-slice-prize {
    font-size: 12px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}
.fmsw-slice-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    padding: 2px 4px;
    line-height: 1;
}
.fmsw-slice-remove:hover { color: #e11d48; }

/* Admin buttons */
.fmsw-btn-sm {
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.fmsw-btn-primary { background: #2271b1; color: #fff; }
.fmsw-btn-primary:hover { background: #1d5f96; }
.fmsw-btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.fmsw-btn-secondary:hover { background: #e2e8f0; }
.fmsw-btn-danger { background: #fee2e2; color: #b91c1c; }
.fmsw-btn-danger:hover { background: #fecaca; }

/* Admin table */
.fmsw-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.fmsw-admin-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #374151;
}
.fmsw-admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.fmsw-admin-table tr:last-child td {
    border-bottom: none;
}
.fmsw-admin-table tr:hover td {
    background: #f8fafc;
}

/* Wheel preview (admin) */
.fmsw-preview-wrap {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}
.fmsw-preview-canvas {
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

/* Notice / alert */
.fmsw-notice {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.fmsw-notice-success { background: #f0fdf4; color: #15803d; border-left: 3px solid #16a34a; }
.fmsw-notice-error   { background: #fff1f2; color: #be123c; border-left: 3px solid #e11d48; }
.fmsw-notice-info    { background: #eff6ff; color: #1d4ed8; border-left: 3px solid #2563eb; }

/* Mobile responsive */
@media (max-width: 480px) {
    .fmsw-canvas-wrap { width: 280px; }
    .fmsw-btn { font-size: 14px; padding: 11px 28px; }
    .fmsw-result-inner { padding: 24px 16px; }
    .fmsw-slice-row { flex-wrap: wrap; }
}
