/* ═══════════════════════════════════════════════════════════
   Buttons — extracted from TNonline (NewBooking / Login / Settings)
   Base + variants (primary, secondary, danger, ghost), sizes,
   and a full-width block modifier. Pair with an icon (e.g.
   Bootstrap Icons <i class="bi bi-...">) for icon buttons.
   ═══════════════════════════════════════════════════════════ */

.tn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* em-based padding + gap so the whole button scales with its font-size */
    gap: 0.5em;
    padding: 0.66em 1.6em;
    /* fluid font-size: grows gently with the viewport, clamped to the tokens */
    font-size: clamp(var(--tn-font-size-sm), 0.74rem + 0.25vw, var(--tn-font-size-base));
    /* em-padding on a vw-clamped font-size makes height a function of
       viewport width, decreasing — this floor is what stops the button
       from being smallest exactly where the input device is a finger.
       Below --tn-touch-target at every measured width, so this is a hard
       floor, not a rare edge case: 1440px/769px/390px/320px all render
       under 44px on font-size + padding alone. */
    min-height: var(--tn-touch-target);
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    border-radius: var(--tn-radius);
    cursor: pointer;
    transition: all var(--tn-transition);
    border: 1.5px solid transparent;
    white-space: nowrap;
}

.tn-btn:disabled,
.tn-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tn-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--tn-accent-rgb), 0.3);
}

/* ── Primary — solid teal, lifts on hover ── */
.tn-btn--primary {
    background: var(--tn-accent);
    color: var(--tn-accent-contrast, #fff);
    border-color: var(--tn-accent);
}

.tn-btn--primary:hover:not(:disabled) {
    background: var(--tn-accent-hover);
    box-shadow: 0 4px 14px rgba(var(--tn-accent-rgb), 0.3);
    transform: translateY(-1px);
}

.tn-btn--primary:active:not(:disabled) {
    background: var(--tn-accent-active);
    transform: translateY(0);
}

/* ── Secondary — outlined, neutral ── */
.tn-btn--secondary {
    background: var(--tn-bg-card);
    color: var(--tn-text-secondary);
    border: 1.5px solid var(--tn-border);
}

.tn-btn--secondary:hover:not(:disabled) {
    background: var(--tn-bg-hover);
    border-color: var(--tn-text-secondary);
    color: var(--tn-text-primary);
}

/* ── Danger — destructive actions ── */
.tn-btn--danger {
    background: var(--tn-danger);
    color: #fff;
    border-color: var(--tn-danger);
}

.tn-btn--danger:hover:not(:disabled) {
    background: #A52323;
    box-shadow: 0 4px 14px rgba(197, 48, 48, 0.3);
    transform: translateY(-1px);
}

.tn-btn--danger:active:not(:disabled) {
    transform: translateY(0);
}

/* ── Ghost — text-only, no chrome until hover ── */
.tn-btn--ghost {
    background: transparent;
    color: var(--tn-text-secondary);
    border-color: transparent;
}

.tn-btn--ghost:hover:not(:disabled) {
    background: var(--tn-bg-hover);
    color: var(--tn-text-primary);
}

/* ── Ghost-danger — between --ghost (neutral) and --danger (solid red
   fill): neutral chrome with red text, for a destructive action that
   shouldn't out-compete the primary action visually but still needs to
   read as "this removes something" (a clear-filters control, a remove
   row action next to a save button). ── */
.tn-btn--ghost-danger {
    background: transparent;
    color: var(--tn-danger-text);
    border-color: transparent;
}

.tn-btn--ghost-danger:hover:not(:disabled) {
    background: var(--tn-danger-light);
    color: var(--tn-danger);
}

/* ── Sizes ── (only the font-size changes; em padding rescales the rest) */
.tn-btn--sm {
    font-size: var(--tn-font-size-xs);
    padding: 0.5em 1.1em;
    /* --sm's font-size is a fixed token, not the base's vw-clamp, so it
       doesn't have the shrinking defect the touch-target floor exists
       for — it's a deliberately compact variant (dense table row
       actions, toolbars), not a smaller copy of the bug. Exempt it so
       that stays true instead of silently inflating every dense --sm
       button to 44px. */
    min-height: auto;
}

.tn-btn--lg {
    font-size: clamp(var(--tn-font-size-base), 0.86rem + 0.4vw, var(--tn-font-size-lg));
    font-weight: 700;
}

/* ── Full width ── */
.tn-btn--block {
    width: 100%;
}

/* Icon scales with the button's font-size */
.tn-btn .bi {
    font-size: 1em;
}

/* ═══════════════════════════════════════════════════════════
   Button group — wraps responsively; --stack makes every button
   go full-width on narrow screens (mirrors TNonline action rows).
   ═══════════════════════════════════════════════════════════ */
.tn-btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tn-space-sm);
}

.tn-btn-group--end {
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .tn-btn-group--stack {
        align-items: stretch;
    }

    .tn-btn-group--stack .tn-btn {
        flex: 1 1 100%;
    }
}
