/* ═══════════════════════════════════════════════════════════════════
   Seraj Services — Unified Button System
   ───────────────────────────────────────────────────────────────────
   Static stylesheet (no Vite build needed). Loaded LAST — after
   app.css and after every @stack('styles') page stylesheet — so it
   has the final say on button geometry.

   It is intentionally NOT wrapped in @layer: unlayered author CSS
   always beats Tailwind's @layer utilities, which is what lets one
   .btn rule normalise padding/radius/font that were previously set
   by ad-hoc utility classes (px-6, rounded-xl, text-sm …).

   Legacy class names (btn-will-primary, btn-commitment-primary,
   btn-primary-3d, wizard-btn*, btn-commitment-ghost)
   are aliased to the new variants so existing Blade files keep
   working untouched.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Base geometry ─────────────────────────────────────────── */
.btn,
.btn-will-primary,
.btn-commitment-primary,
.btn-commitment-ghost,
.btn-primary-3d,
.wizard-btn {
    --btn-radius: 0.75rem;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.55rem 1.35rem;
    border: 1px solid transparent;
    border-radius: var(--btn-radius);
    overflow: hidden;
    font-family: var(--font-sans, 'Pinar', sans-serif);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    vertical-align: middle;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.2s ease,
                background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, filter 0.15s ease;
}

/* Tailwind's display utilities must still win (unlayered rule above
   would otherwise force every .btn to be visible). */
.btn.hidden,
.btn[hidden],
.btn-will-primary.hidden,
.btn-will-primary[hidden],
.btn-commitment-primary.hidden,
.btn-commitment-primary[hidden],
.btn-commitment-ghost.hidden,
.btn-commitment-ghost[hidden],
.btn-primary-3d.hidden,
.btn-primary-3d[hidden],
.wizard-btn.hidden,
.wizard-btn[hidden] {
    display: none !important;
}

/* ── 2. Primary — سبز برند، طلایی‌حاشیه ───────────────────────
   همان دکمهٔ `.btn-green` موکاپ: گرادیان سبزِ عمیق + موکاپ یک
   خطِ نازک طلایی دورِ دکمه می‌کشد (inset ring) تا DNA طلایی
   alseraj.net روی سطح اصلی هم بماند. */
.btn--primary,
.btn-will-primary,
.btn-commitment-primary,
.btn-primary-3d,
.wizard-btn--primary {
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(6, 40, 30, 0.35);
    background: linear-gradient(180deg, #1e7f60 0%, #14664e 52%, #0f5340 100%);
    box-shadow:
        inset 0 0 0 1px rgba(168, 129, 60, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -2px 0 rgba(11, 58, 44, 0.32),
        0 3px 6px -1px rgba(11, 58, 44, 0.35);
}

.dark .btn--primary,
.dark .btn-will-primary,
.dark .btn-commitment-primary,
.dark .btn-primary-3d,
.dark .wizard-btn--primary {
    color: #06231a;
    text-shadow: none;
    background: linear-gradient(180deg, #5bd8ad 0%, #43c79a 55%, #2fae85 100%);
    box-shadow:
        inset 0 0 0 1px rgba(217, 188, 122, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(6, 35, 26, 0.25),
        0 3px 8px -2px rgba(0, 0, 0, 0.5);
}

/* top gloss */
.btn--primary::before,
.btn-will-primary::before,
.btn-commitment-primary::before,
.btn-primary-3d::before,
.wizard-btn--primary::before {
    content: "";
    position: absolute;
    inset: 0 0 50% 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.03));
}

/* shine sweep */
.btn--primary::after,
.btn-will-primary::after,
.btn-commitment-primary::after,
.btn-primary-3d::after,
.wizard-btn--primary::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: -70%;
    width: 45%;
    pointer-events: none;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.42), transparent);
    transform: skewX(-20deg);
    transition: inset-inline-start 0.5s ease;
}

.btn--primary:hover,
.btn-will-primary:hover,
.btn-commitment-primary:hover,
.btn-primary-3d:hover,
.wizard-btn--primary:hover {
    transform: translateY(-1.5px);
    background: linear-gradient(180deg, #249070 0%, #17755a 52%, #125a45 100%);
    box-shadow:
        inset 0 0 0 1px rgba(201, 165, 92, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 5px 12px -3px rgba(11, 58, 44, 0.42);
}

.dark .btn--primary:hover,
.dark .btn-will-primary:hover,
.dark .btn-commitment-primary:hover,
.dark .btn-primary-3d:hover,
.dark .wizard-btn--primary:hover {
    background: linear-gradient(180deg, #6ee2b8 0%, #4fd0a3 55%, #38bb91 100%);
    box-shadow:
        inset 0 0 0 1px rgba(224, 197, 131, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 5px 14px -3px rgba(0, 0, 0, 0.55);
}

.btn--primary:hover::after,
.btn-will-primary:hover::after,
.btn-commitment-primary:hover::after,
.btn-primary-3d:hover::after,
.wizard-btn--primary:hover::after {
    inset-inline-start: 130%;
}

.btn--primary:active,
.btn-will-primary:active,
.btn-commitment-primary:active,
.btn-primary-3d:active,
.wizard-btn--primary:active {
    transform: translateY(0);
    filter: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 2px 3px rgba(11, 58, 44, 0.3);
}

/* ── 2b. Gold — پیلت طلایی (ورود/ثبت‌نام و دعوت اصلی) ────────
   همان `.btn-login` / `.btn-gold-cta` موکاپ: روی هدرِ سبزِ تیره
   و در بنرهای فراخوان استفاده می‌شود، نه برای فرم‌های داخلی. */
.btn--gold {
    color: #2c2210;
    text-shadow: none;
    background: linear-gradient(180deg, #dcc08a 0%, #c9a55c 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 0 rgba(140, 107, 42, 0.3),
        0 6px 16px -8px rgba(168, 129, 60, 0.55);
}

.btn--gold:hover {
    transform: translateY(-1.5px);
    background: linear-gradient(180deg, #e7d2a0 0%, #d3b271 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 8px 20px -8px rgba(168, 129, 60, 0.6);
}

.btn--gold:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 3px rgba(140, 107, 42, 0.3);
}

/* ── 3. Secondary — card surface + hairline border ─────────────── */
.btn--secondary,
.btn-commitment-ghost,
.wizard-btn--outline {
    color: var(--foreground, oklch(0.18 0.02 60));
    background: var(--card, #fff);
    border-color: var(--border, oklch(0.9 0.012 80));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn--secondary:hover,
.btn-commitment-ghost:hover,
.wizard-btn--outline:hover {
    background: var(--muted, oklch(0.96 0.01 80));
    border-color: color-mix(in oklch, var(--primary, #d97706) 32%, var(--border, #e7e5e4));
}

.btn--secondary:active,
.btn-commitment-ghost:active,
.wizard-btn--outline:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* ── 4. Soft — tinted accent ──────────────────────────────────── */
.btn--soft {
    color: color-mix(in oklch, var(--primary, #d97706) 72%, #000);
    background: color-mix(in oklch, var(--primary, #d97706) 12%, var(--card, #fff));
    border-color: color-mix(in oklch, var(--primary, #d97706) 34%, var(--card, #fff));
}

.btn--soft:hover {
    background: color-mix(in oklch, var(--primary, #d97706) 20%, var(--card, #fff));
    border-color: color-mix(in oklch, var(--primary, #d97706) 50%, var(--card, #fff));
}

.dark .btn--soft {
    color: oklch(0.85 0.1 165);
}

/* Soft state colours — used for activate/deactivate style actions */
.btn--soft-danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.btn--soft-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.btn--soft-success {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.btn--soft-success:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
}

.dark .btn--soft-danger {
    color: #fca5a5;
    background: color-mix(in oklch, #dc2626 18%, var(--card, #111));
    border-color: color-mix(in oklch, #dc2626 38%, var(--card, #111));
}

.dark .btn--soft-success {
    color: #6ee7b7;
    background: color-mix(in oklch, #10b981 18%, var(--card, #111));
    border-color: color-mix(in oklch, #10b981 38%, var(--card, #111));
}

/* ── 5. Ghost — text only ──────────────────────────────────────── */
.btn--ghost,
.wizard-btn--ghost {
    color: var(--muted-foreground, oklch(0.5 0.015 60));
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.btn--ghost:hover,
.wizard-btn--ghost:hover {
    color: var(--primary, #b45309);
    background: color-mix(in oklch, var(--primary, #d97706) 9%, transparent);
}

/* ── 6. Danger ────────────────────────────────────────────────── */
.btn--danger {
    color: #fff;
    text-shadow: 0 1px 1px rgba(127, 29, 29, 0.35);
    background: linear-gradient(180deg, #f87171 0%, #dc2626 52%, #b91c1c 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 0 rgba(127, 29, 29, 0.35),
        0 3px 6px -1px rgba(185, 28, 28, 0.4);
}

.btn--danger::before {
    content: "";
    position: absolute;
    inset: 0 0 50% 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.02));
}

.btn--danger:hover {
    transform: translateY(-1.5px);
    background: linear-gradient(180deg, #f87171 0%, #e02b2b 52%, #c22222 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(127, 29, 29, 0.4),
        0 5px 12px -3px rgba(185, 28, 28, 0.5);
}

.btn--danger:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 3px rgba(127, 29, 29, 0.3);
}

/* ── 7. Sizes & modifiers ─────────────────────────────────────── */
.btn--sm {
    min-height: 2.25rem;
    padding: 0.4rem 0.85rem;
    gap: 0.4rem;
    font-size: 0.8125rem;
    border-radius: calc(var(--btn-radius) - 2px);
}

.btn--lg {
    min-height: 3.15rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn--block,
.btn-primary-3d {
    width: 100%;
}

.btn--icon {
    width: 2.75rem;
    min-width: 2.75rem;
    padding: 0;
    gap: 0;
}

.btn--icon.btn--sm {
    width: 2.25rem;
    min-width: 2.25rem;
}

/* ── 8. Icon chip inside a button ─────────────────────────────── */
.btn-ic {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.22);
    line-height: 0;
}

.btn-ic svg {
    width: 1rem;
    height: 1rem;
}

.btn--secondary .btn-ic,
.btn--soft .btn-ic,
.btn--ghost .btn-ic,
.btn-commitment-ghost .btn-ic,
.wizard-btn--outline .btn-ic,
.wizard-btn--ghost .btn-ic {
    background: color-mix(in oklch, currentColor 12%, transparent);
}

.btn--sm .btn-ic {
    width: 1.25rem;
    height: 1.25rem;
}

.btn--sm .btn-ic svg {
    width: 0.85rem;
    height: 0.85rem;
}

/* ── 9. States ────────────────────────────────────────────────── */
.btn:focus-visible,
.btn-will-primary:focus-visible,
.btn-commitment-primary:focus-visible,
.btn-commitment-ghost:focus-visible,
.btn-primary-3d:focus-visible,
.wizard-btn:focus-visible {
    outline: 2px solid var(--ring, #d97706);
    outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled='true'],
.btn.is-disabled,
.btn-will-primary:disabled,
.btn-commitment-primary:disabled,
.btn-primary-3d:disabled,
.wizard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.btn:disabled:hover,
.btn[aria-disabled='true']:hover,
.btn.is-disabled:hover {
    transform: none;
    filter: none;
}

/* ── 10. Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn-will-primary,
    .btn-commitment-primary,
    .btn-primary-3d,
    .wizard-btn,
    .btn--primary::after,
    .btn-will-primary::after,
    .btn-commitment-primary::after,
    .btn-primary-3d::after,
    .wizard-btn--primary::after {
        transition: none;
    }

    .btn:hover,
    .btn-will-primary:hover,
    .btn-commitment-primary:hover,
    .btn-primary-3d:hover,
    .wizard-btn:hover {
        transform: none;
    }
}
