/* ==========================================================================
   Base & Overlays
   ========================================================================== */

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
  display: flex !important;
}

.modal-content-qv {
  background: var(--bg-primary);
  border-radius: 12px;
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

/* Photo Modal */
.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.photo-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.photo-modal-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
}

.photo-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.photo-modal-close:hover {
  transform: scale(1.1);
}

.photo-modal-title {
  color: white;
  text-align: center;
  margin-top: 15px;
  font-weight: 500;
}


/* ==========================================================================
   Modals Headers & Closing Buttons
   ========================================================================== */

/* Quick View Modal Header */
.modal-header-qv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--input-border);
}

.modal-header-qv h2 {
  margin: 0;
  color: var(--text-primary);
}

.modal-header-qv h2 i {
  color: var(--accent-color);
  margin-right: 8px;
}

.modal-close-qv {
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition-fast);
  padding: 5px;
  border-radius: var(--radius-sm);
}

.modal-close-qv:hover {
  opacity: 1;
  color: var(--accent-color);
  background: rgba(69, 183, 175, 0.1);
}

/* ==========================================================================
   Documents List View
   ========================================================================== */

/* Documents View Header */
.documents-view-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--input-border);
}

.documents-view-header h3 {
  margin: 0;
  flex: 1;
  color: var(--text-primary);
}

.btn-back {
  background: var(--bg-tertiary);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-weight: 500;
}

.btn-back:hover {
  background: var(--hover-bg);
  transform: translateX(-2px);
}


/* Document List Modal (General List) */
.modal-body {
  margin-top: 20px;
  font-size: 15px;
}

.documents-list {
  max-height: 400px;
  overflow-y: auto;
}

.document-item {
  padding: 12px;
  margin-right: 5px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--bg-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.document-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.document-meta {
  font-size: 0.85em;
  color: var(--text-secondary);
}

/* ==========================================================================
   Document Grid View (Detail View)
   ========================================================================== */

.documents-grid {
  display: flex;
  flex-direction: column;
  /*grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));*/
  gap: 15px;
}

.document-card {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--input-border);
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.document-info {
  flex: 1;
}

.document-desc,
.document-preview {
  word-break: break-all;
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.document-source {
  font-size: 0.85em;
  color: var(--accent-color);
  margin-top: 8px;
}

.document-size {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-top: 5px;
}

/* Photo-specific cards */
.photo-card {
  cursor: default;
}

.photo-preview {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  justify-content: center;
}

.photo-preview img {
  max-width: 100%;
  height: auto;
}

/* Note Detail */
.note-detail {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 20px;
}

.note-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--input-border);
  font-size: 0.9em;
  color: var(--text-secondary);
}

.note-meta i {
  margin-right: 5px;
}

.note-content {
  color: var(--text-primary);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.note-content a {
  color: var(--accent-color);
  text-decoration: none;
}

.note-content a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Badges, Icons & Clipping
   ========================================================================== */

/* Trombone sur le bouton du panel */
.doc-clip {
  position: absolute;
  top: 1px;
  right: 98px;
  font-size: 0.75em;
  color: #f39c12;
  transform: rotate(135deg);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Badges de couleur */
.note-card {
  display: flex;
  gap: 10px;
}

.badge-note-membre {
  /*font-size: 1.8em;*/
  color: #1976d2;
}

.badge-note-mariage {
  /*font-size: 1.8em;*/
  color: #c2185b;
}

.badge-documents {
  /*font-size: 1.8rem;*/
  color: #e65100;
}

.badge-pdf {
  /*font-size: 1.8em;*/
  color: #f43636;
}

.badge-photos {
  /*font-size: 1.8em;*/
  color: #2e7d32;
}

.badge-note-naissance {
  /*font-size: 1.8em;*/
  color: #ff69b4;
}

.badge-note-deces {
  /*font-size: 1.8em;*/
  color: #607d8b;
}

.badge-note-heart {
  color: #30eb36;
}

/* Badges de comptage */
.doc-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 24px;
  text-align: center;
  border-radius: 50%;
  font-size: 1.4em;
  font-weight: 600;
  margin: 0 2px;
  padding: 0 8px;
}

.doc-count-badge[style*="cursor: pointer"]:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

/* Badges de type de document dans la liste */
.document-type-badge {
  padding: 4px 6px 0px 0px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.document-type-note {
  /*background: #c9e9ff;*/
  color: #1976d2;
}

.document-type-mariage {
  /*background: #fde4f0;*/
  color: #c2185b;
}

.document-type-document {
  /*background: #fff4e5;*/
  color: #e65100;
}

.document-type-pdf {
  /*background: #fff3e0;*/
  color: #f43636;
}

.document-type-photo {
  /*background: #e5f5e6;*/
  color: #2e7d32;
}

.document-type-naissance {
  /*background: #ffd0e7;*/
  color: #ff69b4;
}

.document-type-deces {
  /*background: #b4e6ff;*/
  color: #607d8b;
}

.document-type-vie_deces {
  /*background: #b4e6ff;*/
  color: #3F51B5;
}

/* Icônes de documents dans le tableau */
.doc-icon {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.doc-icon:hover {
  transform: scale(1.1);
}

.doc-icon i {
  font-size: 1.3em;
}

.doc-icon-count {
  font-size: 0.9em;
  margin-left: 4px;
}

.doc-icon-documents {
  color: #e65100;
}

.doc-icon-pdf {
  color: #f43636;
}

.doc-icon-photos {
  color: #2e7d32;
}


/* ==========================================================================
   Forms & Upload
   ========================================================================== */

/* Upload de fichiers */
.file-upload-zone {
  border: 2px dashed var(--input-border);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  margin: 15px 0;
  background: var(--form-section-bg);
  transition: all var(--transition-base);
  cursor: pointer;
}

.file-upload-zone:hover {
  border-color: var(--accent-color);
  background: rgba(69, 183, 175, 0.05);
}

.file-upload-zone i {
  font-size: 3em;
  color: var(--accent-color);
  margin-bottom: 15px;
}

#noteContent,
#simpleNoteContent {
  min-height: 150px;
  resize: vertical;
}

/* Sélecteur de type */
.type-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.type-btn {
  flex: 1;
  padding: 6px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--bg-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.type-btn:hover {
  border-color: var(--accent-color);
  background: rgba(69, 183, 175, 0.05);
}

.type-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.document-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-view,
.btn-download {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.btn-download {
  background: #2e7d32;
}

.btn-view:hover {
  background: #2980b9;
}

.btn-download:hover {
  background: #1b5e20;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: var(--hover-bg);
}

.btn-danger {
  background: #f44336;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger:hover {
  background: #d32f2f;
  transform: translateY(-1px);
}


/* ==========================================================================
   Filters
   ========================================================================== */

.filter-container {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding: 15px 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin: 0 20px 15px 20px;
  box-shadow: var(--shadow-sm);
  justify-content: center;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid var(--input-border);
  background: var(--bg-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent-color);
  background: var(--form-section-bg);
}

.filter-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.filter-btn i {
  font-size: 1em;
}

.filter-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.85em;
  font-weight: 600;
}

.filter-btn.active .filter-count {
  background: rgba(255, 255, 255, 0.3);
}


/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes clipBounce {
  0% {
    transform: rotate(45deg) scale(0);
  }

  50% {
    transform: rotate(45deg) scale(1.2);
  }

  100% {
    transform: rotate(45deg) scale(1);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(400px);
    opacity: 0;
  }
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .modal-content-qv {
    width: 92%;
    padding: 20px;
  }

  /* Document Cards */
  .document-actions {
    justify-content: flex-start;
  }
}