/* PsOne Shared UI System
   -----------------------------------------------------------------------------
   Objetivo: centralizar estilos comunes de layout, paginas, paneles, toolbar,
   cards, tablas y comportamiento mobile-first para reducir CSS dentro de .razor.
   No debe contener estilos especificos de una sola pagina salvo patrones reutilizables.
*/

:root {
    --ps-appbar-height: 64px;
    --ps-sidebar-width: 248px;
    --ps-mobile-bottom-nav-height: 64px;

    --ps-color-bg: #f8fafc;
    --ps-color-surface: #ffffff;
    --ps-color-border: #dfe5ef;
    --ps-color-border-soft: #e5e7eb;
    --ps-color-text: #192742;
    --ps-color-muted: #64748b;
    --ps-color-primary: #1f8f4d;
    --ps-color-primary-soft: rgba(31, 143, 77, 0.10);

    --ps-radius-sm: 8px;
    --ps-radius-md: 12px;
    --ps-radius-lg: 16px;
    --ps-radius-pill: 999px;

    --ps-shadow-soft: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --ps-shadow-panel: 0 8px 24px rgba(15, 23, 42, 0.06);

    --ps-page-padding-x: 16px;
    --ps-page-padding-y: 12px;
}

/* -------------------------------------------------------------------------- */
/* Page shell                                                                 */
/* -------------------------------------------------------------------------- */

.ps-page {
    padding: var(--ps-page-padding-y) var(--ps-page-padding-x);
    min-width: 0;
}

.ps-page-full {
    padding: 0;
    min-width: 0;
}

.ps-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    min-width: 0;
}

.ps-page-title-block {
    min-width: 0;
}

.ps-page-title {
    font-weight: 800;
    color: var(--mud-palette-primary);
    line-height: 1.15;
}

.ps-page-subtitle {
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}

.ps-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* -------------------------------------------------------------------------- */
/* Panels, cards and sections                                                 */
/* -------------------------------------------------------------------------- */

.ps-panel {
    background: var(--ps-color-surface);
    border: 1px solid var(--ps-color-border);
    border-radius: var(--ps-radius-md);
    box-shadow: var(--ps-shadow-soft);
}

.ps-panel-pad {
    padding: 16px;
}

.ps-panel-pad-sm {
    padding: 10px;
}

.ps-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ps-color-border-soft);
}

.ps-card {
    background: var(--ps-color-surface);
    border: 1px solid var(--ps-color-border);
    border-radius: var(--ps-radius-md);
    box-shadow: var(--ps-shadow-soft);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ps-card:hover {
    border-color: rgba(var(--mud-palette-primary-rgb), 0.45);
    box-shadow: var(--ps-shadow-panel);
}

.ps-card-pad {
    padding: 14px;
}

/* -------------------------------------------------------------------------- */
/* Toolbars and filters                                                       */
/* -------------------------------------------------------------------------- */

.ps-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.ps-toolbar-left,
.ps-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.ps-toolbar-right {
    justify-content: flex-end;
}

.ps-search {
    min-width: 240px;
    flex: 1 1 260px;
}

.ps-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px;
}

/* -------------------------------------------------------------------------- */
/* Tables and responsive lists                                                */
/* -------------------------------------------------------------------------- */

.ps-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.ps-desktop-only {
    display: block;
}

.ps-mobile-only {
    display: none;
}

.ps-mobile-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.ps-list-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--ps-color-border-soft);
}

.ps-list-row-content {
    flex: 1;
    min-width: 0;
}

.ps-list-row-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* Common badges and status helpers                                           */
/* -------------------------------------------------------------------------- */

.ps-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--ps-color-border);
    border-radius: var(--ps-radius-pill);
    background: var(--ps-color-surface);
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ps-color-muted);
    white-space: nowrap;
}

.ps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ps-color-primary);
    flex: 0 0 auto;
}

.ps-text-muted {
    color: var(--mud-palette-text-secondary) !important;
}

.ps-truncate {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* Mobile helpers                                                             */
/* -------------------------------------------------------------------------- */

.ps-mobile-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--ps-mobile-bottom-nav-height) + 21px);
    z-index: 1000;
}

.ps-mobile-sticky-actions {
    position: sticky;
    bottom: var(--ps-mobile-bottom-nav-height);
    z-index: 20;
    background: var(--ps-color-surface);
    border-top: 1px solid var(--ps-color-border);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

@media (max-width: 960px) {
    :root {
        --ps-page-padding-x: 8px;
        --ps-page-padding-y: 8px;
    }

    .ps-page {
        padding: var(--ps-page-padding-y) var(--ps-page-padding-x);
    }

    .ps-page-header {
        align-items: flex-start;
        margin-bottom: 10px;
        gap: 10px;
    }

    .ps-page-actions {
        gap: 6px;
    }

    .ps-panel {
        border-radius: var(--ps-radius-sm);
        box-shadow: none;
    }

    .ps-panel-pad,
    .ps-card-pad {
        padding: 10px;
    }

    .ps-toolbar {
        align-items: stretch;
    }

    .ps-toolbar-left,
    .ps-toolbar-right {
        width: 100%;
    }

    .ps-toolbar-right {
        justify-content: flex-start;
    }

    .ps-search {
        min-width: 0;
        flex-basis: 100%;
        width: 100%;
    }

    .ps-desktop-only {
        display: none !important;
    }

    .ps-mobile-only {
        display: block !important;
    }

    .ps-list-row {
        padding: 10px 8px;
    }
}
