/* =============================================================================
   assistance.components.css  -  LAPISAN 3 dari 3 (styling umum)

   Pola komponen yang SAMA-SAMA muncul di keempat solusi, digeneralisasi jadi
   satu definisi berbasis token. Kelas lama TIDAK dihapus dan .razor.css tiap
   halaman tetap ada, sehingga tampilan saat ini tidak berubah; kelas `ast-*`
   di sini adalah target migrasi bertahap.

   Pemetaan asal -> generalisasi:
     .content-card / .kt-card / .card-panel        -> .ast-card
     .page-header / PageHeader (MDT, PCI, APY)     -> .ast-page-header
     .loading-row / ContentLoading / LoadingSkeleton -> .ast-loading
     StatusBadge / .badge-* (APY) & .kt-badge      -> .ast-badge (+varian)
     .ig-cell-input (grid Ignite, UAR/APY)         -> .ast-field
     modal MDT (SharedModal/ErrorModal/SuccessModal)
       & PCI (StandardModal)                       -> .ast-modal*
     EmptyState (APY)                              -> .ast-empty
   ============================================================================= */

/* ---------------------------------------------------------------- kartu ---- */
.ast-card {
    background: var(--ast-surface);
    border: 1px solid var(--ast-border-subtle);
    border-radius: var(--ast-radius-lg);
    box-shadow: var(--ast-shadow-sm);
}

.ast-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ast-space-3);
    padding: var(--ast-space-4) var(--ast-space-5);
    border-bottom: 1px solid var(--ast-border-subtle);
    font-size: var(--ast-font-size-md);
    font-weight: 600;
    color: var(--ast-text);
}

.ast-card-body   { padding: var(--ast-space-5); }
.ast-card-footer {
    padding: var(--ast-space-3) var(--ast-space-5);
    border-top: 1px solid var(--ast-border-subtle);
    background: var(--ast-surface-muted);
    border-radius: 0 0 var(--ast-radius-lg) var(--ast-radius-lg);
}

/* -------------------------------------------------------- header halaman --- */
.ast-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ast-space-4);
    margin-bottom: var(--ast-space-5);
}

.ast-page-header__title {
    font-size: var(--ast-font-size-lg);
    font-weight: 600;
    color: var(--ast-text);
    margin: 0;
}

.ast-page-header__subtitle {
    font-size: var(--ast-font-size-sm);
    color: var(--ast-text-muted);
    margin: var(--ast-space-1) 0 0;
}

.ast-page-header__actions {
    display: flex;
    gap: var(--ast-space-2);
    flex-shrink: 0;
}

/* ------------------------------------------------------------- form/field -- */
/* Setara .ig-cell-input pada editor grid Ignite di UAR & APY. */
.ast-field {
    width: 100%;
    box-sizing: border-box;
    min-height: 32px;
    border: 1px solid var(--ast-border);
    border-radius: var(--ast-radius-sm);
    padding: 6px 11px;
    font-family: inherit;
    font-size: var(--ast-font-size-base);
    line-height: var(--ast-line-tight);
    color: var(--ast-text);
    background: var(--ast-surface);
    outline: none;
    transition: border-color var(--ast-transition), box-shadow var(--ast-transition);
}

.ast-field:hover              { border-color: var(--ast-border-hover); }
.ast-field:focus              { border-color: var(--ast-brand); box-shadow: var(--ast-ring); }
.ast-field::placeholder       { color: var(--ast-text-placeholder); }
.ast-field[disabled],
.ast-field[readonly]          { background: var(--ast-surface-muted); color: var(--ast-text-muted); }
.ast-field.is-invalid         { border-color: var(--ast-danger); }

.ast-field-label {
    display: block;
    font-size: var(--ast-font-size-sm);
    font-weight: 500;
    color: var(--ast-text-muted);
    margin-bottom: var(--ast-space-1);
}

.ast-field-error {
    font-size: var(--ast-font-size-xs);
    color: var(--ast-danger);
    margin-top: var(--ast-space-1);
}

/* ------------------------------------------------------------------ badge -- */
.ast-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ast-space-1);
    padding: 2px 10px;
    border-radius: var(--ast-radius-pill);
    font-size: var(--ast-font-size-xs);
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.ast-badge--neutral { background: var(--ast-surface-muted); color: var(--ast-text-muted); }
.ast-badge--info    { background: rgba(14, 165, 233, .12); color: var(--ast-info); }
.ast-badge--success { background: var(--ast-success-bg);    color: var(--ast-success); }
.ast-badge--warning { background: rgba(245, 158, 11, .14);  color: #b45309; }
.ast-badge--danger  { background: var(--ast-danger-bg);     color: var(--ast-danger); }

/* --------------------------------------------------------------- tabel ----- */
.ast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ast-font-size-base);
}

.ast-table th {
    text-align: left;
    font-weight: 600;
    color: var(--ast-text-muted);
    background: var(--ast-surface-muted);
    padding: var(--ast-space-2) var(--ast-space-3);
    border-bottom: 1px solid var(--ast-border-subtle);
    white-space: nowrap;
}

.ast-table td {
    padding: var(--ast-space-2) var(--ast-space-3);
    border-bottom: 1px solid var(--ast-border-subtle);
    color: var(--ast-text);
}

.ast-table tbody tr:hover      { background: var(--ast-surface-muted); }
.ast-table .ast-row-new        { background: var(--ast-success-bg); border-left: 3px solid var(--ast-success); }
.ast-table .ast-row-priority   { background: var(--ast-danger-bg); }

/* --------------------------------------------------------------- modal ----- */
.ast-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.ast-modal {
    background: var(--ast-surface);
    border-radius: var(--ast-radius-lg);
    box-shadow: var(--ast-shadow-lg);
    width: min(560px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.ast-modal--lg  { width: min(880px,  calc(100vw - 2rem)); }
.ast-modal--xl  { width: min(1140px, calc(100vw - 2rem)); }

.ast-modal__header {
    padding: var(--ast-space-4) var(--ast-space-5);
    border-bottom: 1px solid var(--ast-border-subtle);
    font-weight: 600;
    color: var(--ast-text);
}

.ast-modal__body   { padding: var(--ast-space-5); overflow-y: auto; }
.ast-modal__footer {
    padding: var(--ast-space-3) var(--ast-space-5);
    border-top: 1px solid var(--ast-border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--ast-space-2);
}

/* ------------------------------------------------------- loading & kosong -- */
.ast-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ast-space-2);
    padding: var(--ast-space-6);
    color: var(--ast-text-muted);
    font-size: var(--ast-font-size-sm);
}

.ast-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--ast-border-subtle);
    border-top-color: var(--ast-brand);
    border-radius: 50%;
    animation: ast-spin .7s linear infinite;
}

@keyframes ast-spin { to { transform: rotate(360deg); } }

.ast-skeleton {
    background: linear-gradient(90deg,
        var(--ast-surface-muted) 25%,
        var(--ast-border-subtle) 37%,
        var(--ast-surface-muted) 63%);
    background-size: 400% 100%;
    animation: ast-shimmer 1.4s ease infinite;
    border-radius: var(--ast-radius-sm);
}

@keyframes ast-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.ast-empty {
    text-align: center;
    padding: var(--ast-space-6) var(--ast-space-5);
    color: var(--ast-text-muted);
}

.ast-empty__title {
    font-weight: 600;
    color: var(--ast-text);
    margin-bottom: var(--ast-space-1);
}

/* ---- Procurement report helpers ---- */
.aging-meter {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}
.aging-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.funnel-track {
    height: 26px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}
.funnel-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s;
}
/* bg-red-500: theme ships every other bg-*-500 (yellow, green, ...) as a
   generated Tailwind utility, but this one was never generated since no
   other page happened to use it literally before. --color-red-500 itself
   already exists (styles.css), so this just exposes it under the same
   utility-class name the rest of the palette uses. */
.bg-red-500 {
    background-color: var(--color-red-500);
}
/* text-danger/info/success/warning/dark: this theme never generated a plain
   semantic text-color set (only text-primary/text-destructive exist as
   utilities) - badges/buttons got kt-badge-* variants instead. Each of these
   mirrors the color its kt-badge-* / existing sibling already uses, so
   "danger" text reads the same red as a destructive badge, etc. */
.text-danger {
    color: var(--destructive);
}
.text-info {
    color: var(--color-violet-600);
}
.text-success {
    color: var(--color-green-600);
}
.text-warning {
    color: var(--color-yellow-600);
}
.text-dark {
    color: var(--foreground);
}
/* grid-cols-5: this build has no grid-cols-5 (only 2/3/4 are generated) and,
   more broadly, no responsive sm:/md:/etc. variants exist anywhere in it -
   nothing in the app relies on them, so a "sm:grid-cols-5" class silently
   does nothing here. Provided as a plain (non-responsive) utility. */
.grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* ------------------------------------------------------------ toolbar ------ */
.ast-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ast-space-2);
    margin-bottom: var(--ast-space-4);
}

.ast-toolbar__spacer { margin-left: auto; }

/* ------------------------------------------------ api-error alert ------ */
@keyframes ast-slide-in {
    0%   { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------- purchasing list grids ------
   IgbGrid (purchasingGrid / purchasingApprovalGrid) sets an inline
   `height` on its own internal .igx-grid__tbody-content via JS, and that
   measurement gets stuck small (confirmed in DevTools) instead of
   growing to fit the actual rows. Height/RowHeight params on <IgbGrid>
   don't reliably clear it, so force the real scrollable row container
   open here - !important is required to beat the element's own inline
   style, which a plain rule can't do. Scoped by Id so other IgbGrid
   usages elsewhere (which size correctly) are unaffected. */
#purchasingGrid .igx-grid__tbody-content,
#purchasingApprovalGrid .igx-grid__tbody-content {
    height: auto !important;
    max-height: none !important;
}
