/* ===========================
   TURONE CRM — DESIGN SYSTEM 2.0
   Version Épurée / Minimaliste
   =========================== */

:root {
  /* Couleurs principales */
  --primary: #C93B00;
  --primary-light: #FF6B35;
  --primary-dark: #9A2E00;

  /* Niveaux de gris */
  --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;

  /* Couleurs sémantiques */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* Dimensions */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;

  /* 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);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ===========================
   RESET & BASE
   =========================== */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===========================
   TYPOGRAPHIE
   =========================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--gray-900);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ===========================
   LAYOUT
   =========================== */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 40;
}

.sidebar-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  color: var(--gray-900);
  text-decoration: none;
}

.brand-icon {
  color: var(--primary);
  width: 24px;
  height: 24px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--space-xl);
}

.nav-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: var(--space-sm);
  padding-left: var(--space-sm);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--gray-600);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-link.active {
  background: var(--primary);
  color: white;
}

.nav-link .icon {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--gray-200);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* Header */
.main-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-md) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.user-menu:hover {
  background: var(--gray-100);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

/* ===========================
   COMPONENTS
   =========================== */

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

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

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

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

.btn-outline:hover {
  background: var(--gray-50);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
}

.btn-lg {
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
}

.btn-icon {
  padding: var(--space-sm);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

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

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

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

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

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Alerts */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  border: 1px solid;
}

.alert-success {
  background: #D1FAE5;
  border-color: #A7F3D0;
  color: #065F46;
}

.alert-warning {
  background: #FEF3C7;
  border-color: #FDE68A;
  color: #92400E;
}

.alert-danger {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #991B1B;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}

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

.table th {
  background: var(--gray-50);
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

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

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--gray-700);
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: all 0.15s ease;
  background: white;
}

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

.form-control::placeholder {
  color: var(--gray-400);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* Stats & Metrics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  margin-top: var(--space-xs);
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--gray-500);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--gray-300);
  margin-bottom: var(--space-lg);
}

/* ===========================
   UTILITIES
   =========================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.p-4 { padding: var(--space-lg); }
.p-6 { padding: var(--space-xl); }

.mt-2 { margin-top: var(--space-sm); }
.mt-4 { margin-top: var(--space-lg); }
.mt-6 { margin-top: var(--space-xl); }
.mt-8 { margin-top: var(--space-2xl); }

.mb-2 { margin-bottom: var(--space-sm); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-6 { margin-bottom: var(--space-xl); }
.mb-8 { margin-bottom: var(--space-2xl); }

.gap-2 { gap: var(--space-sm); }
.gap-4 { gap: var(--space-lg); }
.gap-6 { gap: var(--space-xl); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }

.grid { display: grid; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden {
  display: none !important;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.flex {
  display: flex;
}
/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
  }
}

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

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

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

  .mobile-menu-toggle {
    display: block;
  }

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

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

@media (max-width: 640px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .header-actions {
    flex-wrap: wrap;
  }
}
/* Modal backdrop */
.fixed {
  position: fixed;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.bg-black {
  background-color: rgba(0, 0, 0, 1);
}

.bg-opacity-50 {
  opacity: 0.5;
}

.z-50 {
  z-index: 50;
}

/* Flex utilities */
.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

/* Padding utilities */
.p-4 {
  padding: var(--space-lg);
}

/* Max width/height */
.max-w-2xl {
  max-width: 42rem; /* 672px */
}

.max-h-\[90vh\] {
  max-height: 90vh;
}

/* Overflow */
.overflow-y-auto {
  overflow-y: auto;
}

/* Rounded corners */
.rounded-lg {
  border-radius: var(--radius-lg);
}

/* Border */
.border-b {
  border-bottom: 1px solid var(--gray-200);
}

/* Text */
.text-lg {
  font-size: 1.125rem;
}

.font-semibold {
  font-weight: 600;
}
/* ===========================
   MODALES AMÉLIORÉES
   =========================== */

/* Overlay modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.2s ease-out;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Contenu modal */
.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* Header modal */
.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.modal-close {
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    color: var(--gray-500);
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Body modal */
.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* Footer modal */
.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* Form dans modal */
.modal-body .form-grid {
    margin-bottom: 0;
}

.modal-body .form-group {
    margin-bottom: var(--space-md);
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Scrollbar pour le body modal */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Responsive modales */
@media (max-width: 640px) {
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-body {
        max-height: calc(100vh - 140px);
    }
}
/* Correction pour les boutons d'œil dans les champs de mot de passe */
.form-group .relative {
    position: relative;
}

.form-group .absolute {
    position: absolute;
}

.form-group .inset-y-0 {
    top: 0;
    bottom: 0;
}

.form-group .right-0 {
    right: 0;
}

.form-group .pr-3 {
    padding-right: var(--space-md);
}

.form-group .flex {
    display: flex;
}

.form-group .items-center {
    align-items: center;
}

/* Correction spécifique pour les inputs avec bouton */
.form-control[type="password"],
.form-control[type="text"] {
    padding-right: 40px; /* Plus d'espace pour le bouton */
}
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper .form-control {
    padding-right: 40px;
    width: 100%;
}

.password-input-wrapper .password-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-md);
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    transition: color 0.15s ease;
}

.password-input-wrapper .password-toggle:hover {
    color: var(--gray-600);
}
/* Style principal des onglets */
.tabs-container {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
    position: relative;
}

.tabs-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.tabs-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    outline: none;
}

.tab-btn:hover {
    color: #374151;
    background-color: #f9fafb;
}


.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #C93B00;
    animation: slideIn 0.3s ease;
}

/* Icônes dans les onglets */
.tab-btn i {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.tab-btn.active i {
    color: #C93B00;
    transform: scale(1.1);
}

.tab-btn:hover i {
    transform: translateY(-1px);
}

/* Effet de ripple */
.tab-btn {
    position: relative;
    overflow: hidden;
}

/* Indicateur actif */
.active-indicator {
    position: absolute;
    bottom: -1px;
    height: 2px;
    background-color: #C93B00;
    transition: all 0.3s ease;
    border-radius: 1px 1px 0 0;
}

/* Animation pour les onglets */
.tab-content {
    animation: fadeInUp 0.3s ease;
}

/* Badge de notification optionnel */
.tab-badge {
    margin-left: 0.5rem;
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .tab-btn i {
        width: 0.875rem;
        height: 0.875rem;
        margin-right: 0.375rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}


/* Effet de glissement pour mobile */
@media (max-width: 640px) {
    .tabs-container {
        position: relative;
    }

    .tabs-scroll::before,
    .tabs-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 10;
    }

    .tabs-scroll::before {
        left: 0;
        background: linear-gradient(to right, white, transparent);
    }

    .tabs-scroll::after {
        right: 0;
        background: linear-gradient(to left, white, transparent);
    }
}
.logo-container {
    margin-bottom: 1rem;
}

.logo-crm {
    max-width: 100px;
    height: auto;
    margin: 0 auto;
    display: block;
    text-align: center;
}
