/*
 * TERRADIRETTA PREMIUM SHELL
 * Global Filament panel overrides: sidebar, topbar, header
 * Targets fi-* native class names from Filament Panels v3
 */

/* ═══════════════════════════════════════════════════════════
   PRIMARY COLOR — override Filament Amber → Emerald tokens
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — elegant sage / green editorial palette
   ═══════════════════════════════════════════════════════════ */
.fi-sidebar {
    background: linear-gradient(180deg, #f7fbf8 0%, #eef6f1 55%, #f7fbf8 100%) !important;
    border-right: 1px solid rgba(6, 95, 70, 0.08) !important;
    box-shadow: 2px 0 28px -18px rgba(6, 95, 70, 0.14) !important;
}

.fi-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent 0%, rgba(6, 95, 70, 0.08) 30%, rgba(6, 95, 70, 0.08) 70%, transparent 100%);
    pointer-events: none;
}

/* Large screens */
@media (min-width: 1024px) {
    .fi-sidebar {
        background: linear-gradient(180deg, #f7fbf8 0%, #eef6f1 55%, #f7fbf8 100%) !important;
    }
}

.dark .fi-sidebar {
    background: linear-gradient(180deg, #0d1714 0%, #101d19 55%, #0d1714 100%) !important;
    border-right: 1px solid rgba(110, 231, 183, 0.08) !important;
    box-shadow: 2px 0 32px -18px rgba(0, 0, 0, 0.48) !important;
}

.dark .fi-sidebar::after {
    background: linear-gradient(180deg, transparent 0%, rgba(110, 231, 183, 0.10) 30%, rgba(110, 231, 183, 0.10) 70%, transparent 100%);
}

/* ── Sidebar header (logo area) ─────────────────────────── */
.fi-sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(6, 95, 70, 0.08) !important;
    box-shadow: none !important;
    /* override ring-1 */
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-shadow: none !important;
}

.dark .fi-sidebar-header {
    border-bottom-color: rgba(110, 231, 183, 0.08) !important;
}

/* ── Sidebar scroll area ────────────────────────────────── */
.fi-sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 95, 70, 0.14) transparent;
}

.dark .fi-sidebar-nav {
    scrollbar-color: rgba(110, 231, 183, 0.12) transparent;
}

/* ── Group label ────────────────────────────────────────── */
.fi-sidebar-group-button {
    color: rgba(6, 95, 70, 0.46) !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.13em !important;
    text-transform: uppercase !important;
}

.fi-sidebar-group-button svg {
    color: rgba(6, 95, 70, 0.34) !important;
}

.dark .fi-sidebar-group-button {
    color: rgba(167, 243, 208, 0.38) !important;
}

.dark .fi-sidebar-group-button svg {
    color: rgba(167, 243, 208, 0.28) !important;
}

/* ── Nav items text + bg ────────────────────────────────── */
.fi-sidebar-item-button {
    color: rgba(15, 23, 42, 0.74) !important;
    border-radius: 0.7rem !important;
    transition: background 150ms ease, color 150ms ease !important;
}

.dark .fi-sidebar-item-button {
    color: rgba(226, 232, 240, 0.76) !important;
}

.fi-sidebar-item-button:hover,
.fi-sidebar-item-button:focus-visible {
    background: rgba(5, 150, 105, 0.08) !important;
    color: #064e3b !important;
}

.dark .fi-sidebar-item-button:hover,
.dark .fi-sidebar-item-button:focus-visible {
    background: rgba(110, 231, 183, 0.07) !important;
    color: #ecfdf5 !important;
}

/* Override Filament's default active bg (bg-gray-100 / dark:bg-white/5) */
.fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background: linear-gradient(135deg, rgba(209, 250, 229, 0.9) 0%, rgba(236, 253, 245, 0.96) 100%) !important;
    color: #065f46 !important;
    box-shadow:
        inset 0 0 0 1px rgba(6, 95, 70, 0.10),
        0 4px 14px -10px rgba(6, 95, 70, 0.26) !important;
}

.dark .fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.34) 0%, rgba(15, 118, 110, 0.18) 100%) !important;
    color: #d1fae5 !important;
    box-shadow:
        inset 0 0 0 1px rgba(110, 231, 183, 0.12),
        0 4px 14px -10px rgba(0, 0, 0, 0.4) !important;
}

/* Active item label text */
.fi-sidebar-item.fi-active .fi-sidebar-item-label {
    color: #065f46 !important;
    font-weight: 600 !important;
}

.dark .fi-sidebar-item.fi-active .fi-sidebar-item-label {
    color: #d1fae5 !important;
}

/* ── Icons ──────────────────────────────────────────────── */
.fi-sidebar-item-icon {
    color: rgba(6, 95, 70, 0.42) !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: #047857 !important;
}

.dark .fi-sidebar-item-icon {
    color: rgba(167, 243, 208, 0.34) !important;
}

.dark .fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: #6ee7b7 !important;
}

/* ── Sidebar footer (user account area, if any) ─────────── */
.fi-sidebar-nav+div,
.fi-sidebar footer {
    border-top: 1px solid rgba(6, 95, 70, 0.08) !important;
}

.dark .fi-sidebar-nav+div,
.dark .fi-sidebar footer {
    border-top-color: rgba(110, 231, 183, 0.08) !important;
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR — light: white + green accent  /  dark: near-black
   ═══════════════════════════════════════════════════════════ */
.fi-topbar>nav {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(6, 95, 70, 0.10) !important;
    box-shadow: 0 1px 18px -10px rgba(6, 95, 70, 0.10), 0 0 0 1px transparent !important;
    --tw-ring-shadow: 0 0 #0000 !important;
}

.dark .fi-topbar>nav {
    background: #0b1311 !important;
    border-bottom: 1px solid rgba(110, 231, 183, 0.10) !important;
    box-shadow: 0 1px 24px -12px rgba(0, 0, 0, 0.4) !important;
}

.fi-topbar-item-button:hover,
.fi-topbar-item-button:focus-visible {
    background: rgba(5, 150, 105, 0.06) !important;
}

.dark .fi-topbar-item-button:hover,
.dark .fi-topbar-item-button:focus-visible {
    background: rgba(110, 231, 183, 0.06) !important;
}

.fi-topbar-item.fi-active .fi-topbar-item-button {
    background: rgba(5, 150, 105, 0.08) !important;
}

.dark .fi-topbar-item.fi-active .fi-topbar-item-button {
    background: rgba(110, 231, 183, 0.08) !important;
}

.fi-topbar-item-icon,
.fi-topbar-group-toggle-icon {
    color: rgba(6, 95, 70, 0.44) !important;
}

.dark .fi-topbar-item-icon,
.dark .fi-topbar-group-toggle-icon {
    color: rgba(167, 243, 208, 0.34) !important;
}

.fi-topbar-item.fi-active .fi-topbar-item-icon,
.fi-topbar-item.fi-active .fi-topbar-group-toggle-icon,
.fi-topbar-item.fi-active .fi-topbar-item-label {
    color: #047857 !important;
}

.dark .fi-topbar-item.fi-active .fi-topbar-item-icon,
.dark .fi-topbar-item.fi-active .fi-topbar-group-toggle-icon,
.dark .fi-topbar-item.fi-active .fi-topbar-item-label {
    color: #a7f3d0 !important;
}

.fi-topbar-item-label {
    color: rgba(15, 23, 42, 0.76) !important;
}

.dark .fi-topbar-item-label {
    color: rgba(226, 232, 240, 0.76) !important;
}

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER — title + breadcrumb
   ═══════════════════════════════════════════════════════════ */
.fi-header {
    border-bottom: 1px solid rgba(6, 95, 70, 0.10) !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.25rem !important;
}

.dark .fi-header {
    border-bottom-color: rgba(110, 231, 183, 0.08) !important;
}

/* Page title gradient */
.fi-header-heading {
    font-weight: 800 !important;
    letter-spacing: -0.025em !important;
    background: linear-gradient(130deg, #065f46 0%, #059669 55%, #0d9488 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dark .fi-header-heading {
    background: linear-gradient(130deg, #6ee7b7 0%, #34d399 55%, #2dd4bf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Page subtitle */
.fi-header-subheading {
    color: rgba(6, 95, 70, 0.65) !important;
    font-size: 0.8125rem !important;
}

.dark .fi-header-subheading {
    color: rgba(110, 231, 183, 0.50) !important;
}

/* Breadcrumbs */
.fi-breadcrumbs-item-label {
    color: rgba(6, 95, 70, 0.60) !important;
}

.dark .fi-breadcrumbs-item-label {
    color: rgba(110, 231, 183, 0.50) !important;
}

.fi-breadcrumbs-separator {
    color: rgba(6, 95, 70, 0.35) !important;
}

.dark .fi-breadcrumbs-separator {
    color: rgba(110, 231, 183, 0.30) !important;
}

/* ═══════════════════════════════════════════════════════════
   MAIN LAYOUT BACKGROUND
   ═══════════════════════════════════════════════════════════ */

/* Light mode: very faint green tint on page canvas */
.fi-body {
    background-color: #f6fdf9 !important;
}

/* Dark mode: deep near-black green */
.dark .fi-body {
    background-color: #030a08 !important;
}

/* ═══════════════════════════════════════════════════════════
   USER MENU DROPDOWN
   ═══════════════════════════════════════════════════════════ */
.fi-dropdown-panel {
    border: 1px solid rgba(16, 185, 129, 0.18) !important;
    box-shadow: 0 12px 32px -10px rgba(5, 150, 105, 0.22) !important;
}

.dark .fi-dropdown-panel {
    border-color: rgba(52, 211, 153, 0.18) !important;
    background: #061510 !important;
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL FORM COMPACTION
   Reduce spacing and visual density across all Filament forms
   ═══════════════════════════════════════════════════════════ */

/* Keep all content slightly narrower for better scanability. */
.fi-main {
    max-width: 1360px !important;
}

.fi-form {
    gap: 1rem !important;
}

.fi-fo-component-ctn {
    gap: 1rem !important;
}

.fi-section {
    border-radius: 0.9rem !important;
}

.fi-section-header {
    gap: 0.45rem !important;
    padding: 0.95rem 1.1rem !important;
}

.fi-section-content {
    padding: 0.95rem 1.1rem !important;
}

.fi-section-footer {
    padding: 0.75rem 1.1rem !important;
}

.fi-fo-field-wrp {
    gap: 0.35rem !important;
}

.fi-fo-field-wrp-label {
    font-size: 0.79rem !important;
    line-height: 1.15rem !important;
    font-weight: 600 !important;
}

.fi-fo-field-wrp-helper-text,
.fi-fo-field-wrp-error-message,
.fi-fo-field-wrp-hint {
    font-size: 0.75rem !important;
    line-height: 1.1rem !important;
}

.fi-input-wrp {
    min-height: 2.35rem !important;
    border-radius: 0.65rem !important;
}

.fi-input-wrp-prefix {
    gap: 0.45rem !important;
    padding-left: 0.65rem !important;
}

.fi-input-wrp-suffix {
    gap: 0.45rem !important;
    padding-right: 0.65rem !important;
}

.fi-input-wrp-input input,
.fi-input-wrp-input textarea,
.fi-select-input,
.fi-fo-date-time-picker-display-text-input {
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
}

.fi-select-input {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.fi-fo-date-time-picker-display-text-input {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}

.fi-input-wrp-input textarea {
    min-height: 7.5rem !important;
}

.fi-fo-markdown-editor,
.fi-fo-rich-editor {
    padding: 0.65rem 0.75rem !important;
}

.fi-fo-rich-editor-editor {
    min-height: 10rem !important;
}

.fi-fo-repeater,
.fi-fo-simple-repeater,
.fi-fo-builder {
    gap: 0.75rem !important;
}

.fi-fo-repeater-item-header,
.fi-fo-builder-item-header {
    padding: 0.65rem 0.85rem !important;
}

.fi-fo-repeater-item-content {
    padding: 0.85rem !important;
}

.fi-form-actions {
    margin-top: 0.25rem !important;
}

/* Resource pages (anagrafiche, magazzini, create/edit forms): tighter canvas */
.fi-resource-list-records-page .fi-main {
    max-width: 1320px !important;
}

.fi-resource-create-record-page .fi-main,
.fi-resource-edit-record-page .fi-main {
    max-width: 1240px !important;
}

.fi-resource-create-record-page .fi-form,
.fi-resource-edit-record-page .fi-form {
    gap: 0.85rem !important;
}

.fi-resource-create-record-page .fi-section-header,
.fi-resource-edit-record-page .fi-section-header {
    padding: 0.85rem 1rem !important;
}

.fi-resource-create-record-page .fi-section-content,
.fi-resource-edit-record-page .fi-section-content {
    padding: 0.85rem 1rem !important;
}

.fi-resource-create-record-page .fi-input-wrp,
.fi-resource-edit-record-page .fi-input-wrp {
    min-height: 2.2rem !important;
}

@media (max-width: 768px) {
    .fi-main {
        max-width: 100% !important;
    }

    .fi-resource-list-records-page .fi-main,
    .fi-resource-create-record-page .fi-main,
    .fi-resource-edit-record-page .fi-main {
        max-width: 100% !important;
    }

    .fi-section-header,
    .fi-section-content,
    .fi-section-footer {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }
}
