/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
  /* Couleurs principales (similaires à l'app mobile) */
  --primary-teal: #0D9488;
  --secondary-teal: #14B8A6;
  --light-teal: #CCFBF1;

  /* Arrière-plans */
  --bg-light: #F8FAFC;
  --card-white: #FFFFFF;
  --card-gray: #F1F5F9;

  /* Textes */
  --text-dark: #1E293B;
  --text-gray: #64748B;
  --text-light: #94A3B8;

  /* Statuts */
  --status-pending: #F59E0B;
  --status-validated: #10B981;
  --status-paid: #3B82F6;
  --status-cancelled: #EF4444;

  /* Bordures */
  --border-color: #E2E8F0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Ombres */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
}

/* ============================================
   PAGE LOGIN
   ============================================ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card-white);
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 450px;
}

.login-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: var(--light-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-icon svg {
  width: 48px;
  height: 48px;
  color: var(--primary-teal);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.login-subtitle {
  font-size: 14px;
  text-align: center;
  color: var(--text-gray);
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-input.error {
  border-color: var(--status-cancelled);
}

.error-message {
  color: var(--status-cancelled);
  font-size: 12px;
  margin-top: 4px;
}

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--secondary-teal);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-spinner {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--card-white);
  border-right: 1px solid var(--border-color);
  padding: 24px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-teal);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.sidebar-menu {
  margin-top: 24px;
}

.menu-item {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-gray);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  background: var(--bg-light);
  color: var(--primary-teal);
}

.menu-item.active {
  background: var(--light-teal);
  color: var(--primary-teal);
  border-left-color: var(--primary-teal);
  font-weight: 600;
}

.menu-item-icon {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-teal);
  font-weight: 600;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.user-role {
  font-size: 12px;
  color: var(--text-gray);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 24px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-gray);
}

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

.stat-card {
  background: var(--card-white);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-title {
  font-size: 14px;
  color: var(--text-gray);
  font-weight: 500;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.primary {
  background: var(--light-teal);
  color: var(--primary-teal);
}

.stat-icon.warning {
  background: #FEF3C7;
  color: var(--status-pending);
}

.stat-icon.success {
  background: #D1FAE5;
  color: var(--status-validated);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-dark);
}

/* ============================================
   TABLE
   ============================================ */
.card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.card-actions {
  display: flex;
  gap: 12px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

.btn-outline:hover {
  background: var(--bg-light);
}

.table-container {
  overflow-x: auto;
}

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

.table th {
  background: var(--bg-light);
  padding: 12px 24px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-dark);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover {
  background: var(--bg-light);
}

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

.badge-pending {
  background: #FEF3C7;
  color: #92400E;
}

.badge-validated {
  background: #D1FAE5;
  color: #065F46;
}

.badge-paid {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-cancelled {
  background: #FEE2E2;
  color: #991B1B;
}

/* NOUVEAU FLUX SIMPLIFIÉ (6 statuts) */
.badge-info {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-warning {
  background: #F3E8FF;
  color: #7C3AED;
}

.badge-success {
  background: #D1FAE5;
  color: #065F46;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.tab {
  padding: 12px 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-gray);
  font-weight: 500;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--primary-teal);
}

.tab.active {
  color: var(--primary-teal);
  border-bottom-color: var(--primary-teal);
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

.loading-container {
  padding: 48px;
  text-align: center;
}

.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--text-gray);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--text-light);
}

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

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

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

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