/* AG Grid v33 uses the Theming API (styles injected via JS) — no CSS file imports needed */

/* AbStack/Bootstrap variable overrides for AG Grid */
.ag-theme-quartz {
    --ag-header-background-color: var(--bs-light);
    --ag-border-color: var(--bs-border-color);
    --ag-row-hover-color: rgba(0, 0, 0, 0.04);
    --ag-font-size: 0.875rem;
    --ag-cell-horizontal-padding: 1rem;
    --ag-row-height: 46px;
    --ag-header-height: 42px;
    --ag-font-family: inherit;
    --ag-wrapper-border-radius: 0.5rem;
}

/* Search input — matches existing gridjs-search look */
.aggrid-search-input {
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    max-width: 400px;
    width: 100%;
    display: block;
}

.aggrid-search-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
    outline: 0;
}

/* Pagination — tighten up the panel */
.ag-paging-panel {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    padding: 0.5rem 1rem;
}

/* Mobile stacked content classes (used in cell renderers) */
.mobile-stacked-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-stacked-content .mobile-primary {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bs-primary);
}

.mobile-stacked-content .mobile-secondary {
    font-size: 0.85rem;
    color: var(--bs-body-color);
}

.mobile-stacked-content .mobile-meta {
    font-size: 0.8rem;
    color: var(--bs-secondary);
}

/* Legacy PO-specific stacked classes */
.mobile-stacked-content .po-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bs-primary);
}

.mobile-stacked-content .vendor-name {
    font-size: 0.85rem;
    color: var(--bs-body-color);
}

.mobile-stacked-content .project-name {
    font-size: 0.8rem;
    color: var(--bs-secondary);
    font-style: italic;
}

/* Mobile tab navigation — vertical stacked tabs in card headers */
@media (max-width: 767.98px) {
    .card-header .nav-tabs {
        flex-direction: column;
        border-bottom: none;
        gap: 0.25rem;
    }

    .card-header .nav-tabs .nav-item {
        width: 100%;
    }

    .card-header .nav-tabs .nav-link {
        border-radius: 0.375rem !important;
        border: 1px solid var(--bs-border-color);
        width: 100%;
        text-align: left;
    }

    .card-header .nav-tabs .nav-link.active {
        background-color: var(--bs-primary);
        border-color: var(--bs-primary);
        color: #fff;
    }

    .card-header .nav-tabs .nav-link:not(.active):hover {
        background-color: var(--bs-gray-100);
        border-color: var(--bs-border-color);
    }
}

/* Mobile page header action buttons — full width stacked on small screens */
@media (max-width: 575.98px) {
    .page-header-actions {
        width: 100%;
        flex-direction: column !important;
    }

    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* Align cell content vertically */
.ag-cell-wrapper {
    align-items: center;
}

/* Clip text cells — AG Grid default, reinforced here */
.ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action/badge columns: opt-in overflow so buttons and badges don't clip */
.ag-cell.ag-cell-actions {
    overflow: visible;
}

/* Normalize action buttons within AG Grid cells */
.ag-cell .btn {
    vertical-align: middle;
    line-height: 1.5;
}

.ag-cell form {
    display: inline;
    margin: 0;
    padding: 0;
}

.ag-cell form .btn {
    vertical-align: middle;
}
