/* ========================================
   All Documents Page Styles
   تصميم صفحة جميع المستندات
   ======================================== */

.documents-page-wrapper {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ========================================
   Header Section
   ======================================== */

.documents-header {
  margin-bottom: 30px;
}

.documents-title-section {
  margin-bottom: 20px;
}

.documents-main-title {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.documents-main-title i {
  color: #667eea;
  font-size: 32px;
}

.documents-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Statistics Cards */
.documents-stats-cards {
  margin-top: 20px;
}

/* استخدام نفس تنسيق main-stat-card من stats.css */
/* البطاقات سترث التنسيق من .main-stat-card */

/* ألوان مخصصة لبطاقات المستندات */
.documents-stats-cards .main-stat-card.stat-total {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.documents-stats-cards .main-stat-card.stat-active {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.documents-stats-cards .main-stat-card.stat-expiring {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.documents-stats-cards .main-stat-card.stat-expired {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

/* تأثير تدرج الظهور للبطاقات */
.documents-stats-cards .main-stat-card {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.documents-stats-cards .main-stat-card:nth-child(1) { animation-delay: 0.1s; }
.documents-stats-cards .main-stat-card:nth-child(2) { animation-delay: 0.2s; }
.documents-stats-cards .main-stat-card:nth-child(3) { animation-delay: 0.3s; }
.documents-stats-cards .main-stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Filters Section
   ======================================== */

.documents-filters-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group label i {
  color: #667eea;
  font-size: 14px;
}

.filter-input,
.filter-select {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-search {
  grid-column: span 2;
}

.btn-reset-filters {
  padding: 10px 16px;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-reset-filters:hover {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  transform: translateY(-1px);
}

/* Active Filters */
.active-filters {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.active-filters-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.active-filters-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border: 1px solid #c4b5fd;
  border-radius: 6px;
  font-size: 12px;
  color: #5b21b6;
  font-weight: 500;
}

.filter-tag .remove-filter {
  background: none;
  border: none;
  color: #7c3aed;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.filter-tag .remove-filter:hover {
  color: #6d28d9;
}

/* ========================================
   View Mode Section
   ======================================== */

.view-mode-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-info {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

.view-mode-toggle {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
}

.view-mode-btn {
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
  font-size: 16px;
}

.view-mode-btn:hover {
  color: #374151;
}

.view-mode-btn.active {
  background: white;
  color: #667eea;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Loading & Empty States
   ======================================== */

.documents-loading {
  text-align: center;
  padding: 60px 20px;
}

.loading-spinner {
  font-size: 48px;
  color: #667eea;
  margin-bottom: 16px;
}

.documents-loading p {
  color: #6b7280;
  font-size: 16px;
}

.documents-empty {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 20px;
}

.documents-empty h3 {
  font-size: 20px;
  color: #374151;
  margin: 0 0 8px 0;
}

.documents-empty p {
  color: #6b7280;
  font-size: 14px;
}

/* ========================================
   Documents Container
   ======================================== */

.documents-container.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
  width: 100%;
}

.documents-container.view-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Grid View Card */
.document-card-grid {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

.document-card-grid:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: #667eea;
}

.document-card-grid.expired {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.document-card-grid.expired:hover {
  border-color: #ef4444;
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.15);
}

/* List View Card */
.document-card-list {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  transition: all 0.2s ease;
}

.document-card-list:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Card Header */
.document-card-header {
  display: flex;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.document-thumbnail-small {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 36px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.document-thumbnail-small::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.document-card-grid:hover .document-thumbnail-small::before,
.document-card-list:hover .document-thumbnail-small::before {
  opacity: 1;
}

.document-card-grid:hover .document-thumbnail-small,
.document-card-list:hover .document-thumbnail-small {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.document-title-area {
  flex: 1;
  min-width: 0;
}

.document-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 6px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}

.document-type-badge {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  color: #5b21b6;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.document-id {
  color: #9ca3af;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-badge.status-expiring {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-expired {
  background: #fee2e2;
  color: #991b1b;
}

/* Card Body */
.document-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.document-client-info,
.document-date-info,
.document-notes-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
}

.document-client-info i {
  color: #667eea;
}

.document-date-info i {
  color: #f59e0b;
}

.document-date-info.expired-date {
  color: #dc2626;
  font-weight: 600;
}

.document-notes-preview {
  background: #f9fafb;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  border-right: 3px solid #667eea;
}

.document-notes-preview i {
  color: #667eea;
  font-size: 14px;
}

.document-notes-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-number {
  color: #9ca3af;
  font-size: 12px;
}

/* Card Footer */
.document-card-footer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.btn-doc-view,
.btn-doc-download {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-doc-view {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-doc-view:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6d42a3 100%);
  transform: translateY(-1px);
}

.btn-doc-download {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.btn-doc-download:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.no-file-notice {
  flex: 1;
  text-align: center;
  padding: 8px;
  background: #f9fafb;
  color: #6b7280;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ========================================
   Pagination
   ======================================== */

.documents-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
  padding: 20px;
}

.pagination-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5568d3 0%, #6d42a3 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Large Desktops - 4 columns */
@media (min-width: 1400px) {
  .documents-container.view-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktops - 3 columns */
@media (min-width: 1024px) and (max-width: 1399px) {
  .documents-container.view-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablets - 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .documents-container.view-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile - 1 column */
@media (max-width: 767px) {
  .documents-page-wrapper {
    padding: 16px;
  }

  .documents-main-title {
    font-size: 22px;
  }

  .documents-stats-cards {
    grid-template-columns: 1fr;
  }

  .filters-row {
    grid-template-columns: 1fr;
  }

  .filter-search {
    grid-column: span 1;
  }

  .documents-container.view-grid {
    grid-template-columns: 1fr;
  }

  .view-mode-section {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .view-mode-toggle {
    justify-content: center;
  }
}

/* ========================================
   File Type Specific Thumbnails
   ======================================== */

.document-thumbnail-small.file-type-pdf {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.document-thumbnail-small.file-type-word {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.document-thumbnail-small.file-type-excel {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.document-thumbnail-small.file-type-image {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.document-thumbnail-small.file-type-default {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

