/* The tool cards (tools.js) on launcher.html and in the All tools picker of extractfile.html and
   adhocreason.html (tool-picker.js), and the picker dialog. Shared so the cards look the same everywhere.
   Colours are the values the pages already use. */
:root {
    --tool-card-text: #1e293b;
    --tool-card-muted: #64748b;
    --tool-card-border: #e2e8f0;
    --tool-card-surface: #fff;
    --tool-card-tint: #f1f5f9;
    --tool-card-accent: #0d6efd;
    --tool-card-accent-soft: rgba(13, 110, 253, .08);
    /* Each tool's icon tile (tools.js tone): orange for Invoice Capture, blue for Document Extraction. */
    --tool-card-orange-tile: #fff7ed;
    --tool-card-orange-icon: #b45309;
    --tool-card-blue-tile: #eff6ff;
    --tool-card-blue-icon: #0d6efd;
}

/* ─── The cards: side by side, stacked on narrow screens ─── */
.tool-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

    .tool-cards > li {
        display: flex;
    }

.tool-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    width: 100%;
    padding: 1.25rem;
    border: 1px solid var(--tool-card-border);
    border-radius: 12px;
    background: var(--tool-card-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

    .tool-card:hover {
        border-color: var(--tool-card-accent);
        box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
        transform: translateY(-1px);
        color: inherit;
    }

    .tool-card:focus-visible {
        outline: 3px solid var(--tool-card-accent);
        outline-offset: 2px;
    }

/* The tool this page is: choosing it only closes the picker. */
.tool-card-current {
    background: var(--tool-card-tint);
}

    .tool-card-current:hover {
        border-color: var(--tool-card-border);
        box-shadow: none;
        transform: none;
    }

.tool-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    background: var(--tool-card-accent-soft);
    color: var(--tool-card-accent);
    font-size: 1.35rem;
}

    .tool-card-icon-orange {
        background: var(--tool-card-orange-tile);
        color: var(--tool-card-orange-icon);
    }

    .tool-card-icon-blue {
        background: var(--tool-card-blue-tile);
        color: var(--tool-card-blue-icon);
    }

.tool-card-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--tool-card-text);
}

.tool-card-description {
    flex: 1 1 auto;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--tool-card-muted);
}

/* Looks like a button, but the whole card is the control. */
.tool-card-action {
    margin-top: .25rem;
    padding: .375rem .875rem;
    border-radius: var(--bs-border-radius);
    background: var(--tool-card-accent);
    color: #fff;
    font-size: .9rem;
    font-weight: 500;
}

.tool-card-here {
    background: transparent;
    border: 1px solid var(--tool-card-border);
    color: var(--tool-card-muted);
}

@media (prefers-reduced-motion: reduce) {
    .tool-card,
    .tool-card:hover {
        transition: none;
        transform: none;
    }
}

@media (max-width: 767.98px) {
    .tool-cards {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ─── The All tools picker (a native <dialog>, as the Sign out confirmation) ─── */
.tool-picker-dialog {
    /* Bootstrap sets these on .modal, which a native <dialog> is not, and .modal-content reads them. */
    --bs-modal-padding: 1rem;
    --bs-modal-color: var(--bs-body-color);
    --bs-modal-bg: var(--bs-body-bg);
    --bs-modal-border-color: var(--bs-border-color-translucent);
    --bs-modal-border-width: var(--bs-border-width);
    --bs-modal-border-radius: var(--bs-border-radius-lg);
    --bs-modal-box-shadow: var(--bs-box-shadow);
    --bs-modal-inner-border-radius: calc(var(--bs-border-radius-lg) - (var(--bs-border-width)));
    --bs-modal-header-padding: 1rem 1rem;
    /* The header's Close button takes its padding and margins from these: without them it has none,
       and shrinks to a 16px target. They match the header's .75rem 1rem padding below. */
    --bs-modal-header-padding-x: 1rem;
    --bs-modal-header-padding-y: .75rem;
    --bs-modal-header-border-color: var(--bs-border-color);
    --bs-modal-header-border-width: var(--bs-border-width);
    --bs-modal-title-line-height: 1.5;
    width: min(46rem, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

    .tool-picker-dialog .modal-content {
        max-height: calc(100dvh - 2rem);
        overflow-y: auto;
        box-shadow: var(--bs-modal-box-shadow);
    }

    /* The title sits in a tinted bar, as in every other dialog and the extension's. */
    .tool-picker-dialog .modal-header {
        padding: .75rem 1rem;
        background: var(--tool-card-tint);
        border-bottom: 1px solid var(--tool-card-border);
    }

    .tool-picker-dialog::backdrop {
        background: rgba(15, 23, 42, 0.38);
    }

.tool-picker-intro {
    color: var(--tool-card-muted);
}
