/* ═══════════════════════════════════════════════════════════════════════
   UI KIT — shared primitives for a consistent, restrained visual language
   across renewal_copilot. Hand-written CSS (not Tailwind-generated), so it
   is immune to the build's class-detection/purge step by construction —
   safe to reference from any page without depending on Tailwind seeing a
   literal class string in source. Built on the existing --color-* custom
   properties from style.css, so light/dark theming is automatic.
   ═══════════════════════════════════════════════════════════════════════ */

/* --- Page header: one compact shape for every page title, replacing the
   assorted p-8/text-2xl headers that made each page feel hand-built. --- */
.uk-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-border);
}

.uk-page-header__title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-foreground);
    margin: 0;
    line-height: 1.3;
}

.uk-page-header__subtitle {
    font-size: 12.5px;
    color: var(--color-secondary);
    margin: 3px 0 0;
    line-height: 1.4;
}

.uk-page-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Card --- */
.uk-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

/* --- Empty state: one consistent shape for every "nothing here yet". --- */
.uk-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
}

.uk-empty-state__icon {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: var(--color-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
    margin-bottom: 12px;
}

.uk-empty-state__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-foreground);
}

.uk-empty-state__desc {
    font-size: 12.5px;
    color: var(--color-secondary);
    max-width: 320px;
    line-height: 1.5;
    margin: 4px 0 0;
}

.uk-empty-state__action {
    margin-top: 16px;
}

/* --- Badges: variant classes instead of interpolated color names, so the
   class Tailwind needs to see literally in source always exists. --- */
.uk-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    border: 1px solid transparent;
    white-space: nowrap;
}

.uk-badge--neutral { background: var(--color-muted); color: var(--color-muted-foreground); border-color: var(--color-border); }
.uk-badge--info { background: color-mix(in srgb, var(--color-accent) 12%, transparent); color: var(--color-accent); border-color: color-mix(in srgb, var(--color-accent) 25%, transparent); }
.uk-badge--success { background: color-mix(in srgb, var(--color-success) 12%, transparent); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 25%, transparent); }
.uk-badge--warning { background: color-mix(in srgb, var(--color-warning) 14%, transparent); color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 28%, transparent); }
.uk-badge--danger { background: color-mix(in srgb, var(--color-error) 12%, transparent); color: var(--color-error); border-color: color-mix(in srgb, var(--color-error) 25%, transparent); }
.uk-badge--primary { background: color-mix(in srgb, var(--color-primary) 10%, transparent); color: var(--color-primary); border-color: color-mix(in srgb, var(--color-primary) 22%, transparent); }

/* --- Modal shell --- */
.uk-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: uk-fade-in 0.15s ease-out;
    padding: 20px;
}

.uk-modal {
    background: var(--color-card);
    border-radius: 14px;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.35);
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: uk-modal-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.uk-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.uk-modal__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-foreground);
    margin: 0;
}

.uk-modal__body {
    padding: 20px 22px;
    overflow-y: auto;
}

.uk-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.uk-modal__close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--color-secondary);
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

.uk-modal__close:hover {
    background: var(--color-muted);
    color: var(--color-foreground);
}

@keyframes uk-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes uk-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Collapsible section (sidebar groups, etc). Toggle by flipping
   aria-expanded on the trigger and data-collapsed on the body — see
   js/components/uiKit.js `bindCollapsible()`. --- */
.uk-collapse-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.uk-collapse-chevron {
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.uk-collapse-trigger[aria-expanded="false"] .uk-collapse-chevron {
    transform: rotate(-90deg);
}

.uk-collapse-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.18s ease;
}

.uk-collapse-body[data-collapsed="true"] {
    grid-template-rows: 0fr;
}

.uk-collapse-body > div {
    overflow: hidden;
    min-height: 0;
}
