:root {
  --primary: #1e3a8a;
  --secondary: #64748b;
  --success: #22c55e;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  font-family: 'Segoe UI', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, sans-serif;
}

/* Utility */
.hidden {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Layout */
.layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Components */
.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-delete-uniform {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  /* Rounded corners */
  padding: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-delete-uniform:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-delete-uniform svg {
  width: 18px;
  height: 18px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

.card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.input-group {
  margin-bottom: 1rem;
}

/* FontAwesome icons in labels */
label i.fa-solid,
label i.fa-regular,
label i.fa-brands {
  color: #808080;
  margin-right: 0.5rem;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.25rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

.checkbox-group input {
  width: auto;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: #f1f5f9;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-light);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
  background: #eff6ff;
  color: var(--primary);
}

.hidden {
  display: none !important;
}

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  position: relative;
  overflow: visible;
  animation: slideIn 0.6s ease-out;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
}

.welcome-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 1;
}

.welcome-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.welcome-photo:hover {
  transform: scale(1.05);
}

.welcome-text {
  color: white;
}

.welcome-title {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-title span {
  color: white;
  font-weight: 800;
}

.welcome-subtitle {
  margin: 0.5rem 0 0 0;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.welcome-datetime {
  display: flex;
  gap: 1.5rem;
  z-index: 10;
}

.datetime-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

.datetime-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.datetime-icon {
  width: 20px;
  height: 20px;
  stroke: white;
  opacity: 0.9;
}

/* Score Badge Tooltip */
.score-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  width: max-content;
  max-width: 280px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  text-align: left;
  line-height: 1.6;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  font-weight: 500;
}

.score-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;
}

#user-score-display:hover .score-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.score-tooltip-title {
  color: #a78bfa;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wave {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(-10deg);
  }

  75% {
    transform: rotate(10deg);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  50% {
    transform: translateY(-20px) translateX(10px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }

  .welcome-content {
    width: 100%;
  }

  .welcome-datetime {
    width: 100%;
    flex-direction: column;
    gap: 0.75rem;
  }

  .datetime-item {
    width: 100%;
  }

  .welcome-title {
    font-size: 1.5rem;
  }

  .welcome-photo {
    width: 60px;
    height: 60px;
  }
}

/* Admin Tabs */
.admin-tab {
  padding: 10px 20px;
  background: #f1f5f9;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  border: 2px solid transparent;
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
}

.admin-tab:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

.admin-tab.active {
  background: var(--primary);
  color: white;
  border-bottom-color: var(--primary);
}

.admin-tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Badge for notifications on tabs */
.badge {
  background: #ef4444;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: bold;
  display: inline-block;
}

/* Sidebar Overlay Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
}

.modal-sidebar {
  background: white;
  width: 600px;
  max-width: 90%;
  height: 100%;
  padding: 2rem;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

/* Calendar Widget */
.calendar-widget {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 260px;
  font-family: "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  flex-shrink: 0;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

#cal-month-year {
  font-weight: 700;
  font-size: 1.1rem;
  color: #0f172a;
}

.cal-nav {
  display: flex;
  gap: 0.3rem;
}

.cal-nav button {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
}

.cal-nav button:hover {
  background: #dc2626;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  color: #0f172a;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #64748b;
  cursor: pointer;
}

.cal-day:hover {
  background: #f1f5f9;
}

.cal-day.current {
  background: #ef4444;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.cal-day.empty {
  background: transparent;
  pointer-events: none;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-with-icon {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
}

.input-with-icon svg {
  color: #64748b;
  flex-shrink: 0;
}

.input-with-icon input,
.input-with-icon select {
  flex: 1;
  width: 0;
  padding: 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
}

/* --- Statistiques Integration Styles --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.kpi-card {
  background: white;
  padding: 1.8rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-card[data-color='blue'] {
  --gradient-start: #3b82f6;
  --gradient-end: #2563eb;
}

.kpi-card[data-color='green'] {
  --gradient-start: #10b981;
  --gradient-end: #059669;
}

.kpi-card[data-color='orange'] {
  --gradient-start: #f59e0b;
  --gradient-end: #d97706;
}

.kpi-card[data-color='red'] {
  --gradient-start: #ef4444;
  --gradient-end: #dc2626;
}

.kpi-card[data-color='purple'] {
  --gradient-start: #8b5cf6;
  --gradient-end: #7c3aed;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  font-size: 1.5rem;
}

.kpi-title {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.kpi-sub {
  font-size: 0.8rem;
  color: #10b981;
  margin-top: 8px;
  font-weight: 500;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.chart-container {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  min-height: 350px;
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chart-container h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid #e2e8f0;
}

.filter-header {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  padding: 0.7rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  min-width: 160px;
  font-weight: 500;
  background: white;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', sans-serif;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title i {
  margin-right: 0.8rem;
  font-size: 1.2rem;
  color: var(--primary);
}

.table-sm {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-sm thead th {
  background: #f8fafc;
  color: #475569;
  padding: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
}

.table-sm tbody tr {
  transition: all 0.2s ease;
}

.table-sm tbody tr:hover {
  background: #f8fafc;
}

.table-sm tbody td {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-weight: 500;
}

.export-btn {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.export-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Timeline Styles */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
  border-left: 2px solid #cbd5e1;
  margin-left: 0.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #64748b;
  z-index: 1;
}

.timeline-item.visit::before {
  border-color: #3b82f6;
  background: #eff6ff;
}

.timeline-item.opportunity::before {
  border-color: #10b981;
  background: #ecfdf5;
}

.timeline-item.task::before {
  border-color: #f59e0b;
  background: #fffbeb;
}

.timeline-date {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.timeline-content {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 1rem;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #e2e8f0;
}

.timeline-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.timeline-actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Utility class for emojis */
.emoji {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  font-weight: normal;
  display: inline-block;
}

/* Force emoji font for classification column */
.col-classification {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif !important;
}

/* Custom Alert Modal */
#custom-alert-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#custom-alert-modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.custom-alert-content {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

#custom-alert-modal:not(.hidden) .custom-alert-content {
  transform: scale(1);
}

.custom-alert-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--primary);
}

.custom-alert-message {
  color: #475569;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.custom-alert-footer {
  display: flex;
  justify-content: center;
}