/*
 * The AI credits page.
 *
 * Longhand rather than Tailwind utilities for the same reason as theme-builder.css: the
 * Filament panel serves Filament's own prebuilt stylesheet, and nothing in this application
 * scans these Blade files for class names. Colours come from Filament's CSS variables so
 * the page follows the panel's theme instead of guessing at it.
 */

/* --------------------------------------------------------------------------
 * Balance
 * ----------------------------------------------------------------------- */

.credits-balance {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 0.75rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

:is(.dark) .credits-balance {
    border-color: rgb(255 255 255 / 10%);
    background-color: rgb(var(--gray-900));
}

.credits-balance__figure {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.credits-balance__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.credits-balance__label {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
}

.credits-balance__amount {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.1;
    color: rgb(var(--gray-950));
}

:is(.dark) .credits-balance__amount {
    color: rgb(var(--gray-50));
}

.credits-balance__amount--unknown {
    color: rgb(var(--gray-400));
}

.credits-balance__note {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
}

/* --------------------------------------------------------------------------
 * Sections
 * ----------------------------------------------------------------------- */

.credits-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.credits-section__header--split {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.credits-section__title {
    font-size: 1rem;
    font-weight: 600;
    color: rgb(var(--gray-950));
}

:is(.dark) .credits-section__title {
    color: rgb(var(--gray-50));
}

.credits-section__lede {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
}

.credits-section__count {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
 * Wallet facts
 * ----------------------------------------------------------------------- */

.credits-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 0.75rem;
    background-color: rgb(0 0 0 / 5%);
}

:is(.dark) .credits-facts {
    border-color: rgb(255 255 255 / 10%);
    background-color: rgb(255 255 255 / 10%);
}

.credits-fact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    background-color: #fff;
}

:is(.dark) .credits-fact {
    background-color: rgb(var(--gray-900));
}

.credits-fact__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(var(--gray-500));
}

.credits-fact__value {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--gray-950));
}

:is(.dark) .credits-fact__value {
    color: rgb(var(--gray-50));
}

/* --------------------------------------------------------------------------
 * Top-up packs
 * ----------------------------------------------------------------------- */

.credits-packs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
}

.credits-pack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 0.75rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

:is(.dark) .credits-pack {
    border-color: rgb(255 255 255 / 10%);
    background-color: rgb(var(--gray-900));
}

.credits-pack--featured {
    border-color: rgb(var(--primary-500) / 40%);
    box-shadow: 0 1px 3px rgb(var(--primary-500) / 20%);
}

.credits-pack__badge {
    align-self: flex-start;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(var(--primary-600));
    background-color: rgb(var(--primary-500) / 10%);
}

.credits-pack__name {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--gray-500));
}

.credits-pack__credits {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
    color: rgb(var(--gray-950));
}

:is(.dark) .credits-pack__credits {
    color: rgb(var(--gray-50));
}

.credits-pack__unit {
    font-size: 0.875rem;
    font-weight: 400;
    color: rgb(var(--gray-500));
}

.credits-pack__summary {
    flex-grow: 1;
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
}

.credits-pack__price {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
}

.credits-pack__action {
    align-self: flex-start;
    margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
 * Usage
 * ----------------------------------------------------------------------- */

.credits-table__scroll {
    overflow-x: auto;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 0.75rem;
    background-color: #fff;
}

:is(.dark) .credits-table__scroll {
    border-color: rgb(255 255 255 / 10%);
    background-color: rgb(var(--gray-900));
}

.credits-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
}

.credits-table th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: start;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    color: rgb(var(--gray-500));
    border-bottom: 1px solid rgb(0 0 0 / 5%);
}

:is(.dark) .credits-table th {
    border-color: rgb(255 255 255 / 10%);
}

.credits-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    vertical-align: top;
    color: rgb(var(--gray-950));
    border-bottom: 1px solid rgb(0 0 0 / 5%);
}

:is(.dark) .credits-table td {
    color: rgb(var(--gray-50));
    border-color: rgb(255 255 255 / 10%);
}

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

.credits-table__numeric {
    text-align: end;
    white-space: nowrap;
}

.credits-table__muted {
    color: rgb(var(--gray-500));
    white-space: nowrap;
}

:is(.dark) .credits-table__muted {
    color: rgb(var(--gray-400));
}

.credits-table__empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: rgb(var(--gray-500));
}

.credits-usage__what {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    max-width: 32rem;
}

.credits-usage__label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    color: rgb(var(--gray-950));
}

:is(.dark) .credits-usage__label {
    color: rgb(var(--gray-50));
}

.credits-usage__icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: rgb(var(--gray-400));
}

.credits-usage__detail {
    font-size: 0.875rem;
    color: rgb(var(--gray-500));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
 * Filters
 * ----------------------------------------------------------------------- */

.credits-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.credits-filter {
    padding: 0.375rem 0.75rem;
    border: 1px solid rgb(0 0 0 / 10%);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--gray-600));
    background-color: #fff;
    cursor: pointer;
}

.credits-filter:hover {
    background-color: rgb(var(--gray-50));
}

:is(.dark) .credits-filter {
    border-color: rgb(255 255 255 / 15%);
    color: rgb(var(--gray-300));
    background-color: rgb(var(--gray-900));
}

:is(.dark) .credits-filter:hover {
    background-color: rgb(var(--gray-800));
}

.credits-filter--active,
.credits-filter--active:hover {
    border-color: transparent;
    color: rgb(var(--primary-600));
    background-color: rgb(var(--primary-500) / 10%);
}

:is(.dark) .credits-filter--active,
:is(.dark) .credits-filter--active:hover {
    color: rgb(var(--primary-400));
    background-color: rgb(var(--primary-500) / 15%);
}
