/* Approved PlugHub workspace layout. Keeps the sidebar, typography, mark, and card actions. */
:root {
    --surface-page: #f8f9fb;
    --surface-sidebar: #f3f5f8;
    --surface-border: #e4e8ee;
    --surface-border-hover: #c9d1dd;
    --surface-shadow: none;
    --surface-shadow-hover: none;
    --layout-muted: #687386;
}
html[data-background-theme="dark"] {
    --surface-page: #121722;
    --surface-sidebar: #171e2a;
    --surface-border: #333e50;
    --surface-border-hover: #4b5870;
    --surface-shadow: none;
    --surface-shadow-hover: none;
    --layout-muted: #a3afc2;
}

/* Sidebar dimensions and its original responsive behavior are retained. */
html:root .sidebar .side-nav a,
html:root .side-nav-indicator { border-radius: 9px !important; }
html:root .sidebar .user-area { border-radius: 12px !important; }
html:root .sidebar .ua-pill { border-radius: 7px !important; }
html:root .sidebar .ua-actions { gap: 7px; }
html:root .sidebar .ua-pill { padding-left: 12px; padding-right: 12px; }
html:root .side-logo :is(.brand-word,.brand-letter) {
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--surface-text) !important;
    animation: none !important;
    transform: none !important;
    text-shadow: none !important;
}
html:root .side-logo:hover,
html:root .sidebar .ua-pill:hover { transform: none !important; }

/* The title and utility controls share the catalog's left/right alignment. */
html:root #pageHome > .page-header { margin-bottom: 12px; }
html:root #pageHome > .page-header h1 {
    left: 0;
    font-size: 1.7rem;
    font-weight: 650;
    letter-spacing: -.45px;
}
html:root :is(.favorites-open, .language-trigger, .btn-feedback, .notification-btn) {
    border-radius: 8px !important;
}
html:root #pageHome .header-actions { gap: 10px; }

/* A single quiet metrics strip replaces three large floating surfaces. */
html:root #pageHome .stats-grid {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 0 20px;
    margin: 0 auto 23px;
    border-bottom: 1px solid var(--surface-border);
}
html:root #pageHome .stats-grid .stat-card {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0 24px;
    gap: 9px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    animation: none;
    opacity: 1;
    overflow: visible;
}
html:root #pageHome .stats-grid .stat-card:first-child { padding-left: 0; }
html:root #pageHome .stats-grid .stat-card + .stat-card {
    border-left: 1px solid var(--surface-border) !important;
}
html:root #pageHome .stat-value {
    font-size: 1.08rem;
    font-weight: 650;
    line-height: 1.4;
}
html:root #pageHome .stat-label {
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0;
    color: var(--layout-muted);
}

/* One row for browsing choices, one for search and the primary action. */
.catalog-controls-row {
    max-width: 1100px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.catalog-view-group { display: flex; align-items: center; gap: 16px; min-width: 0; }
html:root .catalog-controls-row #pageInfo { font-size: .72rem; color: var(--layout-muted); white-space: nowrap; }
html:root .catalog-controls-row .plugin-view-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    gap: 2px;
    padding: 3px;
    margin: 0;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-muted);
}
html:root #pageHome .plugin-view-toggle button {
    min-height: 31px;
    padding: 5px 19px;
    border: 1px solid transparent !important;
    border-radius: 5px !important;
    background: transparent !important;
    font-size: .75rem;
    font-weight: 500;
    box-shadow: none !important;
}
html:root #pageHome .plugin-view-toggle button.active {
    background: var(--surface-card) !important;
    border-color: var(--surface-border) !important;
    color: var(--surface-text) !important;
    font-weight: 600;
}
html:root .catalog-controls-row .sort-bar {
    width: auto;
    max-width: none;
    margin: 0;
    gap: 3px;
    flex: 0 1 auto;
    justify-content: flex-end;
}
html:root #pageHome .sort-hint { font-size: .7rem; color: var(--layout-muted); margin-right: 5px; }
html:root #pageHome .sort-bar button {
    padding: 7px 10px;
    border: 0 !important;
    background: transparent !important;
    border-radius: 5px !important;
    box-shadow: none !important;
    color: var(--layout-muted) !important;
    font-size: .72rem;
    font-weight: 400;
}
html:root #pageHome .sort-bar button.active {
    color: var(--surface-text) !important;
    font-weight: 600;
    background: var(--surface-muted) !important;
}
html:root #pageHome .list-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
html:root #pageHome .list-toolbar .search-box {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    height: 48px;
    border-radius: 9px !important;
}
html:root #pageHome .search-box input { min-width: 0; font-size: .8rem; padding-left: 16px; }
html:root #pageHome .search-box button {
    border-radius: 6px !important;
    padding: 6px 19px;
    height: 34px;
    font-size: .75rem;
}
html:root #publishBtn {
    flex: 0 0 auto;
    align-self: center;
    height: 44px;
    padding: 0 24px;
    border-radius: 8px !important;
    font-size: .8rem;
    box-shadow: none !important;
    transform: none !important;
}

/* Keep the same card hierarchy, with a consistent spacing rhythm. */
html:root #pluginGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
html:root #pluginGrid .plugin-card-minimal {
    padding: 22px;
    border-radius: 12px !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
}
html:root #pluginGrid .plugin-card-minimal .plugin-body { gap: 15px; }
html:root #pluginGrid .plugin-card-heading .name { font-size: 1.03rem; font-weight: 600; }
html:root #pluginGrid .plugin-card-minimal .desc { font-size: .82rem; line-height: 1.75; }
html:root #pluginGrid .plugin-card-footer { padding-top: 14px; }
html:root #pluginGrid .plugin-card-footer .download-btn { border-radius: 7px !important; }
html:root #pluginGrid .plugin-card-minimal .plugin-user-name { color: var(--layout-muted); }
html:root #pluginGrid .plugin-card-minimal .meta { color: var(--layout-muted); }
html[data-background-theme="dark"] #pluginGrid .plugin-card-minimal :is(.plugin-user-name,.meta),
html[data-background-theme="dark"] #pageHome .stat-label { color: #a3afc2; }

@media (min-width: 901px) and (max-width: 1250px) {
    html:root #pluginGrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .catalog-controls-row { gap: 9px; }
    .catalog-view-group { gap: 10px; }
    html:root #pageHome .sort-bar button { padding: 7px 6px; font-size: .68rem; }
}
@media (max-width: 900px) {
    html:root #pluginGrid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    html:root #pageHome .stats-grid { padding-bottom: 17px; margin-bottom: 20px; }
    html:root #pageHome .stats-grid .stat-card { flex: 1; padding: 0 15px; }
    html:root #pageHome .stats-grid .stat-card:last-child { padding-right: 0; }
    .catalog-controls-row { gap: 12px; }
}
@media (max-width: 680px) {
    html:root #pluginGrid { grid-template-columns: minmax(0,1fr); }
    .catalog-controls-row { flex-wrap: wrap; gap: 12px; margin-bottom: 13px; }
    .catalog-view-group { width: 100%; justify-content: space-between; gap: 8px; }
    html:root .catalog-controls-row .sort-bar { width: 100%; justify-content: flex-start; }
    html:root #pageHome .list-toolbar { gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
    html:root #pageHome .list-toolbar .search-box { flex-basis: 100%; height: 46px; }
    html:root #publishBtn { height: 39px; padding: 0 19px; font-size: .75rem; }
    html:root #pageHome .stat-label { font-size: .65rem; line-height: 1.5; }
    html:root #pageHome .stat-value { font-size: 1rem; }
    html:root #pageHome .stats-grid .stat-card { padding: 0 10px; gap: 7px; }
    html:root #pageHome .stats-grid .stat-card:first-child { padding-left: 0; }
    html:root #pluginGrid .plugin-card-minimal { padding: 20px; }
    html:root #pageHome > .page-header h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    html:root #pageHome :is(.stat-card,.plugin-card) { animation: none !important; transition: none !important; }
}
