/*
  Linehaul Workspace Component Styles
  Global reusable toast component
*/

.lh-toast-container {
    position: fixed;
    z-index: 9999;
    top: calc(4.75rem + env(safe-area-inset-top, 0px));
    right: max(1.25rem, env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
    max-width: min(24rem, calc(100vw - 2rem));
    width: 100%;
}

.lh-toast {
    position: relative;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0.95rem 1.05rem 1rem 1.1rem;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--lh-blue, #2458a6);
    border-radius: var(--lh-radius-panel, 0.5rem);
    background: #ffffff;
    color: var(--lh-text, #172033);
    box-shadow:
        0 12px 32px -4px rgba(18, 35, 63, 0.16),
        0 4px 12px rgba(18, 35, 63, 0.08);
    overflow: visible;
    animation: lh-toast-enter 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lh-toast.is-success { border-left-color: #047857; }
.lh-toast.is-warning { border-left-color: #b45309; }
.lh-toast.is-error { border-left-color: #be123c; }
.lh-toast.is-leaving { animation: lh-toast-leave 180ms ease both; pointer-events: none; }

.lh-toast__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.lh-toast__title { margin: 0 0 0.25rem 0; font-size: 0.85rem; font-weight: 800; color: var(--lh-navy, #12233f); letter-spacing: -0.01em; }
.lh-toast.is-success .lh-toast__title { color: #064e3b; }
.lh-toast.is-warning .lh-toast__title { color: #78350f; }
.lh-toast.is-error .lh-toast__title { color: #881337; }

.lh-toast__close { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; background: transparent; color: #64748b; cursor: pointer; border-radius: 0.25rem; transition: background-color 120ms ease, color 120ms ease; }
.lh-toast__close:hover { background: #f1f5f9; color: #0f172a; }

.lh-toast__body { margin: 0 0 0.55rem 0; font-size: 0.8rem; line-height: 1.45; color: var(--lh-text-secondary, #475569); }
.lh-toast__actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; margin-bottom: 0.35rem; }
.lh-toast__action { display: inline-flex; align-items: center; justify-content: center; padding: 0.35rem 0.75rem; border: 1px solid var(--lh-blue, #2458a6); border-radius: var(--lh-radius-control, 0.375rem); background: var(--lh-blue, #2458a6); color: #ffffff; font-size: 0.725rem; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color 120ms ease, transform 120ms ease; }
.lh-toast__action:hover { background: var(--lh-blue-hover, #1d4b91); transform: translateY(-1px); }

/* JS-owned countdown: one wall-clock deadline drives both progress and dismissal. */
.lh-toast-track { position: absolute; inset: auto 0 -2px; height: 3px; overflow: visible; background: #dbe3ee; border-radius: 0 0 4px 4px; transform-origin: center bottom; transition: transform 140ms ease, height 140ms ease, box-shadow 140ms ease; }
.lh-toast-progress { display: block; width: 100%; height: 100%; transform-origin: left; transform: scaleX(var(--lh-toast-progress, 1)); background: var(--lh-blue, #2458a6); border-radius: inherit; box-shadow: 0 1px 3px rgba(36, 88, 166, 0.2); will-change: transform; }
.lh-toast:hover .lh-toast-track,
.lh-toast:focus-within .lh-toast-track,
.lh-toast.is-paused .lh-toast-track { height: 4px; transform: translateY(1px) scaleY(1.12); box-shadow: 0 2px 5px rgba(36, 88, 166, 0.16); }

@keyframes lh-toast-enter { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes lh-toast-leave { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-6px) scale(0.96); } }

@media (min-width: 1024px) {
    .lh-toast-container {
        top: max(1.25rem, env(safe-area-inset-top, 0px));
        right: max(1.25rem, env(safe-area-inset-right, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .lh-toast { animation: none; }
    .lh-toast.is-leaving { animation: none; opacity: 0; }
    .lh-toast-progress { animation-timing-function: steps(4, end); }
}
/* Invoice Details field lists: one compact row per field (label | value, status, actions)
   instead of a tall card. Scoped to the page lists, so a field moved into focused review
   keeps that panel's own editor layout. Multi-line charge groups keep their card. */
@media (min-width: 640px) {
    :is(#metadata-container .metadata-row, #charges-container .charge-row:not(:has(> details))) {
        display: grid;
        grid-template-columns: minmax(8rem, 30%) minmax(0, 1fr);
        align-items: center;
        column-gap: 1rem;
        row-gap: 0;
        min-height: 2.75rem;
        padding: 0.375rem 0.625rem 0.375rem 0.75rem;
    }
    :is(#metadata-container .metadata-row, #charges-container .charge-row:not(:has(> details))) > div:nth-child(2) {
        padding-top: 0;
    }
}
:is(#metadata-container, #charges-container) .space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.375rem; }

/* Field removal is available but quiet; it turns red only when pointed at. */
:is(#metadata-container, #charges-container) .delete-field-btn {
    border-color: var(--lh-slate-300, #cbd2dc);
    background: #fff;
    color: var(--lh-slate-500, #64748b);
}
:is(#metadata-container, #charges-container) .delete-field-btn:is(:hover, :focus-visible) {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}
