/* ==========================================================
   🌈 STYLE GLOBAL — Tableau de Bord 2025
   Auteur : Dr. Farouk Bourihane
   Version : Responsive Pro 2025
   ========================================================== */

/* ======== BASE ======== */
body {
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f9fafb 100%);
  margin: 20px;
  color: #1e293b;
  transition: background 0.5s ease;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h2::before {
  content: "📊";
}

/* ======== FILTRES ======== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.85);
  padding: 10px 15px;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(6px);
}

select,
button,
input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  background: white;
  transition: all 0.3s ease;
}

select:hover,
input:hover {
  border-color: #2563eb;
}

button {
  background: #2563eb;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}
button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* ======== CARDS ======== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(145deg, #ffffff, #f0f4ff);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(200, 200, 255, 0.25);
  transition: all 0.3s ease;
  animation: fadeIn 0.6s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.card::after {
  content: "";
  position: absolute;
  top: -30%;
  right: -30%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.3), transparent 70%);
  opacity: 0.3;
}

.card i {
  font-size: 2rem;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* === Dégradés lumineux modernes === */
.qte i    { background: linear-gradient(135deg, #a855f7, #ec4899); }
.achat i  { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.vente i  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.marge i  { background: linear-gradient(135deg, #f97316, #f59e0b); }

.card-content h3 {
  margin: 0;
  font-size: 1rem;
  color: #334155;
  font-weight: 600;
}

.card-content p {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f172a;
  margin: 4px 0 0;
  transition: opacity 0.3s;
}

/* Animation douce */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ======== MODAL PRODUITS ======== */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.55);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 80%;
  max-width: 650px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.4s ease;
}

.modal-content h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: #1e3a8a;
}

.modal-content table {
  width: 100%;
  font-size: 0.9rem;
}

.close-modal {
  float: right;
  cursor: pointer;
  font-size: 1.5rem;
  color: #ef4444;
  transition: 0.2s;
}
.close-modal:hover {
  transform: scale(1.1);
}

/* ======== TABLE DATATABLE ======== */
table.dataTable {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}
table.dataTable thead th {
  background-color: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
}
.dataTables_wrapper .dataTables_filter input {
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 5px;
}

/* ======== RESPONSIVE ======== */

/* 📱 TABLETTE */
@media (max-width: 992px) {
  .cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .card {
    padding: 15px;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* 📱 MOBILE */
@media (max-width: 768px) {
  header h2 {
    font-size: 1.3rem;
    text-align: center;
    width: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card {
    padding: 15px;
    gap: 10px;
    flex-direction: row;
    align-items: center;
  }

  .card i {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  .card-content h3 { font-size: 0.95rem; }
  .card-content p { font-size: 1.15rem; }

  .filters {
    padding: 10px;
  }

  .filters select,
  .filters input,
  .filters button {
    width: 100%;
    font-size: 0.9rem;
  }

  button {
    padding: 8px;
  }

  table.dataTable {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.85rem;
  }
}

/* 📱 PETIT MOBILE */
@media (max-width: 480px) {
  body { margin: 10px; }
  .card { padding: 12px; border-radius: 12px; }
  .card i { width: 42px; height: 42px; font-size: 1.3rem; }
  .filters { gap: 8px; }
}
