/* ==========================================================================
   DGN Design System — Components
   Buttons, forms, cards, alerts, badges, tables, nav, modal, pagination.
   ========================================================================== */

/* ----- Buttons ----------------------------------------------------------- */

.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.8rem 1.6rem;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    color: var(--color-white);
    background: var(--color-forest-700);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition:
        transform var(--duration-fast) var(--ease-out),
        background-color var(--duration-base) var(--ease-out),
        box-shadow var(--duration-base) var(--ease-out);
    will-change: transform;
}

/* Light sheen that sweeps across on hover. */
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%);
    transform: translateX(-110%);
    transition: transform var(--duration-slow) var(--ease-out);
    pointer-events: none;
}

.btn:hover::after {
    transform: translateX(110%);
}

.btn:hover {
    color: var(--color-white);
    background: var(--color-forest-800);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: linear-gradient(135deg, var(--color-forest-600), var(--color-leaf-500));
    box-shadow: 0 10px 30px -14px rgba(34, 139, 60, 0.7);
}

.btn--primary:hover {
    background: linear-gradient(135deg, var(--color-forest-700), var(--color-leaf-500));
}

.btn--accent {
    color: var(--color-forest-900);
    background: var(--color-lime-400);
}

.btn--accent:hover {
    color: var(--color-forest-900);
    background: var(--color-lime-300);
}

.btn--ghost {
    color: var(--color-forest-800);
    background: transparent;
    border-color: var(--color-forest-700);
}

.btn--ghost:hover {
    color: var(--color-forest-900);
    background: rgba(34, 139, 60, 0.08);
}

.btn--sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

.btn--lg {
    padding: 1rem 2.2rem;
    font-size: var(--text-lg);
}

.btn--block {
    width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ----- Cards ------------------------------------------------------------- */

.card {
    position: relative;
    padding: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition:
        transform var(--duration-base) var(--ease-out),
        box-shadow var(--duration-base) var(--ease-out),
        border-color var(--duration-base) var(--ease-out);
}

/* Gradient hairline along the top edge — appears on hover for interactive
   cards, always on for .card--accent. */
.card::before {
    content: "";
    position: absolute;
    top: -1px;
    left: var(--radius-lg);
    right: var(--radius-lg);
    height: 2px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--color-leaf-500), var(--color-lime-300), transparent);
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out);
    pointer-events: none;
}

.card--accent::before,
.card--interactive:hover::before {
    opacity: 1;
}

.card--interactive:hover {
    transform: translateY(-4px);
    border-color: var(--color-lime-300);
    box-shadow: var(--shadow-lift);
}

.card__icon {
    display: grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    background: linear-gradient(140deg, var(--color-lime-200), var(--color-leaf-400));
    color: var(--color-forest-900);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-xl);
}

.card__title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

/* ----- Forms ------------------------------------------------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-ink-700);
}

.input,
.textarea,
.select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    transition:
        border-color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--color-ink-300);
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--color-leaf-500);
    box-shadow: var(--shadow-ring);
}

.textarea {
    min-height: 8rem;
    resize: vertical;
}

.input--error,
.textarea--error,
.select--error {
    border-color: var(--color-danger);
}

.field__error {
    font-size: var(--text-sm);
    color: var(--color-danger);
}

.field__hint {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* ----- Badges ------------------------------------------------------------ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.3rem 0.7rem;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    border-radius: var(--radius-pill);
    background: var(--color-surface-alt);
    color: var(--color-ink-700);
}

/* Status dot keyed to the badge's own text colour. */
.badge::before {
    content: "";
    width: 0.42em;
    height: 0.42em;
    border-radius: var(--radius-pill);
    background: currentColor;
}

.badge--success { background: rgba(47, 143, 67, 0.14); color: var(--color-success); }
.badge--warning { background: rgba(201, 138, 22, 0.16); color: var(--color-warning); }
.badge--danger  { background: rgba(192, 57, 43, 0.14); color: var(--color-danger); }
.badge--info    { background: rgba(44, 122, 123, 0.14); color: var(--color-info); }

/* ----- Alerts ------------------------------------------------------------ */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-info);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.alert--success { border-left-color: var(--color-success); background: rgba(47, 143, 67, 0.07); }
.alert--warning { border-left-color: var(--color-warning); background: rgba(201, 138, 22, 0.08); }
.alert--danger  { border-left-color: var(--color-danger);  background: rgba(192, 57, 43, 0.07); }
.alert--info    { border-left-color: var(--color-info);    background: rgba(44, 122, 123, 0.07); }

.alert__title {
    font-weight: 700;
    margin-bottom: var(--space-1);
}

/* ----- Tables ------------------------------------------------------------ */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table thead th {
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background-color var(--duration-fast) var(--ease-out);
}

.table tbody tr:hover {
    background: rgba(124, 198, 63, 0.07);
    box-shadow: inset 3px 0 0 var(--color-lime-400);
}

/* ----- Pagination -------------------------------------------------------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    align-items: center;
    margin-top: var(--space-6);
}

.pagination a,
.pagination span {
    display: grid;
    place-items: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding-inline: var(--space-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-ink-700);
    background: var(--color-surface);
}

.pagination a:hover {
    border-color: var(--color-leaf-500);
    color: var(--color-forest-800);
}

.pagination .is-active {
    background: var(--color-forest-700);
    border-color: var(--color-forest-700);
    color: var(--color-white);
}

.pagination .is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ----- Modal ------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background: rgba(15, 61, 26, 0.45);
    backdrop-filter: blur(4px);
}

.modal[hidden] {
    display: none;
}

.modal__panel {
    width: min(34rem, 100%);
    padding: var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* ----- Tag / pill list --------------------------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.45rem 0.95rem;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-ink-700);
}

/* ----- Notifications ----------------------------------------------------- */

.muted {
    color: var(--color-ink-500, #5b6b60);
    font-size: var(--text-sm);
    margin: 0;
}

.card__header {
    margin-bottom: var(--space-4);
}

.card__header--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    color: var(--color-ink-700);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: background 0.15s ease, color 0.15s ease;
}

.notif-bell:hover {
    background: var(--color-bg, #eef2ee);
    color: var(--color-primary, #228b3c);
}

.notif-bell__count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-danger, #c0392b);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item--unread {
    position: relative;
    padding-left: var(--space-4);
}

.notif-item--unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary, #228b3c);
}

.notif-item__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.notif-item__title {
    font-weight: 600;
    color: var(--color-ink-900, #0f2417);
}

.notif-item__body {
    font-size: var(--text-sm);
    color: var(--color-ink-700, #243a2d);
}

.notif-item__time {
    font-size: 12px;
    color: var(--color-ink-500, #9aa79e);
}

.notif-empty {
    padding: var(--space-6) 0;
}
