/**
 * Atelier Nusa — UI Tier A polish
 * Tabular nums, 44px touch, hit areas, loading submit, reduced motion.
 * Loads last (after mobile.css). No Vite rebuild required.
 */

/* ---------- Numbers that line up (money / KPI / table) ---------- */
.studio-bg .kpi-value,
.studio-bg .table-dark td.text-right,
.studio-bg .table-dark th.text-right,
.studio-bg .font-mono.money,
.studio-bg [data-money],
.studio-bg .atn-money {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Common money display patterns (Rp …) */
.studio-bg .kpi .text-lg,
.studio-bg .kpi .text-xl,
.studio-bg .glass-strong .text-lg.font-extrabold,
.studio-bg .glass-strong .text-xl.font-extrabold,
.studio-bg .rounded-2xl .text-lg.font-extrabold,
.studio-bg td.whitespace-nowrap.text-right,
.studio-bg td.text-right.font-bold {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ---------- Touch targets ≥ 44px (Apple HIG / WCAG) ---------- */
.studio-bg .btn-primary,
.studio-bg .btn-secondary {
    min-height: 2.75rem; /* 44px */
    min-width: 2.75rem;
}

.studio-bg .btn-ghost,
.studio-bg .btn-danger {
    min-height: 2.5rem;
}

@media (pointer: coarse), (max-width: 1023px) {
    .studio-bg .btn-primary,
    .studio-bg .btn-secondary,
    .studio-bg .btn-ghost,
    .studio-bg .btn-danger,
    .studio-bg .nav-link,
    .studio-bg a.btn-primary,
    .studio-bg a.btn-secondary {
        min-height: 2.75rem; /* 44px */
    }

    /* Expand hit area for compact table actions without huge visual size */
    .studio-bg .table-dark .btn-danger,
    .studio-bg .table-dark button[type="submit"].btn-danger {
        min-height: 2.5rem;
        min-width: 2.75rem;
        padding: 0.4rem 0.65rem !important;
        position: relative;
    }

    .studio-bg .table-dark .btn-danger::before,
    .studio-bg .table-dark button[type="submit"].btn-danger::before {
        content: "";
        position: absolute;
        inset: -6px;
    }

    .studio-bg .chip-yes,
    .studio-bg .chip-no {
        min-height: 2.75rem;
        min-width: 2.75rem;
    }

    .studio-bg input[type="checkbox"],
    .studio-bg input[type="radio"] {
        width: 1.25rem;
        height: 1.25rem;
        min-width: 1.25rem;
        min-height: 1.25rem;
    }
}

/* Icon / header control already h-11 w-11 — reinforce */
.studio-bg header button[aria-label],
.studio-bg .atn-touch-44 {
    min-height: 2.75rem;
    min-width: 2.75rem;
}

/* ---------- Active press (ensure on links-as-buttons too) ---------- */
.studio-bg a.btn-primary:active,
.studio-bg a.btn-secondary:active,
.studio-bg a.btn-ghost:active,
.studio-bg button.btn-danger:active {
    transform: scale(0.96);
}

/* ---------- Loading submit ---------- */
.studio-bg .btn-primary.is-loading,
.studio-bg .btn-secondary.is-loading,
.studio-bg button.is-loading[type="submit"] {
    pointer-events: none;
    opacity: 0.78;
    cursor: wait;
    transform: none !important;
}

.studio-bg .atn-spinner {
    display: inline-block;
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 9999px;
    vertical-align: -0.15em;
    margin-right: 0.35rem;
    animation: atn-spin 0.65s linear infinite;
}

@keyframes atn-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Filter collapse ---------- */
.studio-bg .atn-filter-advanced {
    display: grid;
    gap: 0.75rem;
}

.studio-bg .atn-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.studio-bg .atn-filter-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(212, 175, 120, 0.35);
    color: #f1f5f9;
}

.studio-bg .atn-filter-toggle[aria-expanded="true"] {
    border-color: rgba(201, 162, 39, 0.4);
    color: #d4af78;
}

.studio-bg .atn-filter-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
}

.studio-bg .atn-filter-toggle[aria-expanded="true"] .atn-filter-chevron {
    transform: rotate(180deg);
}

/* ---------- Guest login polish ---------- */
.guest-card button[type="submit"] {
    min-height: 2.75rem;
}

.guest-card button[type="submit"].is-loading {
    pointer-events: none;
    opacity: 0.8;
    cursor: wait;
}

/* ---------- Reduced motion (OS + manual toggle) ---------- */
@media (prefers-reduced-motion: reduce) {
    .studio-bg .btn-primary:active,
    .studio-bg .btn-secondary:active,
    .studio-bg .btn-ghost:active,
    .studio-bg a.btn-primary:active,
    .studio-bg a.btn-secondary:active,
    .studio-bg .kpi:hover,
    .studio-bg .person-card:hover {
        transform: none;
    }

    .studio-bg .atn-spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.6;
    }

    .studio-bg .atn-filter-chevron {
        transition: none;
    }
}

html.atn-motion-off .studio-bg .atn-spinner {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.6;
}

html.atn-motion-off .studio-bg a.btn-primary:active,
html.atn-motion-off .studio-bg a.btn-secondary:active,
html.atn-motion-off .studio-bg button.btn-danger:active {
    transform: none !important;
}

/* ---------- Empty states ---------- */
.studio-bg .atn-empty {
    text-align: center;
    padding: 1.25rem 1rem;
    max-width: 28rem;
    margin: 0 auto;
}

.studio-bg .atn-empty-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
}

.studio-bg .atn-empty-sub {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.45;
}

/* ---------- Alert banner (contract reminders) ---------- */
.studio-bg .atn-alert-banner {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

/* ---------- Light skeleton (optional progressive) ---------- */
.studio-bg .atn-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: atn-shimmer 1.2s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes atn-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .studio-bg .atn-skeleton {
        animation: none;
        background: rgba(255, 255, 255, 0.06);
    }
}
