/* Sorting Styles */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.02);
}

th.sortable .sort-icon {
    margin-left: 4px;
    opacity: 0.4;
    transition: var(--transition-fast);
}

th.sortable.active-asc .sort-icon,
th.sortable.active-desc .sort-icon {
    opacity: 1;
    color: var(--accent-color);
}

th.sortable.active-asc .sort-icon::before {
    content: "\f0de";
    /* fa-sort-up */
}

th.sortable.active-desc .sort-icon::before {
    content: "\f0dd";
    /* fa-sort-down */
}

.grid-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-color);
    padding: 6px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.grid-sort-wrapper.d-none {
    display: none !important;
}

/* 17" MacBook Pro and high-res screen responsive scaling */
@media screen and (min-width: 1400px) {

    /* Mimic the user's preferred "67% Zoom" feeling by scaling down the UI */
    .app-container {
        zoom: 0.8;
        /* Adjusted from 0.67 to make it less compact */
        height: calc(100vh / 0.8);
        /* Fix viewport height when zoomed */
        padding-bottom: 40px;
    }
}

/* Small Laptops (e.g., 1366x768) */
@media screen and (max-width: 1399px) {
    .app-container {
        zoom: 0.8;
        /* Scale down UI to fit small screens */
        height: calc(100vh / 0.8);
    }
}
/* ------------------------------------------------------------------ *
 *  Build / Total Surface column switcher
 *
 *  Sits inside the sortable <th>, so the caret is a separate hit target —
 *  clicking it opens the chooser instead of re-sorting the column.
 * ------------------------------------------------------------------ */
th.area-metric-th {
    position: relative;
    white-space: nowrap;
}

.area-metric-toggle {
    background: none;
    border: none;
    padding: 0 2px 0 4px;
    margin: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.45;
    font-size: inherit;
    line-height: 1;
    transition: var(--transition-fast);
}

.area-metric-toggle:hover,
.area-metric-toggle[aria-expanded="true"] {
    opacity: 1;
    color: var(--primary-color);
}

.area-metric-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    min-width: 172px;
    margin-top: 4px;
    padding: 4px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.area-metric-option {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: none;
    text-align: left;
    font: inherit;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-color, #333);
    cursor: pointer;
}

.area-metric-option:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.area-metric-option.is-active {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.04);
}

.area-metric-option.is-active::after {
    content: "\2713";
    float: right;
    margin-left: 10px;
}
