/* Reset e stili base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colori principali */
  --primary-color: #1a2942;
  --primary-dark: #0f172a;
  --primary-light: #334155;
  --accent-color: #3b82f6;
  --accent-dark: #2563eb;
  --accent-light: #60a5fa;

  /* Testo */
  --text-color: #2d3748;
  --text-muted: #64748b;
  --text-light: #f8fafc;

  /* Background e bordi */
  --border-color: #e2e8f0;
  --bg-color: #f7fafc;
  --bg-container: #ffffff;
  --bg-sidebar: #1a2942;

  /* Effetti */
  --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  --box-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --box-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 250px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;
  --z-sidebar: 900;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiJ-Ck-8.woff2) format('woff2');
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ======== SIDEBAR ======== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--animation-timing);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: var(--z-sidebar);
  box-shadow: var(--box-shadow-lg);
}

.sidebar-collapsed {
  width: var(--sidebar-collapsed);
}

/* Sidebar Header */
.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  width: 100%;
}

.logo img {
  height: 32px;
  width: auto;
}

.logo .brand {
  margin-left: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.3s, width 0.3s;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.bracket {
  color: var(--accent-color);
}

.kpy-text {
  color: var(--accent-color);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-top: -0.2rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.25rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) var(--primary-dark);
}

/* Sezioni della navigazione */
.nav-section {
  margin-bottom: 0.5rem;
}

.section-divider {
  padding: 0.75rem 1.5rem 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.5rem;
}

.section-title {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: var(--primary-dark);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: var(--primary-light);
  border-radius: 20px;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.5rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  border-left-color: var(--accent-color);
}

.sidebar-nav a i {
  font-size: 1.1rem;
  min-width: 24px;
  text-align: center;
}

.sidebar-nav a span {
  margin-left: 0.875rem;
  transition: opacity 0.3s, width 0.3s;
  opacity: 1;
  white-space: nowrap;
}

/* Admin badge styles */
.admin-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  margin-left: auto;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.admin-only {
  display: none !important;
}

.admin-only.show {
  display: flex !important;
}

.sidebar-nav a {
  justify-content: flex-start;
}

.sidebar-nav a span:not(.admin-badge) {
  flex: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer ul {
  list-style: none;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-footer a:hover {
  color: var(--text-light);
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-footer a i {
  font-size: 1rem;
  min-width: 24px;
  text-align: center;
}

.sidebar-footer a span {
  margin-left: 0.875rem;
  transition: opacity 0.3s, width 0.3s;
  opacity: 1;
  white-space: nowrap;
}

/* Sidebar Collapsed State */
.sidebar-collapsed .brand,
.sidebar-collapsed .sidebar-nav a span,
.sidebar-collapsed .sidebar-footer a span {
  opacity: 0;
  width: 0;
  visibility: hidden;
}

.sidebar-collapsed .sidebar-nav a,
.sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding: 0.85rem;
}

.sidebar-collapsed .sidebar-nav a i,
.sidebar-collapsed .sidebar-footer a i {
  margin: 0;
}


/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }

  .sidebar {
    position: relative
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: var(--box-shadow-lg);
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .menu-toggle {
    margin-left: auto;
  }

}

/* Aggiungi questo alla fine del file sidebar.css */
.sidebar-nav li.active {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar-nav li.active a {
  color: var(--text-light) !important;
  border-left-color: var(--accent-color) !important;
  background-color: transparent;
}

.mobile-toggle {
  display: none;
  position: relative;
  background: var(--accent-color);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  transition: all 0.2s ease;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
}

.mobile-toggle i {
  font-size: 1.2rem;
}

.mobile-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.mobile-toggle:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 270px;
  }

  .mobile-toggle {
    display: flex !important;
  }

  /* Ensure header layout on mobile */
  .content-header {
    padding: 0 1rem !important;
    gap: 0.75rem;
  }

  .breadcrumb {
    flex: 1;
    min-width: 0;
  }

  .breadcrumb h1 {
    font-size: 1.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    gap: 0.5rem;
  }

  /* Profile dropdown mobile optimization */
  .profile-dropdown {
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    transform: translateY(-10px);
    max-height: fit-content !important;
    height: auto !important;
    overflow-y: visible;
  }

  .profile-dropdown.dropdown-visible {
    transform: translateY(0);
  }

  .profile-header {
    padding: 1rem;
    padding-right: 3rem;
    min-height: auto !important;
  }

  .btn-close-profile {
    display: flex !important;
  }

  .profile-menu {
    padding: 0.5rem 0;
    min-height: auto !important;
  }

  .profile-menu a {
    padding: 0.75rem 1rem;
  }

  /* Hide profile name on very small screens */
  .profile-name {
    display: none;
  }

  .profile-btn {
    gap: 0;
    padding: 0.25rem;
  }

  /* Notification dropdown mobile fix */
  .notification-dropdown {
    position: fixed !important;
    top: var(--header-height) !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    max-height: calc(100vh - var(--header-height)) !important;
    overflow-y: auto !important;
  }

  .notification-dropdown-body {
    max-height: calc(100vh - var(--header-height) - 120px) !important;
  }

  .notification-list {
    padding: 0.5rem !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    /* Nascosta per default su mobile */
    height: 100%;
    width: var(--sidebar-width);
    z-index: 1050;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
  }



  /* Overlay scuro quando la sidebar è aperta */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Bottone chiudi nella sidebar */
  .sidebar-close {
    display: flex;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    margin-left: auto;
    padding: 8px;
    cursor: pointer;
  }

  /* Fix per la visualizzazione mobile */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;

  }

  /* Evita lo scroll quando sidebar è aperta */
  body.sidebar-active {
    overflow: hidden;
  }
}

/* Ulteriori ottimizzazioni per telefoni piccoli */
@media (max-width: 375px) {
  :root {
    --sidebar-width: 85%;
  }
}

/* Aggiungere/modificare nel CSS esistente */

/* Bottoni moderni come nell'immagine di riferimento */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  gap: 8px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {

  color: white;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Aggiungere icone ai bottoni */
.btn-primary i {
  font-size: 14px;
}

#account-form .btn-primary::before {
  font-family: "Font Awesome 5 Free";
  content: "\f0c7";
  font-weight: 900;
}

#password-form .btn-primary::before {
  font-family: "Font Awesome 5 Free";
  content: "\f084";
  font-weight: 900;
}

#save-notifications::before {
  font-family: "Font Awesome 5 Free";
  content: "\f0c7";
  font-weight: 900;
}

/* ======== SIDEBAR LINK DISABILITATO ======== */
.sidebar-link-disabled {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.5rem;
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-link-disabled i {
  font-size: 1.1rem;
  min-width: 24px;
  text-align: center;
}

.sidebar-link-disabled span:first-of-type {
  margin-left: 0.875rem;
  flex: 1;
}

.dev-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin-left: auto;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

/* Responsive per sidebar disabilitata */
.sidebar-collapsed .sidebar-link-disabled span {
  opacity: 0;
  width: 0;
  visibility: hidden;
}

.sidebar-collapsed .sidebar-link-disabled {
  justify-content: center;
  padding: 0.85rem;
}

.sidebar-collapsed .sidebar-link-disabled i {
  margin: 0;
}

.sidebar-collapsed .dev-badge {
  display: none;
}