@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* ============================================= */
  /* 1. Base Color Palette                         */
  /* ============================================= */
  --fabPrimary: #174F6D;
  --fabSecondary: #4a4a4a;
  --fabTertiary: #d98726;
  --fabTextOnDark: #D7D9D7;
  --fabWarning: #A31621;
  --fabOk: #04724D;
  --fabTextOnBright: #0F172A;
  --fontBody: 'Manrope', sans-serif;
  --fontDisplay: 'Space Grotesk', sans-serif;

  --palette-brand-dark: var(--fabPrimary);
  --palette-brand-rgb: 23, 79, 109;

  --palette-accent-primary: var(--fabSecondary);
  --palette-accent-primary-rgb: 74, 74, 74;

  --palette-accent-secondary: var(--fabTertiary);
  --palette-accent-secondary-rgb: 217, 135, 38;

  --palette-neutral-bg: #F7F8FB;
  --palette-neutral-card: #FFFFFF;
  --palette-neutral-text: var(--fabTextOnBright);
  --palette-neutral-muted: #5B6472;
  --palette-neutral-border: #E5E7EB;
  --palette-neutral-dark: #112C3A;

  --palette-success: var(--fabOk);
  --palette-danger: var(--fabWarning);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 6px 14px -10px rgba(15, 23, 42, 0.25);
  --shadow-md: 0 16px 28px -18px rgba(15, 23, 42, 0.35);
  --shadow-lg: 0 28px 48px -28px rgba(15, 23, 42, 0.45);
  --shadow-soft: 0 45px 90px -60px rgba(15, 23, 42, 0.5);

  --radius-sm: 0.6rem;
  --radius-md: 0.9rem;
  --radius-lg: 1.2rem;

  --transition-base: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

  /* Bootstrap Overrides Mapping */
  --bs-primary: var(--palette-brand-dark);
  --bs-primary-rgb: var(--palette-brand-rgb);
  --bs-secondary: var(--palette-accent-primary);
  --bs-body-bg: var(--palette-neutral-bg);
  --bs-body-color: var(--palette-neutral-text);
  --bs-font-sans-serif: var(--fontBody);

  --fcms-navbar-height: 5rem;
}

/* ============================================= */
/* GLOBAL RESET & TYPOGRAPHY (UPDATED HIERARCHY) */
/* ============================================= */
body {
  font-family: var(--fontBody);
  background: radial-gradient(circle at top left, rgba(23, 79, 109, 0.08), transparent 45%),
    radial-gradient(circle at 20% 20%, rgba(217, 135, 38, 0.08), transparent 38%),
    var(--palette-neutral-bg);
  color: var(--palette-neutral-text);
  line-height: 1.7;
  font-size: 0.95rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* General Heading Reset */
h1, h2, h3, h4, h5, h6 {
  color: var(--palette-brand-dark);
  font-family: var(--fontDisplay);
  margin-bottom: 1rem;
  line-height: 1.2;
}

/* H1: Main Page Title (Big & Bold) */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}

/* H2: Section Title (Structural, with underline) */
h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--palette-neutral-border); /* Visual Separation */
}

/* H3: Subsection (Slightly lighter, no border) */
h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #2c4a63; /* Slightly lighter shade of brand dark */
  margin-top: 1.5rem;
}

/* H4-H6: Utilities */
h4 { font-size: 1.1rem; font-weight: 700; text-transform: uppercase; color: var(--palette-neutral-muted); letter-spacing: 0.05em; }
h5 { font-size: 1rem; font-weight: 600; }

p {
  margin-bottom: 1.2rem;
  color: var(--fabTextOnBright);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

a {
  text-decoration: none;
  transition: var(--transition-base);
}

/* ============================================= */
/* MODERN NAVBAR (STICKY + GLASS)                */
/* ============================================= */
.navbar {
  /* Sticky Positioning */
  position: sticky;
  top: 0;

  /* Glass Effect */
  background: linear-gradient(115deg, rgba(18, 68, 95, 0.96), rgba(24, 95, 125, 0.9));
  backdrop-filter: blur(12px) saturate(110%);
  -webkit-backdrop-filter: blur(12px) saturate(110%);

  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  min-height: var(--fcms-navbar-height);
  padding: 0.8rem 0;
  z-index: 1030;
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
  color: #fff !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-link {
  color: rgba(255,255,255,0.9) !important; /* Whiter text for contrast */
  font-weight: 500;
  padding: 0.6rem 1.2rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  margin: 0 2px;
}

.nav-link:hover, .nav-link.active {
  color: #fff !important;
  background-color: rgba(255,255,255,0.15);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Dropdown styling */
.dropdown-menu {
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  margin-top: 15px !important;
  animation: slideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-weight: 500;
  transition: all 0.2s;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
  color: var(--palette-brand-dark);
}

/* NAVBAR BUTTONS & BADGES FIX */
.navbar .btn,
.header-buttons .btn {
  overflow: visible !important;
  position: relative;
}

.navbar .btn:not(.dropdown-toggle),
.header-buttons .btn {
  min-width: 45px !important;
  height: 45px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm) !important;
}

.navbar .btn i,
.navbar .btn svg {
  margin: 0 !important;
  font-size: 1.1rem;
}

.badge, .label-danger {
  z-index: 10;
}

/* ============================================= */
/* CARDS (Clean & Floating)                      */
/* ============================================= */
.card {
  background: var(--palette-neutral-card);
  border: 1px solid rgba(0,0,0,0.03);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  overflow: hidden;
}

.card-hover:hover, .card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(23, 79, 109, 0.18);
}

.card-body {
  padding: 2rem;
}

.card-title {
  color: var(--palette-brand-dark);
  font-weight: 700;
}

/* ============================================= */
/* BUTTONS (Tactile Feel)                        */
/* ============================================= */
.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.6rem;
  letter-spacing: 0.02em;
  border: none;
  position: relative;
  transition: var(--transition-base);
}

.btn-primary {
  background-color: var(--palette-brand-dark);
  box-shadow: 0 4px 12px rgba(var(--palette-brand-rgb), 0.3);
  color: #fff;
}

.btn-primary:hover {
  background-color: #10384f;
  box-shadow: 0 8px 18px rgba(var(--palette-brand-rgb), 0.4);
}

.btn-primary:active {
  box-shadow: none;
}

.btn-accent {
  background-color: var(--palette-accent-secondary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 135, 38, 0.3);
}
.btn-accent:hover {
  background-color: #c4761d;
  color: #fff;
}

/* ============================================= */
/* SIDEBAR PREMIUM (Gradient & Fixes)            */
/* ============================================= */

/* 1. Container Style (Gradient) */
.template-sidebar .card .card-body {
  background: linear-gradient(160deg, var(--palette-brand-dark) 0%, #0d3a52 100%);
  padding: 2rem !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md) !important;
}

.template-sidebar .card {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 2. Force White Text */
.template-sidebar .card .card-body,
.template-sidebar .card .card-body h6,
.template-sidebar .card .card-body .card-title,
.template-sidebar .card .card-body p,
.template-sidebar .card .card-body strong,
.template-sidebar .card .card-body span {
  color: #ffffff !important;
  opacity: 0.95;
}

/* 3. Sidebar Title */
.template-sidebar .card .card-title {
  text-transform: uppercase;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 0.8rem;
  margin-bottom: 1.5rem;
}

/* 4. Sidebar Links (Bright Cyan) */
.template-sidebar .card .card-body ul li {
  margin-bottom: 0.5rem;
}
.template-sidebar .card .card-body ul li a {
  color: #A0E9FF !important;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-block;
}
.template-sidebar .card .card-body ul li a:hover {
  color: #ffffff !important;
  text-shadow: 0 0 8px rgba(160, 233, 255, 0.6);
}

/* 5. Sidebar Action Button */
.template-sidebar .card .card-body > .btn {
  background-color: #ffffff !important;
  color: var(--palette-brand-dark) !important;
  border: none !important;
  font-weight: 700;
  width: 100%;
  margin-top: 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.template-sidebar .card .card-body > .btn:hover {
  background-color: #f0f0f0 !important;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* 6. SEARCH BAR FIXES */
.template-sidebar .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  align-items: stretch !important;
}

.template-sidebar .input-group .form-control {
  flex: 1 1 auto !important;
  width: 1% !important;
  margin-bottom: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.template-sidebar .input-group .btn {
  width: auto !important;
  margin-top: 0 !important;
  padding: 0 1.2rem !important;
  flex: 0 0 auto !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  background-color: #ffffff !important;
  color: var(--palette-brand-dark) !important;
}

/* ============================================= */
/* COMPONENTS                                    */
/* ============================================= */

/* Hero Section */
.hero {
  background: var(--hero-dynamic-bg, linear-gradient(135deg, var(--palette-brand-dark), var(--palette-neutral-dark))) no-repeat center center / cover;
  color: #fff;
  padding: 5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, rgba(23, 79, 109, 0.9), rgba(17, 44, 58, 0.7));
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }
.hero h2 { color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.2); border-bottom: none; }

/* Form Elements */
.form-control {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid #ced4da;
  background-color: #fff;
  transition: all 0.2s ease-in-out;
}
.form-control:focus {
  border-color: var(--palette-brand-dark);
  box-shadow: 0 0 0 4px rgba(23, 79, 109, 0.1);
  outline: 0;
}

/* Tables */
.table {
  background: white;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.table thead th {
  background-color: #f8f9fa;
  color: var(--palette-neutral-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #dee2e6;
  padding: 1rem;
}
.table td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}

/* Footer */
footer.main-footer {
  background: linear-gradient(to right, var(--palette-brand-dark), #10384f);
  color: rgba(255,255,255,0.84);
  padding: 0;
  margin-top: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

footer.main-footer a {
  color: #d8ecff;
}

footer.main-footer a:hover {
  color: #ffffff;
}

.footer-shell {
  position: relative;
}

.footer-shell::before {
  content: "";
  position: absolute;
  right: 5%;
  top: 8%;
  width: 18rem;
  height: 18rem;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.13) 0%, rgba(255,255,255,0) 70%);
}

.footer-brand-title {
  color: #ffffff;
  margin-bottom: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 2rem;
}

.footer-brand-text {
  color: #d8ecff;
  text-align: left;
  text-justify: auto;
  hyphens: none;
  max-width: 40rem;
  margin-bottom: 0.9rem;
}

.footer-vat {
  color: #ffffff;
  font-weight: 700;
}

.footer-made-in-italy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}

.footer-made-in-italy span {
  color: #ff7f9f;
}

.footer-section-title {
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
  border: 0;
  padding: 0;
  margin-top: 0.3rem;
}

.footer-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-link-list li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.7rem;
}

.footer-link-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #19c37d;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  text-align: center;
  color: #e9f5ff;
}

@media (max-width: 767.98px) {
  .footer-brand-title {
    font-size: 1.6rem;
  }

  .footer-link-list li {
    margin-bottom: 0.6rem;
  }
}

/* Responsive fixes */
@media (max-width: 991.98px) {
  :root { --fcms-navbar-height: 4rem; }
  .navbar-collapse {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    box-shadow: var(--shadow-lg);
  }
  .navbar-collapse .nav-link {
    color: var(--palette-brand-dark) !important;
  }
  .navbar-collapse .nav-link:hover {
    background-color: var(--palette-neutral-bg);
  }
}

/* 3. ORDERED LISTS (<ol>) - "Small Accent Badge" Style (COMPACT FIX) */
.card-body ol:not(.list-unstyled):not(.navbar-nav) {
  list-style: none;
  counter-reset: premium-counter;
}

.card-body ol:not(.list-unstyled):not(.navbar-nav) > li {
  position: relative;
  counter-increment: premium-counter;

  /* DISTANZA VERTICALE RIDOTTA (Uniformata alle UL: 0.5rem) */
  margin-bottom: 0.5rem;

  /* PADDING RIDOTTO (Testo più vicino al numero) */
  padding-left: 2rem; /* Sceso da 2.5rem a 2rem */

  color: var(--palette-neutral-text) !important;
}

/* The Number Badge */
.card-body ol:not(.list-unstyled):not(.navbar-nav) > li::before {
  content: counter(premium-counter);
  position: absolute;
  left: 0;
  top: 1px;

  /* DIMENSIONI E STILE (Invariati) */
  width: 22px;
  height: 22px;
  background: var(--palette-accent-secondary);
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
  box-shadow: 0 2px 4px rgba(217, 135, 38, 0.25);
}

.card-body ol:not(.list-unstyled):not(.navbar-nav) > li::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 26px;
  bottom: -6px; /* Aggiustato per la nuova spaziatura ridotta */
  width: 1px;
  background-color: var(--palette-neutral-border);
  z-index: 0;
}

.card-body ol:not(.list-unstyled):not(.navbar-nav) > li:last-child::after {
  display: none;
}

/* Hover Effect */
.card-body ol:not(.list-unstyled):not(.navbar-nav) > li:hover::before {
  filter: brightness(1.1);
}

/*
 IMG
 */

.coreImgWrap .coreImgFile{
  text-align: center;
  padding: 12px;
  background-color: var(--palette-neutral-bg);
  display: flex;
  justify-content: center;  /* centra l'immagine */
}

.coreImgWrap .coreImgFile img{
  display: block;
  height: auto;
  max-width: 100%;
}

.coreImgWrap .coreImgCaption{
  text-align: center;
  margin-top: .8rem;
}

/* ============================================= */
/* ENHANCED TABLES STYLING                       */
/* ============================================= */

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--palette-neutral-border);
  border-radius: var(--radius-md);
  background: var(--palette-neutral-card);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem; /* Testo leggermente più piccolo per tabelle dense */
}

/* Header della tabella */
table thead th {
  background-color: #F8F9FA;
  color: var(--palette-brand-dark);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 1.25rem 1rem;
  border-bottom: 2px solid var(--palette-neutral-border) !important;
  text-align: left;
}

/* Celle della tabella */
table td, table th {
  padding: 1rem;
  vertical-align: top; /* Allineamento in alto per contenuti testuali lunghi */
  border-bottom: 1px solid var(--palette-neutral-border);
  line-height: 1.5;
}

/* FIX ALLINEAMENTO: Rimuove il "giustificato" che crea buchi nel testo */
table td,
table td p,
table td li {
  text-align: left !important;
  text-justify: none !important;
  hyphens: none !important;
  margin-bottom: 0.5rem;
}

/* Zebra Striping (Righe alternate per leggibilità) */
table tbody tr:nth-of-type(even) {
  background-color: rgba(var(--palette-brand-rgb), 0.02);
}

/* Effetto Hover sulla riga */
table tbody tr:hover {
  background-color: rgba(var(--palette-brand-rgb), 0.04);
  transition: background-color 0.2s ease;
}

/* Colonna principale (opzionale: rende la prima colonna più evidente) */
table td:first-child {
  font-weight: 600;
  color: var(--palette-brand-dark);
}

/* Badge o link dentro la tabella */
table a {
  color: var(--palette-accent-primary);
  font-weight: 600;
}
