/*
 * Tema dei pannelli Watchtower, sullo stile delle console amministrative pulite (riferimento: dashboard Cloudflare,
 * 11/11/2026): fondo grigio chiarissimo, superfici bianche con bordo sottile e senza ombre, sidebar con gruppi e
 * voci compatte, intestazioni di pagina con titolo, descrizione e azioni a destra, tabelle in un contenitore
 * con bordo, badge a pillola. Registrato come asset nei due pannelli (ConfiguresWatchtowerPanel): il CSS
 * precompilato di Filament non ha le utility Tailwind, quindi si agisce sulle classi `fi-*`.
 */

:root {
    --wt-bg: #f7f7f8;
    --wt-surface: #ffffff;
    --wt-sidebar: #fafafa;
    --wt-border: #e4e4e7;
    --wt-border-strong: #d4d4d8;
    --wt-text: #18181b;
    --wt-text-muted: #6b6b76;
    --wt-hover: #f1f1f3;
    --wt-active: #ececef;
    --wt-radius-lg: 0.75rem;
    --wt-radius-md: 0.5rem;
}

.dark {
    --wt-bg: #0f0f11;
    --wt-surface: #18181b;
    --wt-sidebar: #131316;
    --wt-border: #2a2a2f;
    --wt-border-strong: #3a3a40;
    --wt-text: #f4f4f5;
    --wt-text-muted: #a1a1aa;
    --wt-hover: #1f1f23;
    --wt-active: #26262b;
}

/* ---------------------------------------------------------------- Struttura */

.fi-body {
    background-color: var(--wt-bg);
    color: var(--wt-text);
    -webkit-font-smoothing: antialiased;
}

.fi-topbar,
.fi-topbar > nav {
    background-color: var(--wt-sidebar);
    box-shadow: none;
    border-bottom: 1px solid var(--wt-border);
}

.fi-main {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* ------------------------------------------------------------------ Sidebar */

.fi-sidebar {
    background-color: var(--wt-sidebar);
    border-inline-end: 1px solid var(--wt-border);
}

.fi-sidebar-header {
    background-color: var(--wt-sidebar);
    box-shadow: none;
    border-bottom: 1px solid var(--wt-border);
}

.fi-sidebar-header-controls {
    padding-inline: 1rem;
    padding-top: 0.75rem;
}

.fi-sidebar-nav {
    padding-inline: 1rem;
    padding-top: 0.75rem;
    row-gap: 0.25rem;
}

.fi-sidebar-nav-groups {
    row-gap: 1.25rem;
}

.fi-sidebar-group-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--wt-text-muted);
    letter-spacing: 0;
}

.fi-sidebar-item-btn {
    border-radius: var(--wt-radius-md);
    padding-block: 0.45rem;
    font-size: 0.9375rem;
    color: var(--wt-text);
}

.fi-sidebar-item-btn:hover {
    background-color: var(--wt-hover);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item-btn.fi-active {
    background-color: var(--wt-active);
}

.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-icon {
    color: var(--wt-text);
    font-weight: 600;
}

.fi-sidebar-item .fi-icon {
    color: var(--wt-text-muted);
}

.fi-sidebar-footer {
    border-top: 1px solid var(--wt-border);
}

/* Marchio e selettore dell'area di lavoro in testa alla sidebar */
.wt-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.wt-brand-mark {
    display: inline-flex;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--color-primary-600, #2563eb);
}

.fi-logo-text,
.wt-workspace {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.25rem 0.5rem;
    border-radius: var(--wt-radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--wt-text);
    white-space: nowrap;
}

.fi-logo-text span,
.wt-workspace span {
    overflow: hidden;
    text-overflow: ellipsis;
}

button.fi-logo-text,
button.wt-workspace {
    cursor: pointer;
}

button.fi-logo-text:hover,
button.wt-workspace:hover {
    background-color: var(--wt-hover);
}

.wt-workspace-icon {
    display: block;
    height: 1.75rem;
    max-width: 9rem;
    object-fit: contain;
}

.wt-workspace svg {
    width: 1rem;
    height: 1rem;
    color: var(--wt-text-muted);
}

/* --------------------------------------------------------------- Intestazioni */

.fi-header {
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--wt-border);
}

.fi-header-heading {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--wt-text);
}

.fi-header-subheading {
    margin-top: 0.375rem;
    font-size: 0.9375rem;
    color: var(--wt-text-muted);
    max-width: 52rem;
}

.fi-breadcrumbs {
    font-size: 0.875rem;
}

/* --------------------------------------------------------- Superfici e sezioni */

.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-in-entry-wrp .fi-section {
    background-color: var(--wt-surface);
    border-radius: var(--wt-radius-lg);
    box-shadow: none;
    --tw-ring-color: var(--wt-border);
    border: 1px solid var(--wt-border);
}

.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat {
    --tw-ring-shadow: 0 0 #0000;
}

.fi-section-header {
    padding-block: 1rem;
}

.fi-section-header-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wt-text);
}

.fi-section-header-description {
    color: var(--wt-text-muted);
}

/* ------------------------------------------------------------------- Tabelle */

.fi-ta-header-cell,
.fi-ta-actions-header-cell,
.fi-ta-empty-header-cell {
    background-color: var(--wt-sidebar);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wt-text-muted);
}

.fi-ta-row {
    transition: background-color 120ms ease;
}

.fi-ta-row:hover {
    background-color: var(--wt-hover);
}

.fi-ta-cell {
    font-size: 0.9375rem;
}

.fi-ta-empty-state {
    padding-block: 3.5rem;
}

.fi-ta-empty-state-heading {
    font-size: 1.125rem;
    font-weight: 600;
}

/* --------------------------------------------------------- Badge e pulsanti */

.fi-badge {
    border-radius: 9999px;
    font-weight: 500;
}

.fi-btn {
    border-radius: var(--wt-radius-md);
    font-weight: 500;
}

.fi-btn.fi-color-gray,
.fi-btn.fi-outlined {
    background-color: var(--wt-surface);
    border: 1px solid var(--wt-border-strong);
    box-shadow: none;
}

.fi-input-wrp {
    border-radius: var(--wt-radius-md);
    box-shadow: none;
}

/* -------------------------------------------------------- Statistiche (KPI) */

.fi-wi-stats-overview-stat {
    padding: 1.25rem 1.5rem 1.75rem;
}

.fi-wi-stats-overview-stat-label {
    color: var(--wt-text-muted);
}

.fi-wi-stats-overview-stat-value {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ------------------------------------------------------------ Login (simple) */

.fi-simple-layout {
    background-color: var(--wt-surface);
}

.fi-simple-main {
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    background: transparent;
}

.fi-simple-header-heading {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ------------------------------------------------- Componenti di Watchtower */

/* Schede d'azione: icona, titolo, descrizione, freccia (pagine di avvio e panoramica). */
.wt-action-cards {
    display: grid;
    gap: 0.875rem;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.wt-action-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.375rem;
    background-color: var(--wt-surface);
    border: 1px solid var(--wt-border);
    border-radius: var(--wt-radius-lg);
    color: var(--wt-text);
    transition: border-color 120ms ease, background-color 120ms ease;
}

.wt-action-card:hover {
    border-color: var(--wt-border-strong);
    background-color: var(--wt-hover);
}

.wt-action-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--wt-border);
    border-radius: var(--wt-radius-md);
    color: var(--wt-text-muted);
    background-color: var(--wt-surface);
}

.wt-action-card-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.wt-action-card-body {
    flex: 1;
    min-width: 0;
}

.wt-action-card-title {
    font-weight: 600;
    font-size: 0.9875rem;
}

.wt-action-card-description {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--wt-text-muted);
}

.wt-action-card-arrow {
    width: 1rem;
    height: 1rem;
    margin-top: 0.25rem;
    color: var(--wt-text-muted);
}

/* Riepilogo testuale a righe con icona (come il «Riepilogo» delle panoramiche). */
.wt-summary {
    display: grid;
    gap: 1rem 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.wt-summary-row {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    font-size: 0.9375rem;
    color: var(--wt-text);
}

.wt-summary-row svg {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    color: var(--wt-text-muted);
}

.wt-summary-row strong {
    font-weight: 600;
}

/* Avviso in linea (giallo tenue, come «Seleziona un dominio per continuare») */
.wt-callout {
    padding: 0.875rem 1.125rem;
    border-radius: var(--wt-radius-lg);
    background-color: #fdf6e3;
    color: #8a5a00;
    font-size: 0.9375rem;
}

.dark .wt-callout {
    background-color: #2b2412;
    color: #f2c46b;
}

.wt-callout-info {
    background-color: #eef4ff;
    color: #1d4ed8;
}

.dark .wt-callout-info {
    background-color: #142038;
    color: #93b4ff;
}

/* Pallino di stato davanti a un'etichetta (● Attiva) */
.wt-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-inline-end: 0.375rem;
    border-radius: 9999px;
    background-color: currentColor;
    vertical-align: middle;
}

/* Marchio e area di lavoro nella topbar, sopra la sidebar */
.fi-topbar-start .wt-brand,
.fi-topbar .wt-brand {
    margin-inline-end: 1rem;
}

.wt-brand-link {
    display: inline-flex;
}

.fi-topbar .fi-logo,
.fi-sidebar-header-logo-ctn {
    display: none;
}

/* Radar affiancati nella pagina del monitoraggio */
.wt-radars {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.wt-radar {
    margin: 0;
    text-align: center;
}

.wt-radar svg {
    width: 100%;
    max-width: 28rem;
    height: auto;
}

.wt-radar-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

/* Periodo in testa alla pagina del monitoraggio */
.wt-period {
    margin-bottom: 0.5rem;
}

/* In tema scuro il radar tiene il fondo chiaro della stampa: i colori del design system (blu notte) non si leggono sul nero */
.dark .wt-radar svg {
    background-color: #ffffff;
    border-radius: var(--wt-radius-lg);
    padding: 0.5rem;
}

/* Nelle pagine elenco la briciola «Risorsa › Lista» ripete il titolo: si nasconde. */
.fi-resource-list-records-page .fi-breadcrumbs {
    display: none;
}

/* --------------------------------------------------------------- Tema chiaro/scuro nella barra in alto */

.wt-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--wt-radius-md);
    color: var(--wt-text-muted);
    cursor: pointer;
}

.wt-theme-toggle:hover {
    background-color: var(--wt-hover);
}

.wt-theme-toggle span,
.wt-theme-toggle svg {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
}

/* --------------------------------------------------------------- Stato dell'ambiente (Admin) */

.wt-env-list {
    display: flex;
    flex-direction: column;
}

.wt-env-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--wt-border, rgba(127, 127, 127, 0.15));
}

.wt-env-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.wt-env-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.wt-env-ok { color: var(--color-success-600, #16a34a); }
.wt-env-warning { color: var(--color-warning-500, #f59e0b); }
.wt-env-error { color: var(--color-danger-600, #dc2626); }

.wt-env-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.wt-env-detail {
    color: var(--wt-text-muted);
    font-size: 0.875rem;
    word-break: break-word;
}

.wt-env-fix {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* --------------------------------------------------------------- Anteprima dei post social nella lettura della menzione */

.wt-embed {
    display: flex;
    justify-content: center;
}

.wt-embed iframe {
    width: 100%;
    max-width: 34rem;
    border: 0;
    border-radius: var(--wt-radius-md);
    background: #fff;
}

.wt-embed-youtube iframe {
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    background: #000;
}

.wt-mention-fulltext {
    max-height: 24rem;
    overflow-y: auto;
    white-space: pre-line;
}

.wt-env-report-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.wt-env-report-text {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--wt-border, rgba(127, 127, 127, 0.25));
    border-radius: var(--wt-radius-md);
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre;
    resize: vertical;
}

/* --------------------------------------------------------------- Piè di pagina */

.wt-footer {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--wt-text-muted);
}
