/* ========================================
   DASHBOARD - Modern & Sophisticated Style
   ======================================== */

/* Dashboard Grid Layout */
.dashboard-widgets {
  grid-template-columns: repeat(auto-fill, minmax(550px, 1fr)) !important;
  gap: 28px;
}

/* Widget Base Styling - Glass Morphism Effect */
.widget {
  max-height: 650px;
  background: linear-gradient(135deg, 
    rgba(30, 37, 48, 0.95) 0%, 
    rgba(25, 31, 40, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--color-accent-solid, #7b67ff), 
    transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.widget:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 12px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  border-color: rgba(255, 255, 255, 0.12);
}

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

/* Light theme adjustments */
body.theme-light .widget {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(248, 250, 252, 0.98) 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.03) inset;
}

body.theme-light .widget:hover {
  box-shadow: 
    0 12px 48px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.05) inset;
  border-color: rgba(0, 0, 0, 0.12);
}

/* Widget Header - Enhanced */
.widget-header {
  padding: 20px 24px 14px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.02) 0%,
    transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

body.theme-light .widget-header {
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.02) 0%,
    transparent 100%);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.widget-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0;
  color: var(--color-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.widget-header h2::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, 
    var(--color-accent-solid, #7b67ff), 
    rgba(123, 103, 255, 0.3));
  border-radius: 2px;
  box-shadow: 0 0 12px var(--color-accent-solid, #7b67ff);
}

/* Widget Actions */
.widget-actions {
  display: flex;
  gap: 8px;
}

.widget-actions .btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.widget-actions .btn-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.theme-light .widget-actions .btn-sm {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
}

body.theme-light .widget-actions .btn-sm:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Widget Body */
.widget-body {
  overflow: hidden;
  padding: 20px 24px 24px;
}

/* Data Lists - Styled */
.data-list {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 12px;
  margin: 0;
  list-style: none;
}

/* Custom Scrollbar */
.data-list::-webkit-scrollbar {
  width: 8px;
}

.data-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.data-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, 
    rgba(123, 103, 255, 0.6), 
    rgba(123, 103, 255, 0.3));
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.data-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, 
    rgba(123, 103, 255, 0.8), 
    rgba(123, 103, 255, 0.5));
}

body.theme-light .data-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-light .data-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, 
    rgba(123, 103, 255, 0.4), 
    rgba(123, 103, 255, 0.2));
}

/* List Items - Card Style */
.data-list li {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.02) 100%);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--color-accent-solid, #7b67ff);
  font-size: 13.5px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.data-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, 
    var(--color-accent-solid, #7b67ff),
    transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.data-list li:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  border-left-color: #22c55e;
  transform: translateX(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.data-list li:hover::before {
  opacity: 1;
}

body.theme-light .data-list li {
  background: linear-gradient(135deg,
    rgba(0, 0, 0, 0.02) 0%,
    rgba(0, 0, 0, 0.01) 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.theme-light .data-list li:hover {
  background: linear-gradient(135deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.02) 100%);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Column Headers - Enhanced */
.col h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 10px;
  border-bottom: 2px solid transparent;
  background: linear-gradient(90deg, 
    rgba(123, 103, 255, 0.2), 
    transparent 50%);
  border-image: linear-gradient(90deg, 
    var(--color-accent-solid, #7b67ff), 
    transparent) 1;
  padding-left: 12px;
  position: relative;
}

.col h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--color-accent-solid, #7b67ff);
  border-radius: 2px;
}

/* Count Badge - Redesigned */
.col h3 .count-badge {
  background: linear-gradient(135deg, 
    var(--color-accent-solid, #7b67ff), 
    rgba(123, 103, 255, 0.7));
  color: white;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 
    0 2px 8px rgba(123, 103, 255, 0.4),
    0 0 0 2px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 24px;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(123, 103, 255, 0.4);
  }
  50% {
    box-shadow: 0 2px 16px rgba(123, 103, 255, 0.6);
  }
}

/* Action Buttons */
.col .btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  background: linear-gradient(135deg,
    rgba(123, 103, 255, 0.15),
    rgba(123, 103, 255, 0.05));
  border: 1px solid rgba(123, 103, 255, 0.3);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.col .btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.col .btn:hover::before {
  width: 300px;
  height: 300px;
}

.col .btn:hover {
  background: linear-gradient(135deg,
    rgba(123, 103, 255, 0.25),
    rgba(123, 103, 255, 0.15));
  border-color: rgba(123, 103, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 103, 255, 0.3);
}

body.theme-light .col .btn {
  background: linear-gradient(135deg,
    rgba(123, 103, 255, 0.1),
    rgba(123, 103, 255, 0.05));
  border-color: rgba(123, 103, 255, 0.25);
}

body.theme-light .col .btn:hover {
  background: linear-gradient(135deg,
    rgba(123, 103, 255, 0.18),
    rgba(123, 103, 255, 0.1));
  border-color: rgba(123, 103, 255, 0.4);
}

/* Empty State */
.data-list li[style*="opacity"] {
  text-align: center;
  font-style: italic;
  opacity: 0.6;
  border-left-color: rgba(255, 255, 255, 0.2);
  cursor: default;
}

.data-list li[style*="opacity"]:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.03);
  border-left-color: rgba(255, 255, 255, 0.2);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
  .dashboard-widgets {
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)) !important;
    gap: 24px;
  }
  
  .widget {
    max-height: 600px;
  }
}

@media (max-width: 768px) {
  .dashboard-widgets {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  
  .widget-body.dual-columns,
  .widget-body.tri-columns {
    flex-direction: column;
  }
  
  #widget-profile {
    grid-column: 1 !important;
  }
  
  .profile-stats {
    grid-template-columns: 1fr !important;
  }
  
  .widget-header {
    padding: 16px 20px 12px;
  }
  
  .widget-header h2 {
    font-size: 16px;
  }
  
  .widget-body {
    padding: 16px 20px 20px;
  }
  
  .data-list {
    max-height: 300px;
  }
  
  .col h3 {
    font-size: 12px;
  }
  
  .staff-online-avatar {
    width: 48px;
    height: 48px;
  }
  
  .staff-online-avatar::after {
    width: 12px;
    height: 12px;
  }
  
  #staff-online-container {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .dashboard-widgets {
    gap: 16px;
  }
  
  .widget {
    border-radius: 12px;
  }
  
  .widget-header {
    padding: 14px 16px 10px;
  }
  
  .widget-header h2 {
    font-size: 15px;
  }
  
  .widget-body {
    padding: 14px 16px 16px;
  }
  
  .data-list li {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .stat-group {
    padding: 14px;
  }
  
  .stat-group p {
    min-width: 100%;
    font-size: 13px;
  }
  
  .widget-actions .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ========================================
   PROFILE STATS WIDGET
   ======================================== */

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.stat-group {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.02) 100%);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-group::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--color-accent-solid, #7b67ff),
    rgba(123, 103, 255, 0.3));
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-group:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-group:hover::before {
  opacity: 1;
}

body.theme-light .stat-group {
  background: linear-gradient(135deg,
    rgba(0, 0, 0, 0.02) 0%,
    rgba(0, 0, 0, 0.01) 100%);
  border-color: rgba(0, 0, 0, 0.08);
}

body.theme-light .stat-group:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.stat-group h3 {
  margin: 0 0 14px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent-solid, #7b67ff);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(123, 103, 255, 0.2);
}

.stat-group h3::before {
  content: '●';
  font-size: 8px;
  animation: pulse 2s ease-in-out infinite;
}

/* Stats Layout */
.stat-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-group p {
  margin: 0;
  font-size: 13.5px;
  color: var(--color-text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  flex: 1 1 auto;
  min-width: 160px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.stat-group p:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

body.theme-light .stat-group p {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.05);
}

body.theme-light .stat-group p:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

.stat-group p strong {
  color: var(--color-text);
  font-weight: 600;
}

.stat-group p span {
  color: #22c55e;
  font-weight: 700;
  font-size: 15px;
  margin-left: auto;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

/* ========================================
   STAFF ONLINE WIDGET - Enhanced
   ======================================== */

#widget-staff-online .widget-body {
  overflow: visible;
}

#staff-online-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0;
  align-items: center;
  justify-content: flex-start;
}

.staff-online-item {
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.staff-online-item:hover {
  transform: translateY(-6px) scale(1.05);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
  z-index: 10;
}

.staff-online-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--rank-color, #3b82f6);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 0 20px var(--rank-color),
    0 0 0 4px rgba(255, 255, 255, 0.05);
  background: var(--color-surface);
  overflow: hidden;
  position: relative;
  transition: all 0.3s;
}

.staff-online-item:hover .staff-online-avatar {
  border-width: 4px;
  box-shadow: 
    0 6px 24px rgba(0, 0, 0, 0.5),
    0 0 30px var(--rank-color),
    0 0 0 6px rgba(255, 255, 255, 0.1);
}

.staff-online-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.staff-online-item:hover .staff-online-avatar img {
  transform: scale(1.1);
}

.staff-online-avatar .avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Online Indicator - Animated */
.staff-online-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 3px solid var(--color-surface);
  border-radius: 50%;
  box-shadow: 
    0 0 12px rgba(34, 197, 94, 0.8),
    0 0 0 2px rgba(34, 197, 94, 0.3);
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% {
    box-shadow: 
      0 0 12px rgba(34, 197, 94, 0.8),
      0 0 0 2px rgba(34, 197, 94, 0.3);
  }
  50% {
    box-shadow: 
      0 0 20px rgba(34, 197, 94, 1),
      0 0 0 4px rgba(34, 197, 94, 0.5);
  }
}

/* Tooltip - Glass Morphism */
.staff-online-tooltip {
  position: fixed;
  transform: translate(-50%, -100%);
  margin-top: -16px;
  background: linear-gradient(135deg,
    rgba(30, 37, 48, 0.98) 0%,
    rgba(25, 31, 40, 0.98) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 220px;
  box-shadow: 
    0 12px 48px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999999 !important;
  pointer-events: none;
  white-space: nowrap;
}

.staff-online-tooltip.show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%, -100%) translateY(-4px);
}

body.theme-light .staff-online-tooltip {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 250, 252, 0.98) 100%);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 
    0 12px 48px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

/* Tooltip Arrow */
.staff-online-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(30, 37, 48, 0.98);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

body.theme-light .staff-online-tooltip::after {
  border-top-color: rgba(255, 255, 255, 0.98);
}

.tooltip-username {
  font-size: 15px;
  font-weight: 800;
  color: var(--rank-color, #3b82f6);
  margin: 0 0 6px 0;
  text-shadow: 0 0 12px var(--rank-color);
  letter-spacing: 0.3px;
}

.tooltip-rank {
  font-size: 12px;
  color: var(--color-text-dim);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-activity {
  font-size: 11.5px;
  color: var(--color-text-dim);
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-light .tooltip-activity {
  border-top-color: rgba(0, 0, 0, 0.1);
}

.tooltip-activity strong {
  color: var(--color-text);
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 12px;
}

.status-text {
  font-size: 13.5px;
  color: var(--color-text-dim);
  font-weight: 600;
  text-align: center;
  padding: 20px;
}

.loading-text {
  color: var(--color-text-dim);
  font-size: 14px;
  text-align: center;
  padding: 24px;
  margin: 0;
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Rank Colors - Enhanced */
.rank-gestore { --rank-color: #ef4444; }
.rank-admin { --rank-color: #f87171; }
.rank-mod { --rank-color: #3b82f6; }
.rank-helper { --rank-color: #22c55e; }
.rank-trial { --rank-color: #86efac; }
.rank-esterno { --rank-color: #06b6d4; }
