/* === VARIABLES === */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --secondary: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  --info: #4285f4;
  --dark: #202124;
  --gray-900: #3c4043;
  --gray-700: #5f6368;
  --gray-500: #9aa0a6;
  --gray-300: #dadce0;
  --gray-100: #f1f3f4;
  --white: #ffffff;
  --bg: #f8f9fa;
  --sidebar-width: 260px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 8px;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
}

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

/* === LAYOUT === */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: var(--white);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
}

.sidebar-header .subtitle {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

.sidebar-nav {
  padding: 10px 0;
}

.sidebar-nav .nav-section {
  padding: 10px 20px 5px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: 1px;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--gray-300);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

.sidebar-nav a.active {
  background: rgba(26, 115, 232, 0.15);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-nav a .icon {
  margin-right: 12px;
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-user {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 20px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user .user-info {
  font-size: 13px;
  color: var(--gray-300);
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}

/* === TOP BAR === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.top-bar h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--dark);
}

.breadcrumb {
  font-size: 13px;
  color: var(--gray-700);
}

/* === CARDS === */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #e6f4ea; color: var(--secondary); }
.stat-icon.red { background: #fce8e6; color: var(--danger); }
.stat-icon.yellow { background: #fef7e0; color: #e37400; }

.stat-info h4 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-info p {
  font-size: 13px;
  color: var(--gray-700);
  margin-top: 4px;
}

/* === TABLE === */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-300);
}

table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
}

table tr:hover {
  background: var(--gray-100);
}

table td.text-right, table th.text-right {
  text-align: right;
}

table td.text-center, table th.text-center {
  text-align: center;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }

.btn-success { background: var(--secondary); color: var(--white); }
.btn-success:hover { background: #2d9249; color: var(--white); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #d33426; color: var(--white); }

.btn-warning { background: var(--warning); color: var(--dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-group { display: flex; gap: 6px; }

/* === FORMS === */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  background: var(--white);
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235f6368' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-inline .form-group {
  margin-bottom: 0;
}

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-present { background: #e6f4ea; color: #1e8e3e; }
.badge-absent { background: #fce8e6; color: #d93025; }
.badge-retard { background: #fef7e0; color: #e37400; }
.badge-conge { background: var(--primary-light); color: var(--primary); }
.badge-maladie { background: #f3e8fd; color: #8430ce; }
.badge-brouillon { background: var(--gray-100); color: var(--gray-700); }
.badge-valide { background: #e6f4ea; color: #1e8e3e; }
.badge-paye { background: var(--primary-light); color: var(--primary); }
.badge-admin { background: #fce8e6; color: #d93025; }
.badge-superviseur { background: var(--primary-light); color: var(--primary); }
.badge-jour { background: #fef7e0; color: #e37400; }
.badge-nuit { background: #e8eaf6; color: #3f51b5; }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: #e6f4ea; color: #1e8e3e; border: 1px solid #ceead6; }
.alert-error { background: #fce8e6; color: #d93025; border: 1px solid #f5c6c0; }
.alert-warning { background: #fef7e0; color: #e37400; border: 1px solid #fde293; }
.alert-info { background: var(--primary-light); color: var(--primary); border: 1px solid #d2e3fc; }

/* === POINTAGE TABLE === */
.pointage-table input[type="time"] {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  width: 110px;
}

.pointage-table select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}

.pointage-table .checkbox-cell {
  text-align: center;
}

.pointage-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* === FILTER BAR === */
.filter-bar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

/* === AUTH PAGE === */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a73e8 0%, #34a853 100%);
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--dark);
}

.auth-card .subtitle {
  text-align: center;
  color: var(--gray-700);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-card .form-control {
  padding: 12px;
}

.auth-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  justify-content: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-wrap: wrap;
  }
}

/* === MISC === */
.text-muted { color: var(--gray-700); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--secondary); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 16px; }
.fw-bold { font-weight: 700; }
.fs-large { font-size: 18px; }
