/* Specialissimi – tema Tabler */
:root {
  --tblr-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tblr-primary: #2c3bc7;
  --tblr-primary-rgb: 44, 59, 199;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
}

body {
  font-family: var(--tblr-font-sans-serif);
  -webkit-font-smoothing: antialiased;
}

/* ── Login ───────────────────────────────────────────── */
.sp-login-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(74, 93, 232, 0.45), transparent),
    linear-gradient(160deg, #141b4d 0%, #1e2a9e 42%, #2c3bc7 100%);
}

.sp-login-page .page-center {
  min-height: 100vh;
}

.sp-login-page .card {
  border: 0;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.25);
}

.sp-login-page .btn-primary {
  --tblr-btn-bg: #2c3bc7;
  --tblr-btn-border-color: #2c3bc7;
  --tblr-btn-hover-bg: #1e2a9e;
  --tblr-btn-hover-border-color: #1e2a9e;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  font-weight: 600;
}

.sp-login-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
}

/* ── Sidebar ─────────────────────────────────────────── */
.navbar-vertical[data-bs-theme="dark"] {
  --tblr-navbar-bg: #1a237e;
}

.navbar-vertical .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0;
  margin: 0;
}

.sp-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sp-sidebar-shell {
  min-height: 0;
  overflow: hidden;
}

.sp-sidebar-body {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
  align-items: stretch;
}

.sp-dashboard-sidebar > .container-fluid,
.sp-dashboard-sidebar .navbar-collapse {
  align-items: stretch;
}

.sp-dashboard-sidebar .navbar-nav {
  width: 100%;
  align-items: stretch;
}

.sp-dashboard-sidebar .nav-item {
  width: 100%;
}

.sp-dashboard-sidebar .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.sp-dashboard-sidebar .nav-link-title {
  text-align: left;
}

.sp-dashboard-sidebar .nav-link-icon {
  flex-shrink: 0;
}

.sp-sidebar-body > .navbar-nav {
  flex: 1 1 auto;
}

.sp-sidebar-logo {
  height: 1.25rem;
  width: 1.25rem;
  object-fit: contain;
  flex-shrink: 0;
}

.sp-sidebar-brand-text {
  font-size: 0.95rem;
  font-weight: 600;
}

.navbar-vertical .nav-link.active,
.navbar-vertical .nav-pills .nav-link.active {
  font-weight: 600;
}

.navbar-vertical .nav-item.sp-nav-hidden {
  display: none !important;
}

.sp-sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.sp-sidebar-user-menu {
  position: static;
}

.sp-sidebar-user-toggle {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-sidebar-user-toggle:hover,
.sp-sidebar-user-toggle:focus,
.sp-sidebar-user-toggle.show {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.sp-sidebar-user-dropdown {
  min-width: 11rem;
  z-index: 1080;
  margin-bottom: 0.35rem !important;
}

.sp-sidebar-user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
}

.sp-sidebar-search .form-control {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: #fff;
}

.sp-sidebar-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.sp-sidebar-search .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  color: #fff;
}

/* Submenu collapse nella sidebar */
.navbar-vertical .collapse .nav-link {
  padding-left: 2.75rem;
  font-size: 0.875rem;
}

/* Layout: sidebar fissa + contenuto affiancato (come dashboard EJS) */
@media (min-width: 992px) {
  .page > .navbar-vertical.navbar-expand-lg ~ .page-wrapper {
    margin-left: 15rem;
  }
}

@media (max-width: 991.98px) {
  .page > .navbar-vertical.navbar-expand-lg ~ .page-wrapper,
  .page > .navbar-vertical.navbar-expand-lg.show ~ .page-wrapper {
    margin-left: 0;
  }

  /* Drawer laterale: chiuso di default, aperto con burger */
  .page > .navbar-vertical.navbar-expand-lg {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 15rem;
    max-width: 85vw;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.sp-sidebar-open .page > .navbar-vertical.navbar-expand-lg {
    transform: translateX(0);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.22);
  }

  .page > .navbar-vertical.navbar-expand-lg > .sp-sidebar-shell,
  .page > .navbar-vertical.navbar-expand-lg > .container-fluid.sp-sidebar-shell {
    height: 100%;
    min-height: 0;
  }

  .page > .navbar-vertical.navbar-expand-lg #sidebar-menu {
    display: flex !important;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  body.sp-sidebar-open {
    overflow: hidden;
  }

  body.sp-sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
  }

  /* Topbar mobile con burger */
  .sp-mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    margin: -1rem -0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1020;
  }

  .sp-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 2px solid #d8dff5;
    border-radius: 0.5rem;
    background: #eef1fb;
    color: #2c3bc7;
    box-shadow: 0 2px 6px rgba(44, 59, 199, 0.12);
    flex-shrink: 0;
  }

  .sp-mobile-menu-btn:hover,
  .sp-mobile-menu-btn:focus {
    background: #dfe6fa;
    color: #1e2a9e;
    outline: none;
  }

  .sp-mobile-menu-btn .ti {
    font-size: 1.35rem;
  }

  .sp-mobile-topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 992px) {
  .sp-mobile-topbar {
    display: none !important;
  }

  body.sp-sidebar-open::before {
    display: none;
  }

  .sp-sidebar-body {
    overflow-y: visible;
  }
}

/* ── Dashboard ───────────────────────────────────────── */
.sp-clickable-card {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sp-clickable-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.75rem 2rem rgba(44, 59, 199, 0.12);
}

.page-pretitle {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ── Task ────────────────────────────────────────────── */
.priority-low { color: #2fb344; font-weight: 600; }
.priority-medium { color: #f76707; font-weight: 600; }
.priority-high { color: #d63939; font-weight: 600; }

.completed-task {
  background-color: rgba(47, 179, 68, 0.07) !important;
}

.hiddenRow { display: none; }
.hidden-column { display: none; }

.task-management-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1rem 0;
}

.task-details { flex: 1; min-width: 260px; }

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

.task-actions .btn { width: 100%; }

#taskTable tbody tr[data-task-id] { cursor: pointer; }

/* ── Spesometro gauge ────────────────────────────────── */
.sp-gauge {
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.6s ease;
}

.sp-gauge-inner {
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  background: var(--tblr-card-bg, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.sp-gauge-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.sp-kpi-mini {
  padding: 0.5rem 0;
}

.sp-kpi-mini .subheader {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.text-purple { color: #7950f2 !important; }
.bg-purple-lt { background-color: rgba(121, 80, 242, 0.1) !important; color: #7950f2 !important; }

.sp-simple-chart .progress {
  height: 0.7rem;
}

.sp-simple-chart .progress-bar {
  background: linear-gradient(90deg, #2c3bc7, #4c6fff);
}

.sp-print-report {
  display: none;
}

@media print {
  html, body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: #fff !important;
  }

  /* Report dedicato: nascondi tutta la UI app */
  .navbar-vertical,
  .page-header,
  .container-xl > :not(.sp-print-report),
  #sp-toast-container {
    display: none !important;
  }

  .page-wrapper,
  .page-body,
  .container-xl {
    margin: 0 !important;
    padding: 0 !important;
  }

  .sp-print-report {
    display: block !important;
    font-size: 12px;
    color: #1f2937;
  }

  .sp-print-header {
    margin-bottom: 1.2rem;
    border: 1px solid #cfd8ff;
    border-left: 6px solid #2c3bc7;
    background: linear-gradient(90deg, #eef2ff 0%, #f8faff 100%) !important;
    border-radius: 8px;
    padding: 0.75rem 1rem;
  }

  .sp-print-header h1 {
    margin: 0;
    font-size: 24px;
    color: #1e2a9e;
  }

  .sp-print-header p {
    margin: 0.25rem 0 0;
    color: #4b5563;
  }

  .sp-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .sp-print-kpi {
    border: 1px solid #dbe4ff;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    break-inside: avoid;
    background: #f8faff !important;
  }

  .sp-print-kpi span {
    display: block;
    color: #4b5563;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .sp-print-kpi strong {
    font-size: 16px;
    color: #1e2a9e;
  }

  .sp-print-grid .sp-print-kpi:nth-child(3n+1) {
    border-top: 3px solid #2c3bc7;
  }

  .sp-print-grid .sp-print-kpi:nth-child(3n+2) {
    border-top: 3px solid #16a34a;
  }

  .sp-print-grid .sp-print-kpi:nth-child(3n+3) {
    border-top: 3px solid #d97706;
  }

  .sp-print-report h3 {
    margin: 1rem 0 0.5rem;
    font-size: 16px;
    color: #1e2a9e;
    border-left: 4px solid #4c6fff;
    padding-left: 0.5rem;
  }

  .sp-print-report table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
  }

  .sp-print-report th,
  .sp-print-report td {
    border: 1px solid #ddd;
    padding: 0.35rem 0.5rem;
    vertical-align: top;
  }

  .sp-print-report thead th {
    background: #eef2ff !important;
    color: #1e2a9e;
    font-weight: 700;
  }

  .sp-print-report tbody tr:nth-child(even) td {
    background: #fafbff !important;
  }

  .sp-print-report tr {
    break-inside: avoid;
  }
}

#sp-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}
