/* Yaye Dia Agro - Custom Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Root Variables */
:root {
  --yaye-green: #22c55e;
  --yaye-green-dark: #16a34a;
  --yaye-green-light: #86efac;
  --yaye-red: #ef4444;
  --yaye-red-dark: #dc2626;
  --yaye-red-light: #fca5a5;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  line-height: 1.6;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar - Global (Vert Yaye Dia) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--yaye-green), var(--yaye-green-dark));
  border-radius: 5px;
  border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--yaye-green-dark), var(--yaye-green));
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--yaye-green) #f1f5f9;
}

/* Scrollbar pour sidebar (blanc pour contraste sur fond sombre) */
#sidebar ::-webkit-scrollbar {
  width: 6px;
}

#sidebar ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

#sidebar ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  border: none;
}

#sidebar ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

#sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

/* Sidebar Styles */
#sidebar {
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

#sidebar.minimized {
  width: 80px;
}

#sidebar.minimized .sidebar-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

#sidebar.minimized .sidebar-link {
  justify-content: center;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Active link indicator */
.sidebar-link.active {
  background: linear-gradient(90deg, var(--yaye-green), var(--yaye-green-dark));
  box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.3);
  position: relative;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: white;
  border-radius: 0 4px 4px 0;
}

.sidebar-link:not(.active):hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

/* Mobile sidebar */
@media (max-width: 1023px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 1001;
  }

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

  #topbar {
    display: flex !important;
  }

  #content {
    padding-top: 4rem;
    padding-left: 0;
    padding-right: 0;
  }

  /* Améliorer l'overlay mobile */
  #sidebar-overlay {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
}

/* Desktop content margin */
@media (min-width: 1024px) {
  #content {
    margin-left: 16rem; /* 256px = w-64 */
    margin-right: 0;
    transition: margin-left 300ms ease-in-out;
  }

  #sidebar.minimized + #topbar + #sidebar-overlay + #content,
  #sidebar.minimized ~ #content {
    margin-left: 5rem; /* 80px */
  }
}

/* Ajuster le padding des pages pour une meilleure utilisation de l'espace */
@media (min-width: 1280px) {
  #content > div {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1536px) {
  #content > div {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
  animation: slideIn 0.3s ease-in-out;
}

/* Utility Classes */
.transition-smooth {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shadow-yaye {
  box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.1), 0 2px 4px -1px rgba(34, 197, 94, 0.06);
}

.shadow-yaye-lg {
  box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.1), 0 4px 6px -2px rgba(34, 197, 94, 0.05);
}

/* Card Styles */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.card-body {
  padding: 1.5rem;
}

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

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

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

.btn-primary:hover {
  background: var(--yaye-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

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

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

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

.btn-danger:hover {
  background: var(--yaye-red-dark);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--yaye-green);
  color: var(--yaye-green);
}

.btn-outline:hover {
  background: var(--yaye-green);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.813rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* Icon buttons */
.btn-icon {
  padding: 0.5rem;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-icon-info {
  color: #3b82f6;
}

.btn-icon-info:hover {
  background: #dbeafe;
}

.btn-icon-danger {
  color: #ef4444;
}

.btn-icon-danger:hover {
  background: #fee2e2;
}

.btn-icon-success {
  color: #22c55e;
}

.btn-icon-success:hover {
  background: #dcfce7;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gray-900);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--yaye-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Select multiple (avec size) */
.form-select[size] {
  padding: 0.5rem;
}

.form-select[size] option {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
}

.form-select[size] option:hover {
  background: var(--gray-100);
}

.form-select[size] option:checked {
  background: var(--yaye-green);
  color: white;
}

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

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

.form-error {
  color: var(--yaye-red);
  font-size: 0.813rem;
  margin-top: 0.25rem;
}

.form-helper {
  color: var(--gray-500);
  font-size: 0.813rem;
  margin-top: 0.25rem;
}

/* Custom File Upload avec Camera */
.file-upload-wrapper {
  position: relative;
}

.file-upload-input {
  display: none;
}

.file-upload-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px dashed var(--gray-300);
  border-radius: 0.5rem;
  background: var(--gray-50);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--gray-600);
  font-size: 0.875rem;
}

.file-upload-trigger:hover {
  border-color: var(--yaye-green);
  background: rgba(34, 197, 94, 0.05);
  color: var(--yaye-green);
}

.file-upload-trigger svg {
  width: 1.25rem;
  height: 1.25rem;
}

.file-upload-preview {
  margin-top: 0.75rem;
  display: none;
  position: relative;
}

.file-upload-preview.active {
  display: block;
}

.file-upload-preview img {
  width: 100%;
  height: auto;
  max-height: 150px;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 2px solid var(--gray-300);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-upload-preview::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: linear-gradient(45deg, var(--yaye-green), var(--yaye-green-light));
  border-radius: 0.625rem;
  opacity: 0.1;
  z-index: -1;
}

.file-upload-actions {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.file-upload-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 2px solid;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.813rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.file-upload-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.file-upload-btn:hover::before {
  left: 100%;
}

/* Bouton Caméra - Style vert */
.file-upload-btn[data-action="camera"] {
  background: linear-gradient(135deg, var(--yaye-green), var(--yaye-green-dark));
  border-color: var(--yaye-green-dark);
  color: white;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.file-upload-btn[data-action="camera"]:hover {
  background: linear-gradient(135deg, var(--yaye-green-dark), var(--yaye-green));
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

.file-upload-btn[data-action="camera"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

/* Bouton Fichier - Style bleu */
.file-upload-btn[data-action="file"] {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #1d4ed8;
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.file-upload-btn[data-action="file"]:hover {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.file-upload-btn[data-action="file"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.file-upload-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.file-upload-btn.active {
  background: var(--yaye-green);
  border-color: var(--yaye-green);
  color: white;
}

/* Badge de nom de fichier */
.file-upload-name {
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-top: 0.5rem;
  padding: 0.375rem 0.625rem;
  background: var(--gray-100);
  border-radius: 0.375rem;
  text-align: center;
  word-break: break-all;
}

/* Section Documents */
.documents-section {
  background: linear-gradient(to bottom, var(--gray-50), white);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--gray-200);
  margin-top: 2rem;
}

.documents-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-900);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--yaye-green);
}

.documents-section h4::before {
  content: '';
  font-size: 1.5rem;
}

.document-item {
  background: white;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
}

.document-item:hover {
  border-color: var(--yaye-green);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

.document-item .form-label {
  font-size: 0.75rem;
  margin-bottom: 0.375rem;
  font-weight: 500;
}

.document-item .form-group {
  margin-bottom: 0;
}

/* Ajustements pour les boutons dans document-item */
.document-item .file-upload-actions {
  gap: 0.375rem;
  margin-bottom: 0.375rem;
}

.document-item .file-upload-btn {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
}

.document-item .file-upload-btn svg {
  width: 0.875rem;
  height: 0.875rem;
}

.document-item .file-upload-btn span {
  display: none;
}

@media (min-width: 1024px) {
  .document-item .file-upload-btn span {
    display: inline;
  }
}

.document-item .file-upload-preview img {
  max-height: 100px;
}

.document-item .file-upload-name {
  font-size: 0.688rem;
  padding: 0.25rem 0.5rem;
  margin-top: 0.375rem;
}

/* Camera Modal */
.camera-modal {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 100;
  display: none;
  flex-direction: column;
}

.camera-modal.active {
  display: flex;
}

.camera-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
}

.camera-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.8);
}

.camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--yaye-green);
  cursor: pointer;
  transition: all 0.2s ease;
}

.camera-btn:hover {
  transform: scale(1.1);
}

.camera-btn svg {
  width: 2rem;
  height: 2rem;
  color: white;
}

.camera-btn.secondary {
  width: 50px;
  height: 50px;
  background: var(--gray-600);
}

.camera-btn.secondary svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  border-radius: 9999px;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

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

/* Table Styles */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Scrollbar for table containers */
.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--yaye-green), var(--yaye-green-dark));
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, var(--yaye-green-dark), var(--yaye-green));
}

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

.table thead {
  background: var(--gray-50);
}

.table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.813rem;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-200);
}

.table td {
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-200);
}

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

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

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.2s ease-in-out;
  padding: 1rem;
}

/* Overlay avec effet de flou */
.modal-overlay-blur {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Animation d'entrée améliorée pour modal avec blur */
.modal-overlay-blur .modal {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Styles spécifiques pour modal détails cotisation */
.modal-details-cotisation {
  overflow: hidden;
}

.modal-details-cotisation .modal-header {
  border-bottom: none;
  padding: 1.25rem 1.5rem;
}

.modal-details-cotisation .modal-body {
  padding: 0;
  max-height: calc(90vh - 180px);
}

.modal-details-cotisation .modal-footer {
  border-top: none;
  padding: 1rem 1.5rem;
}

/* Styles communs pour toutes les modales de détails stylisées */
.modal-details-styled {
  overflow: hidden;
}

.modal-details-styled .modal-header {
  border-bottom: none;
  padding: 1.25rem 1.5rem;
}

.modal-details-styled .modal-body {
  padding: 0;
  max-height: calc(90vh - 180px);
  overflow-y: auto;
}

.modal-details-styled .modal-footer {
  border-top: none;
  padding: 1rem 1.5rem;
}

/* Scrollbar pour modal-body des modales stylisées */
.modal-details-styled .modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-details-styled .modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.modal-details-styled .modal-body::-webkit-scrollbar-thumb {
  background: var(--yaye-green);
  border-radius: 4px;
}

.modal-details-styled .modal-body::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* Firefox scrollbar */
.modal-details-styled .modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--yaye-green) #f1f1f1;
}

/* Border bottom utility for tabs */
.border-b-3 {
  border-bottom-width: 3px;
  border-bottom-style: solid;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: fadeIn 0.3s ease-in-out;
}

.modal-lg {
  max-width: 800px;
  width: 92%;
}

.modal-xl {
  max-width: 1200px;
  width: 95%;
}

/* Responsivité mobile pour modal */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-start;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-xl {
    width: 100%;
    max-width: 100%;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-header,
  .modal-footer {
    padding: 1rem;
  }

  /* Tabs en scroll horizontal sur mobile */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .tab-button svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Tabs Styles */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--gray-600);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-button:hover {
  color: var(--yaye-green);
  background: var(--gray-50);
}

.tab-button.active {
  color: var(--yaye-green);
  border-bottom-color: var(--yaye-green);
  background: var(--yaye-green-50);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

/* Table Tab Content for List View */
.table-tab-content {
  display: none;
}

.table-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

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

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

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

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

.close-modal-btn:active {
  background: var(--gray-200);
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* Green scrollbars for modals */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--yaye-green);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* Firefox scrollbar */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--yaye-green) #f1f1f1;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Alert Styles */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

.alert-success {
  background: #dcfce7;
  color: #15803d;
  border-left: 4px solid #22c55e;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--yaye-green);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Stats Card */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

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

.stat-change {
  font-size: 0.813rem;
  margin-top: 0.5rem;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
  /* Cards compacts */
  .card {
    margin-bottom: 1rem;
    border-radius: 0.75rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-header {
    padding: 1rem;
    font-size: 1rem;
  }

  /* Modals en plein écran */
  .modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  /* Tables responsive - Scroll horizontal */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  .table {
    min-width: 600px; /* Force scroll sur petits écrans */
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.813rem;
    white-space: nowrap;
  }

  /* Cacher certaines colonnes sur mobile */
  .table .hide-mobile {
    display: none;
  }

  /* Stats plus compacts */
  .stat-value {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* Forms */
  .form-group {
    margin-bottom: 1rem;
  }

  .form-control,
  .form-select {
    font-size: 16px; /* Évite le zoom sur iOS */
  }

  /* Boutons */
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
    border-radius: 0.375rem !important;
    margin-bottom: 0.5rem;
  }

  /* Modal footer en colonne */
  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Actions buttons en stack */
  .actions-mobile-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-mobile-stack .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Grilles en 1 colonne */
  .grid-mobile-single {
    grid-template-columns: 1fr !important;
  }
}

/* Très petits écrans */
@media (max-width: 480px) {
  /* Boutons d'upload empilés */
  .file-upload-actions {
    flex-direction: column;
  }

  .file-upload-btn {
    width: 100%;
  }

  /* Titre du modal plus petit */
  .modal-title {
    font-size: 1.125rem;
  }

  /* Documents en 2 colonnes sur mobile */
  .documents-section .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .documents-section {
    padding: 1rem;
  }

  .documents-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--yaye-green);
  outline-offset: 2px;
}
