/* ============================================================
   SICONNECT TIME TRACKER - Feuille de style principale
   Design : Corporate moderne, sobre, professionnel
   ============================================================ */

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

:root {
  /* Palette principale */
  --primary:       #1a56db;
  --primary-dark:  #1443b0;
  --primary-light: #e8f0fe;
  --secondary:     #0e9f6e;
  --danger:        #e02424;
  --warning:       #e3a008;
  --info:          #3f83f8;

  /* Neutrals */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  #1e293b;
  --sidebar-active: #1a56db;
  --sidebar-text:   #94a3b8;
  --sidebar-width:  260px;

  /* Layout */
  --topbar-height: 64px;
  --border-radius: 8px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.12);

  /* Typography */
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout Shell ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo-text { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.3; }
.sidebar-logo-text small { color: var(--sidebar-text); font-size: 11px; font-weight: 400; display: block; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-section {
  padding: 16px 20px 6px;
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-hover);
  border-left-color: var(--primary);
  color: #fff;
  font-weight: 500;
}

.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.sidebar-item.active svg, .sidebar-item:hover svg { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e293b;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: var(--sidebar-text); font-size: 11px; }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  position: relative;
  transition: all .15s;
}
.topbar-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.topbar-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ---- Page Content ---- */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header-left .breadcrumb {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

.page-header-left .breadcrumb a { color: var(--gray-500); }
.page-header-left .breadcrumb a:hover { color: var(--primary); }

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-icon svg { width: 24px; height: 24px; }

.stat-info {}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--gray-50); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-gray     { background: var(--gray-100); color: var(--gray-600); }
.badge-purple   { background: #ede9fe; color: #7c3aed; }
.badge-orange   { background: #fed7aa; color: #c2410c; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-100); text-decoration: none; }

.btn-success  { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-success:hover { background: #057a55; text-decoration: none; color: #fff; }

.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #c81e1e; text-decoration: none; color: #fff; }

.btn-warning  { background: var(--warning); color: #fff; border-color: var(--warning); }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .15s;
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon.danger:hover { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
.btn-icon svg { width: 15px; height: 15px; }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-1 { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

.form-control:disabled { background: var(--gray-100); color: var(--gray-400); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint { font-size: 12px; color: var(--gray-400); }
.form-error { font-size: 12px; color: var(--danger); }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---- Progress Bar ---- */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--primary);
  transition: width .4s ease;
}

.progress-fill.success { background: var(--secondary); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ---- Calendar / CRA ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.calendar-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  padding: 6px 0;
}

.calendar-day {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px;
  min-height: 80px;
  background: #fff;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  font-size: 12px;
}

.calendar-day:hover { border-color: var(--primary); background: var(--primary-light); }
.calendar-day.today { border-color: var(--primary); }
.calendar-day.weekend { background: var(--gray-50); }
.calendar-day.ferie { background: #fef9c3; }
.calendar-day.complet { border-color: var(--secondary); }
.calendar-day.incomplet { border-color: var(--warning); }
.calendar-day.autre-mois { opacity: .4; cursor: default; }
.calendar-day.gele { background: var(--gray-100); cursor: default; }

.calendar-day-num { font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.calendar-day.today .calendar-day-num { color: var(--primary); }

.calendar-day-hours {
  font-size: 11px;
  font-weight: 700;
  color: var(--secondary);
}

.calendar-day-dot {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

/* ---- Progress Ring ---- */
.ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ring-text {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none;
  color: var(--gray-400); cursor: pointer;
  padding: 4px; border-radius: 4px;
}
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Dropdown ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 100;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { border-top: 1px solid var(--gray-200); margin: 4px 0; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { color: var(--gray-600); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,86,219,.15) 0%, transparent 70%);
  top: -100px; right: -100px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  position: relative;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.login-logo-text { font-size: 20px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.login-logo-text small { font-size: 12px; color: var(--gray-400); font-weight: 400; display: block; }

.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--gray-500); margin-bottom: 28px; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 16px;
}

.page-link {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.page-link:hover { background: var(--gray-100); text-decoration: none; }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; cursor: default; }

/* ---- Tooltip ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ---- Utilities ---- */
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mb-2   { margin-bottom: 8px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.mr-2   { margin-right: 8px; }
.ml-auto { margin-left: auto; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 17px; }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.text-muted  { color: var(--gray-400); }
.text-danger { color: var(--danger); }
.text-success { color: var(--secondary); }
.text-primary { color: var(--primary); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: none; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .calendar-day { min-height: 56px; }
  .form-grid-3 { grid-template-columns: 1fr; }
}
