/* Shared styles for Easzy's Core. Tailwind (CDN) handles layout, this file holds the components. */
:root {
    --bg: #0c0c0d;
    --surface: #141416;
    --raised: #1c1c1f;
    --line: #26262a;
    --line-strong: #38383e;
    --fg: #e8e8ea;
    --muted: #a1a1a9;
    --faint: #73737b;
    --ok: #62d394;
    --warn: #e6b052;
    --bad: #f27878;
}

html {
    background: var(--bg);
    color-scheme: dark;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

:focus-visible {
    outline: 2px solid #c9c9ce;
    outline-offset: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2.25rem;
    padding: 0 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--line-strong);
    background: var(--raised);
    color: var(--fg);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: #25252a; border-color: #4a4a51; }
.btn-primary { background: #ececee; border-color: #ececee; color: #0c0c0d; font-weight: 600; }
.btn-primary:hover { background: #d8d8dc; border-color: #d8d8dc; }
.btn-danger { color: var(--bad); border-color: rgba(242, 120, 120, 0.35); background: rgba(242, 120, 120, 0.07); }
.btn-danger:hover { background: rgba(242, 120, 120, 0.15); border-color: rgba(242, 120, 120, 0.55); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; color: var(--fg); }
.btn-sm { height: 1.875rem; padding: 0 0.625rem; font-size: 0.8125rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-sm.btn-icon { width: 1.875rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Inputs */
.input {
    height: 2.25rem;
    width: 100%;
    padding: 0 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    color: var(--fg);
    font-size: 0.875rem;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #4a4a51; }
.input:focus, .input:focus-visible { outline: none; border-color: #8f8f98; box-shadow: 0 0 0 3px rgba(232, 232, 234, 0.12); }
.input-sm { height: 1.875rem; font-size: 0.8125rem; padding: 0 0.5rem; }
.input[aria-invalid="true"] { border-color: var(--bad); }

/* Filter chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 1.875rem;
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .count { font-variant-numeric: tabular-nums; opacity: 0.65; }
.chip-alert:not([aria-pressed="true"]) .count { color: var(--bad); opacity: 1; }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 999px; background: currentColor; }
.badge-active { color: var(--ok); border-color: rgba(98, 211, 148, 0.3); background: rgba(98, 211, 148, 0.07); }
.badge-expired { color: var(--warn); border-color: rgba(230, 176, 82, 0.3); background: rgba(230, 176, 82, 0.07); }
.badge-revoked { color: var(--bad); border-color: rgba(242, 120, 120, 0.3); background: rgba(242, 120, 120, 0.07); }
.badge-neutral { color: var(--muted); border-color: var(--line-strong); background: transparent; }
.badge-plain::before { display: none; }

/* Data tables */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0 0.75rem;
    height: 2.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.data-table td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.data-table tbody tr:last-child td { border-bottom: 0; }
/* Row actions stay in view when a wide table scrolls sideways */
.data-table .col-sticky { position: sticky; right: 0; background: var(--surface); box-shadow: inset 1px 0 0 var(--line); }
.data-table th.col-sticky { z-index: 2; }
.data-table tbody tr:hover td.col-sticky { background: linear-gradient(rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.025)), var(--surface); }
.sort-btn { display: inline-flex; align-items: center; gap: 0.25rem; text-transform: inherit; letter-spacing: inherit; font: inherit; color: inherit; cursor: pointer; }
.sort-btn:hover { color: var(--fg); }
.sort-btn .arrow { width: 0.75rem; display: inline-block; color: var(--faint); }
th[aria-sort] .sort-btn { color: var(--fg); }
th[aria-sort] .sort-btn .arrow { color: var(--fg); }

/* Loading skeletons */
.skeleton { border-radius: 0.25rem; background: #1f1f23; animation: skeleton-pulse 1.4s ease-in-out infinite; }
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
}
[aria-busy="true"] .results-body { opacity: 0.55; transition: opacity 0.15s; }

/* Dialogs */
dialog.modal {
    width: min(100% - 2rem, 34rem);
    max-height: min(100dvh - 2rem, 48rem);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--fg);
}
dialog.modal-wide { width: min(100% - 2rem, 56rem); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.6); }

/* Toasts */
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    max-width: 24rem;
    padding: 0.75rem 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--line-strong);
    border-left-width: 3px;
    background: var(--raised);
    color: var(--fg);
    font-size: 0.875rem;
}
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }

/* Thin scrollbars inside the app */
.scroll-thin { scrollbar-width: thin; scrollbar-color: #3a3a40 transparent; }
