/* ============================================
   PRODUITS DIGITAUX — Styles
   ============================================ */

.digital-loading {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
}

/* Sélecteur de type */
.digital-selector {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

.digital-selector h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.digital-subtitle {
  color: #666;
  margin-bottom: 32px;
}

.digital-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.digital-type-card {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.digital-type-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

.digital-type-card .digital-type-icon {
  color: #6366f1;
  margin-bottom: 12px;
}

.digital-type-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.digital-type-card p {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

.digital-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: #eef2ff;
  color: #6366f1;
  font-size: 11px;
  font-weight: 600;
}

/* Dashboard */
.digital-dashboard {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.digital-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.digital-dashboard-header h2 {
  font-size: 22px;
  margin: 0;
}

.digital-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

/* Tabs */
.digital-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
}

.digital-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  transition: all 0.2s;
}

.digital-tab.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

/* Grid produits */
.digital-produits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.digital-produit-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.digital-produit-card:hover {
  border-color: #6366f1;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.1);
}

.card-header {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.digital-produit-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.card-prix {
  font-weight: 600;
  color: #059669;
  margin: 8px 0;
}

.card-meta {
  font-size: 12px;
  color: #9ca3af;
}

/* Badges */
.digital-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.digital-badge.type-fichier { background: #dbeafe; color: #2563eb; }
.digital-badge.type-licence { background: #fef3c7; color: #d97706; }
.digital-badge.type-bundle { background: #ede9fe; color: #7c3aed; }
.digital-badge.type-coaching { background: #d1fae5; color: #059669; }

.digital-badge.status-brouillon { background: #f3f4f6; color: #6b7280; }
.digital-badge.status-actif { background: #d1fae5; color: #059669; }
.digital-badge.status-archive { background: #fee2e2; color: #dc2626; }
.digital-badge.status-active { background: #d1fae5; color: #059669; }
.digital-badge.status-expired { background: #fee2e2; color: #dc2626; }
.digital-badge.status-revoked { background: #fef3c7; color: #d97706; }
.digital-badge.status-disponible { background: #e0e7ff; color: #4f46e5; }

.digital-restriction-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #1f2937;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Empty state */
.digital-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

/* Formulaire stepper */
.digital-form {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

.digital-form-header {
  margin-bottom: 20px;
}

.digital-form-header h2 {
  font-size: 20px;
  margin: 0 0 8px 0;
}

.digital-stepper {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.step {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  background: #f9fafb;
  transition: all 0.3s;
}

.step.active {
  color: #fff;
  background: #6366f1;
}

.step.completed {
  color: #059669;
  background: #d1fae5;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: #6366f1;
  background: #f5f3ff;
}

.upload-zone svg {
  color: #9ca3af;
  margin-bottom: 12px;
}

.upload-zone p {
  color: #6b7280;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 12px;
  color: #9ca3af !important;
}

.upload-progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 4px;
  transition: width 0.3s;
  width: 0%;
}

.upload-success {
  text-align: center;
  padding: 20px;
}

.upload-success svg { margin-bottom: 12px; }
.upload-success p { margin-bottom: 4px; }

/* Form elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #374151;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-hint {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
  display: block;
}

.input-group {
  display: flex;
  align-items: center;
}

.input-prefix {
  padding: 10px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 14px;
  color: #6b7280;
}

.input-group .form-input {
  border-radius: 0 8px 8px 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

.form-actions .btn { min-width: 120px; }

/* Boutons */
.btn { padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-block { width: 100%; }

/* Détail produit */
.digital-detail, .digital-public-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.digital-detail-header, .public-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.digital-detail-header h2 { font-size: 22px; margin: 0; }

.detail-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.detail-section h3 {
  font-size: 16px;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.fichier-item, .creneau-item, .bundle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f9fafb;
}

.fichier-size { font-size: 12px; color: #9ca3af; }

/* Tableau licences */
.licences-table {
  overflow-x: auto;
}

.licences-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.licences-table th, .licences-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.licences-table th {
  font-weight: 600;
  color: #6b7280;
  font-size: 12px;
}

.licences-table code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Public detail */
.public-detail-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.public-detail-main h1 { font-size: 28px; margin-bottom: 16px; }
.public-detail-desc { color: #4b5563; line-height: 1.6; margin-bottom: 16px; }
.public-detail-vendeur { display: flex; align-items: center; gap: 10px; }
.public-detail-vendeur img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.prix-card {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  position: sticky;
  top: 20px;
}

.prix-option {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.prix-label { font-size: 14px; color: #4b5563; }
.prix-value { font-weight: 600; color: #059669; }

.prix-card .btn-block { margin-top: 16px; }

/* Catalogue public */
.catalogue-digital {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.catalogue-digital h2 { font-size: 24px; margin-bottom: 20px; }

.catalogue-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.filter-btn.active {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

.filter-btn:hover:not(.active) {
  border-color: #6366f1;
  color: #6366f1;
}

.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.catalogue-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
}

.catalogue-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.catalogue-card h3 { font-size: 16px; margin: 8px 0; }
.catalogue-card-desc { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.catalogue-card-prix { font-weight: 700; color: #059669; margin: 8px 0; }
.catalogue-card-vendeur { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9ca3af; }
.catalogue-card-vendeur img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.catalogue-card-link { display: inline-block; margin-top: 12px; color: #6366f1; font-size: 13px; font-weight: 500; text-decoration: none; }

.catalogue-card-type { margin-bottom: 4px; }

/* Portail client */
.portail-digital {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.portail-digital h2 { font-size: 22px; margin-bottom: 20px; }

.portail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.portail-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s;
}

.portail-tab.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

/* Achat card dans portail */
.achat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.achat-card h4 { margin: 0 0 4px 0; font-size: 15px; }
.achat-card .achat-meta { font-size: 12px; color: #9ca3af; }
.achat-card .achat-actions { display: flex; gap: 8px; }

/* Lecteur PDF R1 */
.pdf-reader-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.pdf-reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.pdf-reader-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-reader-toolbar button {
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.pdf-reader-toolbar button:hover { background: #e5e7eb; }

.pdf-reader-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 60px;
  color: rgba(99, 102, 241, 0.06);
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  user-select: none;
  font-weight: 700;
}

.pdf-reader-page {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  margin: 0 auto 12px;
  overflow: hidden;
}

.pdf-reader-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-page-input {
  width: 60px;
  text-align: center;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
}

.pdf-canvas-page {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.pdf-reader-container {
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================
   LICENCE MANAGEMENT
   ============================================ */

.lic-keys-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.lic-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lic-stats .stat-card {
  padding: 10px 14px;
  min-width: 80px;
}

.lic-stats .stat-value {
  font-size: 18px;
}

.lic-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lic-keys-table {
  overflow-x: auto;
  margin-bottom: 16px;
}

.lic-keys-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lic-keys-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  font-size: 12px;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}

.lic-keys-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
}

.lic-keys-table code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

.lic-keys-table tr:hover td {
  background: #f9fafb;
}

/* ============================================
   COACHING MANAGEMENT
   ============================================ */

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

.coach-creneaux-header h3 {
  font-size: 16px;
  margin: 0;
}

.creneau-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 8px;
}

.creneau-row .form-input {
  padding: 6px 10px;
  font-size: 13px;
}

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

/* Bundle selector */
.bundle-select-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 4px;
}

.bundle-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.bundle-check-item:hover {
  background: #f5f3ff;
}

.bundle-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
}

/* ============================================
   PORTRAIL — Enhanced Tables
   ============================================ */

.portail-content .licences-table table {
  font-size: 13px;
}

.portail-content .licences-table th {
  padding: 10px 12px;
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.portail-content .licences-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.portail-content .licences-table code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

.portail-content .licences-table tr:hover td {
  background: #f9fafb;
}

/* Responsive */
@media (max-width: 768px) {
  .digital-types-grid { grid-template-columns: repeat(2, 1fr); }
  .digital-produits-grid, .catalogue-grid { grid-template-columns: 1fr; }
  .public-detail-body { grid-template-columns: 1fr; }
  .digital-stats-cards { grid-template-columns: repeat(2, 1fr); }
  .digital-dashboard-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .digital-form { padding: 16px; }
  .achat-card { flex-direction: column; align-items: stretch; }
  .achat-card .achat-actions { justify-content: flex-end; }
}
