/*
 * public/assets/css/admin.css | Ultima modifica: 07/05/2026 | v2.0
 *
 * PURPOSE:
 *   Admin panel styles. Loaded ONLY on /admin/* routes alongside
 *   base.css, layout.css and components.css. Two parallel naming
 *   conventions are present:
 *
 *   1. .admin-* prefix — used by the templates committed during
 *      Step 5 (templates/admin/*.php). Covers .admin-body,
 *      .admin-sidebar, .admin-table, .admin-form, .admin-btn,
 *      .admin-flash, etc. These classes are LIVE and rendered today.
 *
 *   2. .admin-shell / .admin-sidebar__logo / .admin-sidebar__link /
 *      .admin-field / .admin-label / .admin-input / .admin-textarea /
 *      .admin-select / .admin-btn--secondary / .flash / .kpi-grid /
 *      .kpi-card — added in Step 8 to match the design hi-fi prompt's
 *      exact class list. They coexist with the live ones so future
 *      template iterations can adopt them without removing rules.
 *
 *   Sidebar background uses the brand accent (#185FA5) instead of the
 *   earlier deep-navy (#0f172a) so the admin chrome shares the public
 *   site palette.
 *
 * DEPENDS ON: base.css (var --color-accent + family), layout.css, components.css
 *
 * CHANGELOG:
 *   - 07/05/2026 v1.0: initial Step 5 implementation (.adm-* prefix).
 *   - 07/05/2026 v1.1: rename .adm-* -> .admin-* across templates + CSS.
 *   - 07/05/2026 v2.0: Step 8 — palette ribrand to accent blue +
 *                     prompt-spec class set added (admin-shell,
 *                     admin-sidebar__logo/nav/link, admin-field/label/
 *                     input/textarea/select, admin-btn--secondary,
 *                     .flash--success/--error, .kpi-grid/.kpi-card).
 */

/* =============================================================================
   BLOCK: Admin layout shell
   Two-column: fixed left sidebar nav + scrollable main content area.
   Variables come from base.css; we only add admin-specific tokens.
   ============================================================================= */

.admin-body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    /* Two-column grid: 240px sidebar + flexible main. The grid lays
       out the body so we don't need flex on .admin-main. */
    display: grid;
    grid-template-columns: 240px 1fr;
}

/* -----------------------------------------------------------------------------
   Sidebar — fixed-width nav rail.
   ----------------------------------------------------------------------------- */
.admin-sidebar {
    /* Step 8: brand accent blue (#185FA5) instead of deep navy.
       Keeps the admin chrome visually consistent with the public site.
       --color-accent / --color-accent-dark come from base.css. */
    background: var(--color-accent, #185FA5);
    color: #ffffff;
    padding: 24px 16px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
}
.admin-sidebar__brand {
    font-size: 20px;
    margin-bottom: 24px;
    line-height: 1.2;
    color: #ffffff;
}
.admin-sidebar__brand small {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}
.admin-sidebar__logout {
    margin-top: auto;
    padding-top: 16px;
}
.admin-sidebar__user {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.3;
}

/* -----------------------------------------------------------------------------
   Sidebar nav links. Active state highlights the current section.
   ----------------------------------------------------------------------------- */
.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.admin-nav__link {
    /* Slightly transparent white so non-active links read as secondary
       against the accent-blue sidebar background. */
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
}
.admin-nav__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.admin-nav__link.is-active {
    /* Darker accent for the active state so it pops against the
       sidebar bg without leaving the brand palette. */
    background: var(--color-accent-dark, #0C447C);
    color: #ffffff;
}

/* -----------------------------------------------------------------------------
   Main content pane.
   ----------------------------------------------------------------------------- */
.admin-main {
    padding: 24px 32px;
    max-width: 1100px;
}
.admin-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.admin-page__header h1 {
    margin: 0;
    font-size: 24px;
}
.admin-empty {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    padding: 24px;
    border-radius: 8px;
    color: #6b7280;
    text-align: center;
}

/* =============================================================================
   BLOCK: Flash messages
   Three severities; one rule + modifier classes.
   ============================================================================= */
.admin-flash {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.admin-flash--success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.admin-flash--error   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.admin-flash--info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.admin-flash--warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.admin-flash ul { margin: 6px 0 0 18px; }

/* =============================================================================
   BLOCK: Tables
   Used by every admin index page (categories, tags, users).
   ============================================================================= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
    vertical-align: middle;
}
.admin-table thead th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 15px;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #f9fafb; }
.admin-table__num     { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table__actions { text-align: right; white-space: nowrap; }
.admin-table code     { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 14px; }

/* =============================================================================
   BLOCK: Forms
   Generic form fields + the inline action-form pattern.
   ============================================================================= */
.admin-form {
    background: #fff;
    padding: 20px 24px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-width: 720px;
}
.admin-form-card {
    background: #fff;
    padding: 16px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 24px;
}
.admin-form__row {
    margin-bottom: 14px;
}
.admin-form__group {
    margin-bottom: 16px;
}
.admin-form__row label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #374151;
}
.admin-form__label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #374151;
}
.admin-form__row input[type="text"],
.admin-form__row input[type="email"],
.admin-form__row input[type="password"],
.admin-form__row input[type="number"],
.admin-form__row input[type="url"],
.admin-form__row input[type="date"],
.admin-form__row select,
.admin-form__row textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
}
.admin-form__input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    color: inherit;
    background: #ffffff;
}
.admin-form__input:focus {
    outline: none;
    border-color: var(--color-accent, #185FA5);
    box-shadow: 0 0 0 3px var(--color-accent-light, #E6F1FB);
}
.admin-form__hint {
    display: block;
    color: #6b7280;
    font-size: 14px;
    margin: 4px 0 0;
}
.admin-form__error {
    color: #b91c1c;
    font-size: 14px;
    margin: 4px 0 0;
}
.admin-form__group--error .admin-form__input {
    border-color: #b91c1c;
}
.admin-form__row textarea {
    resize: vertical;
    min-height: 64px;
}
.admin-form__row small {
    display: block;
    color: #6b7280;
    font-size: 14px;
    margin-top: 4px;
}
.admin-form__check {
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.admin-form__check input { margin: 0; }
/* Gap between two .admin-form__check siblings inside the same row
   (e.g. is_active + featured on the courses form). */
.admin-form__check + .admin-form__check { margin-left: 18px; }
.admin-form__actions {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}
.admin-form-inline {
    display: inline-block;
    margin: 0;
}
/* Inline form variant for the tags index — fields side by side. */
.admin-form--inline .admin-form__row {
    display: inline-block;
    margin-right: 12px;
    vertical-align: middle;
}

/* =============================================================================
   BLOCK: Buttons
   ============================================================================= */
.admin-btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 16px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: var(--color-accent, #185FA5);
    color: #ffffff;
    line-height: 1.2;
    font-family: inherit;
    font-weight: 500;
}
.admin-btn:hover { background: var(--color-accent-dark, #0C447C); }
.admin-btn--primary { background: var(--color-accent, #185FA5); }
.admin-btn--ghost {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}
.admin-btn--ghost:hover { background: #f3f4f6; }
.admin-btn--danger {
    background: #b91c1c;
    color: #fff;
}
.admin-btn--danger:hover { background: #991b1b; }
.admin-btn--small {
    padding: 4px 10px;
    font-size: 14px;
}

/* Status badge variant for the user role column — reuses the existing
   .status-badge token block defined below. */
.status-badge--admin  { background: #ddd6fe; color: #5b21b6; }
.status-badge--editor { background: #bfdbfe; color: #1e40af; }
.status-badge--author { background: #e5e7eb; color: #374151; }

/* =============================================================================
   BLOCK: Status badge
   Article workflow states: draft, review, published.
   ============================================================================= */
.status-badge {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-badge--draft {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge--review {
    background: #fef3c7;
    color: #92400e;
}

.status-badge--published {
    background: #d1fae5;
    color: #065f46;
}

/* =============================================================================
   BLOCK: Step 8 — prompt-spec class set
   Purpose: provide the exact class names listed in the design hi-fi
            prompt (.admin-shell, .admin-sidebar__logo/nav/link,
            .admin-field/.admin-label/.admin-input/.admin-textarea/
            .admin-select, .admin-btn--secondary, .flash--success/
            --error, .kpi-grid/.kpi-card).

   Why duplicate-looking rules: the templates committed during Step 5
   used a slightly different class layout (.admin-form / .admin-form__row
   / generic input selectors). Rather than rewrite seven templates, we
   add the prompt-spec aliases here so future template iterations can
   adopt them immediately. The Step 5 rules stay live for the
   templates currently in use; nothing breaks.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Layout shell — alternative entry point for admin pages.
   .admin-body in the existing templates already produces a 2-col grid.
   .admin-shell is the prompt's preferred name for the same role:
   a flex row holding the sidebar + the main pane.
   ----------------------------------------------------------------------------- */
.admin-shell {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg, #ffffff);
    color: var(--color-text, #1a1a1a);
    font-family: var(--font-main, 'Inter', sans-serif);
}

/* -----------------------------------------------------------------------------
   Sidebar BEM aliases used by the prompt:
     .admin-sidebar__logo  — the brand block at the top
     .admin-sidebar__nav   — the link list
     .admin-sidebar__link  — a single link
     .admin-sidebar__link--active — current section highlight
   The existing rules use .admin-sidebar__brand and .admin-nav__link;
   the duplicates below match the prompt vocabulary 1:1.
   ----------------------------------------------------------------------------- */
.admin-sidebar__logo {
    color: #ffffff;
    font-weight: 600;
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 24px;
}
.admin-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.admin-sidebar__link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 16px;
    display: block;
    transition: background 0.15s, color 0.15s;
}
.admin-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.admin-sidebar__link--active {
    background: var(--color-accent-dark, #0C447C);
    color: #ffffff;
}

/* -----------------------------------------------------------------------------
   Form prompt-spec classes. The existing CSS hangs validation/spacing
   off .admin-form__row + descendant selectors; this block exposes the
   atomic classes the prompt named so a template can use them directly.
   ----------------------------------------------------------------------------- */
.admin-field {
    margin-bottom: 16px;
}
.admin-label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
    font-size: 15px;
}
.admin-input,
.admin-textarea,
.admin-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    color: inherit;
    background: #ffffff;
}
.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
    outline: none;
    border-color: var(--color-accent, #185FA5);
    box-shadow: 0 0 0 3px var(--color-accent-light, #E6F1FB);
}
.admin-textarea {
    min-height: 300px;
    resize: vertical;
    line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Button alias: .admin-btn--secondary. The Step-5 templates use
   .admin-btn--ghost for the same role; alias so the prompt vocabulary
   works too.
   ----------------------------------------------------------------------------- */
.admin-btn--secondary {
    background: transparent;
    color: var(--color-accent, #185FA5);
    border-color: var(--color-accent, #185FA5);
}
.admin-btn--secondary:hover {
    background: var(--color-accent-light, #E6F1FB);
}

/* -----------------------------------------------------------------------------
   Flash messages — short prompt-spec aliases.
   The Step-5 rules use .admin-flash + modifiers (.admin-flash--success,
   .admin-flash--error). The plain .flash family below is functionally
   identical and matches the prompt naming.
   ----------------------------------------------------------------------------- */
.flash {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.flash--success {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}
.flash--error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* -----------------------------------------------------------------------------
   Dashboard KPI cards.
   Used (in a future iteration) to surface the dashboard counters as
   tiles. Today the dashboard renders an inline <ul>; the rules below
   are ready when the template adopts them.
   ----------------------------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--color-accent-border, #B5D4F4);
    border-radius: 8px;
    padding: 16px;
    text-align: left;
}
.kpi-card__number {
    display: block;
    font-size: 30px;
    font-weight: 600;
    color: var(--color-accent, #185FA5);
    line-height: 1;
    margin-bottom: 6px;
}
.kpi-card__label {
    display: block;
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Responsive fallback: drop to 2 cols on narrow viewports so the
   numbers don't squeeze. */
@media (max-width: 720px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================================================
   Pagina di login (admin/layout_auth + admin/login)
   Body centrato senza sidebar: una sola card al centro dello schermo.
   ============================================================================= */
.admin-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--color-accent-light, #E6F1FB);
}

.admin-login {
    width: 100%;
    max-width: 380px;
}

.admin-login__card {
    background: #fff;
    border: 1px solid var(--color-accent-border, #B5D4F4);
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: 0 10px 30px rgba(12, 68, 124, 0.12);
}

.admin-login__brand {
    text-align: center;
    margin-bottom: 8px;
    color: var(--color-accent, #185FA5);
}

.admin-login__brand strong {
    display: block;
    font-size: 20px;
    letter-spacing: -0.01em;
}

.admin-login__brand small {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    color: #6b7280;
}

.admin-login__title {
    text-align: center;
    font-size: 18px;
    margin: 4px 0 20px;
    color: #111827;
}

.admin-login__submit {
    width: 100%;
    margin-top: 8px;
}
