/* Awssome UI 2.0 — product listings: list page, record header, section nav, detail panels.
   Loaded on every page via _CreateNewProduct.cshtml (the create modal lives in the master
   layout), so every rule here is scoped to a ui-product* / ui-products class or an id. */

/* ---------- List: toolbar ---------- */
/* Legacy `.aws-input-search .svg-icon { left: 10px }` pushed the glyph onto the placeholder
   (icon right edge = text start). Sit it on the wrapper's 14px inset: 10px gap to the text. */
.ui-products-toolbar .aws-input-search .svg-icon {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.ui-products-toolbar__filter {
    flex: 0 1 220px;
    min-width: 180px;
    /* containing block for Select2's visually-hidden native <select> (w-100 keeps it full width);
       without it the select resolved against the scroller and pushed it 16px sideways at 390 */
    position: relative;
}

.ui-products-toolbar__filter .select2-container {
    width: 100% !important;
}

@media (max-width: 575.98px) {
    .ui-products-toolbar .ui-toolbar__grow {
        flex-basis: 100%;
    }

    .ui-products-toolbar__filter {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* ---------- List: table cells ---------- */
.ui-products-table .exportButtonsContainer {
    gap: 8px;
    padding-top: 16px;
}

.ui-product-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.ui-product-name a.ui-product-name__link.aws-link {
    font-family: var(--ui-font-semibold);
    font-size: 14.5px;
    color: var(--ui-ink) !important;
    text-decoration: none;
}

.ui-product-name a.ui-product-name__link.aws-link:hover {
    color: var(--ui-primary-hover) !important;
}

.ui-products-table__date {
    color: var(--ui-muted) !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* "AI generated": hairline gradient-free tag, orange ink so it reads as Skai's */
.ui-ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--ui-r-pill);
    border: 1px solid var(--ui-brand-200);
    background: var(--ui-brand-50);
    color: var(--ui-brand-700);
    font-family: var(--ui-font-semibold);
    font-size: 11.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.ui-ai-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ui-brand-400), var(--ui-pink-300));
}

/* Extra status pills the shared badge set does not cover */
.badge.aws-badge.ui-badge-info {
    background: var(--ui-blue-50) !important;
    color: var(--ui-blue-800) !important;
}

.badge.aws-badge.ui-badge-neutral {
    background: var(--ui-surface) !important;
    color: var(--ui-ink-2) !important;
    box-shadow: inset 0 0 0 1px var(--ui-line);
}

.badge.aws-badge.ui-badge-neutral::before {
    display: none;
}

/* Quiet icon row actions */
.ui-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.btn.aws-btn-icon.ui-row-action {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    border-radius: var(--ui-r-sm) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--ui-muted);
}

.btn.aws-btn-icon.ui-row-action:hover,
.btn.aws-btn-icon.ui-row-action:focus-visible {
    background: var(--ui-fill) !important;
    border-color: var(--ui-line) !important;
}

.btn.aws-btn-icon.ui-row-action .svg-icon svg path {
    stroke: var(--ui-ink-2);
}

.btn.aws-btn-icon.ui-row-action--danger:hover .svg-icon svg path {
    stroke: var(--ui-red-700);
}

.btn.aws-btn-icon.ui-row-action--danger:hover {
    background: var(--ui-red-50) !important;
    border-color: transparent !important;
}

/* Empty states inside DataTables cells */
#products_table .dataTables_empty,
#solutions_table .dataTables_empty {
    padding: 8px 16px !important;
}

#products_table .dataTables_empty .ui-empty,
#solutions_table .dataTables_empty .ui-empty {
    white-space: normal;
}

/* The column min-widths keep the table wider than the card on tablet/phone, so the colspan
   empty cell centred Skai off-screen (x=481 on a 390 screen). Size it to the card's visible
   width (cqw = the scroller's content box) and keep it in view if the table is panned. */
.ui-products-table {
    container-type: inline-size;
}

#products_table .dataTables_empty .ui-empty,
#solutions_table .dataTables_empty .ui-empty {
    position: sticky;
    left: 0;
    width: calc(100cqw - 32px);
    max-width: 100%;
}

/* Import-from-AWS modal on phones: three table columns left the listing name ~100px wide and
   broke the product id mid-word. Each row becomes name + visibility (stacked) | action.
   Id-scoped to outrank tables.css cell padding/borders/hover fill. */
@media (max-width: 575.98px) {
    .ui-import-listing__table thead {
        display: none;
    }

    #import_aws_listing_table .table.aws-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--ui-line-soft);
    }

    #import_aws_listing_table .table.aws-table tbody tr:last-child {
        border-bottom: 0;
    }

    #import_aws_listing_table .table.aws-table tbody td,
    #import_aws_listing_table .table.aws-table tbody tr:hover td {
        display: block;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }

    .ui-import-listing__table tbody td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .ui-import-listing__table tbody td:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
        margin-top: 8px;
    }

    .ui-import-listing__table tbody td:nth-child(3) {
        grid-column: 2;
        grid-row: 1 / span 2;
        max-width: 132px;
    }

    .ui-import-listing__id {
        word-break: normal;
        overflow-wrap: anywhere;
    }
}
