/* ═══════════════════════════════════════════════════════════════════════════
   AgriPlace – Administrator Module CSS
   File: wwwroot/css/administrator.css
   Link in App.razor: <link rel="stylesheet" href="css/administrator.css" />

   All classes use the .adm- prefix (Administrator Module).
   Uses Radzen CSS variables for colours so light/dark theme works.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════════
   SHELL — full-viewport two-column layout
   ══════════════════════════════════════════════════════════════════════════ */
.adm-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--rz-body-background-color);
}

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR — fixed width, never collapses
   ══════════════════════════════════════════════════════════════════════════ */
.adm-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--rz-base-background-color);
    border-right: 1px solid var(--rz-border-disabled-color);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* ── Brand ──────────────────────────────────────────────────────────────── */
.adm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--rz-border-disabled-color);
    flex-shrink: 0;
    text-decoration: none;
}

.adm-sidebar-logo { flex-shrink: 0; text-decoration: none; }

.adm-sidebar-titles {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.adm-sidebar-app {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1;
}

.adm-sidebar-module {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rz-text-title-color);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.adm-sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.adm-nav-section-label {
    padding: 0.75rem 1.1rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--rz-text-disabled-color);
}

.adm-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rz-text-secondary-color);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.adm-nav-item:hover {
    background: var(--rz-base-300);
    color: var(--rz-text-color);
}

.adm-nav-item--active {
    background: color-mix(in srgb, var(--rz-primary) 12%, transparent);
    color: var(--rz-primary);
    font-weight: 700;
    border-left: 3px solid var(--rz-primary);
    padding-left: calc(1.1rem - 3px);
}

.adm-nav-item--active:hover {
    background: color-mix(in srgb, var(--rz-primary) 16%, transparent);
    color: var(--rz-primary);
}

.adm-nav-item--back {
    color: var(--rz-text-disabled-color);
    font-size: 0.82rem;
}

.adm-nav-item--back:hover { color: var(--rz-text-secondary-color); }

.adm-nav-icon {
    font-size: 1.1rem !important;
    width: 20px;
    flex-shrink: 0;
    opacity: 0.75;
}

.adm-nav-item--active .adm-nav-icon,
.adm-nav-item:hover .adm-nav-icon { opacity: 1; }

/* ── Sidebar footer ─────────────────────────────────────────────────────── */
.adm-sidebar-footer {
    border-top: 1px solid var(--rz-border-disabled-color);
    padding: 0.5rem 0;
    flex-shrink: 0;
}

.adm-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
}

.adm-sidebar-username {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════════════════════
   WORKSPACE — takes remaining space; contains header + content
   ══════════════════════════════════════════════════════════════════════════ */
.adm-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Header bar ─────────────────────────────────────────────────────────── */
.adm-header {
    height: 52px;
    flex-shrink: 0;
    background: var(--rz-base-background-color);
    border-bottom: 1px solid var(--rz-border-disabled-color);
    display: flex;
    align-items: center;
}

.adm-header-inner {
    width: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.adm-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rz-text-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.adm-header-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Content area ───────────────────────────────────────────────────────── */
.adm-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    scrollbar-width: thin;
}

/* ══════════════════════════════════════════════════════════════════════════
   STAT CARDS ROW (Administrator dashboard)
   ══════════════════════════════════════════════════════════════════════════ */
.adm-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.adm-stat-card {
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-disabled-color);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.adm-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.adm-stat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.adm-stat-label {
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--rz-text-title-color);
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   QUICK LINKS GRID (Administrator dashboard)
   ══════════════════════════════════════════════════════════════════════════ */
.adm-quick-links {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.adm-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--rz-text-secondary-color);
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rz-border-disabled-color);
}

.adm-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.adm-quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.1rem 0.75rem;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-disabled-color);
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color);
    text-align: center;
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}

.adm-quick-card:hover {
    border-color: var(--rz-primary);
    color: var(--rz-primary);
    background: color-mix(in srgb, var(--rz-primary) 5%, var(--rz-base-background-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — tablet/mobile: sidebar slides or stacks
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .adm-sidebar { width: 200px; }
}

@media (max-width: 680px) {
    .adm-shell { flex-direction: column; height: auto; overflow: auto; }

    .adm-sidebar {
        width: 100%;
        height: auto;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--rz-border-disabled-color);
    }

    .adm-sidebar-nav {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .adm-nav-section-label { display: none; }

    .adm-workspace { overflow: visible; }
    .adm-content { padding: 1rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MANUAL TAB STRIP (replaces RadzenTabs on roles page)
   ══════════════════════════════════════════════════════════════════════════ */
.adm-tab-strip {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--rz-border-disabled-color);
    margin-bottom: .5rem;
}

.adm-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: .6rem 1.25rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color);
    cursor: pointer;
    transition: color .15s, border-color .15s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.adm-tab:hover {
    color: var(--rz-text-color);
    border-bottom-color: var(--rz-border-disabled-color);
}

.adm-tab--active {
    color: var(--rz-primary);
    border-bottom-color: var(--rz-primary);
}

.adm-tab-count {
    background: var(--rz-base-300);
    color: var(--rz-text-secondary-color);
    font-size: .7rem;
    font-weight: 700;
    padding: .1rem .45rem;
    border-radius: 100px;
    min-width: 1.4rem;
    text-align: center;
    line-height: 1.4;
}

.adm-tab--active .adm-tab-count {
    background: color-mix(in srgb, var(--rz-primary) 15%, transparent);
    color: var(--rz-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   COLLAPSIBLE SUBMENU — Support group in the sidebar
   ═══════════════════════════════════════════════════════════════════ */

/* Toggle button — same visual shape as adm-nav-item but with chevron */
.adm-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .75rem;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    color: var(--rz-text-secondary-color);
    text-align: left;
    transition: background .15s, color .15s;
}

.adm-nav-group-toggle:hover {
    background: var(--rz-base-200);
    color: var(--rz-text-color);
}

/* Chevron pushed to the right */
.adm-nav-chevron {
    margin-left: auto;
    font-size: 1.1rem !important;
    transition: transform .2s;
}

.adm-nav-group-toggle--open .adm-nav-chevron {
    transform: rotate(0deg); /* expand_less already points up */
}

/* Submenu container — collapses via max-height transition */
.adm-nav-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}

.adm-nav-submenu--open {
    max-height: 200px; /* large enough for any number of sub-items */
}

/* Submenu items — indented with a left border accent */
.adm-nav-item--sub {
    padding-left: 2.5rem !important;
    font-size: .845rem !important;
    border-left: 2px solid transparent;
    margin-left: .75rem;
    border-radius: 0 6px 6px 0 !important;
}

.adm-nav-item--sub:hover {
    border-left-color: var(--rz-base-400);
}

.adm-nav-item--sub.adm-nav-item--active {
    border-left-color: var(--rz-primary);
}
