.document-management {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

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

.header h2 {
  margin: 0;
  font-size: 24px;
  color: #333;
}

.back-button {
  padding: 8px 16px;
  background-color: #26b4b4;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.back-button:hover {
  background-color: #149f9f;
}

.upload-section {
  margin-bottom: 20px;
}

.upload-section form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.file-drop-area {
  width: 100%;
  min-height: 100px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background-color 0.2s;
}

.file-drop-area.drag-active {
  border-color: #26b4b4;
  background: #e6f5f5;
}

.file-drop-area.has-files {
  flex-direction: column;
  align-items: flex-start;
}

.file-input {
  display: none;
}

.drop-message {
  margin: 0;
  font-size: 16px;
  color: #000; /* Changed to black */
  text-align: center;
}

.drop-subtitle {
  font-size: 12px; /* Reduced from 14px */
  color: #888;
  margin-top: 5px;
}

.selected-files {
  width: 100%;
}

.selected-files p {
  margin: 0 0 10px;
  font-size: 14px;
  color: #333;
}

.files-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.file-item {
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
}

.file-progress {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}

.file-progress.success .progress-bar {
  background: #28a745;
}

.file-progress.error .progress-bar {
  background: #dc3545;
}

.file-progress.uploading .progress-bar {
  background: #4285f4;
  transition: width 0.2s ease;
}

.progress-bar {
  height: 100%;
  width: 0;
}

.error-message {
  color: #dc3545;
  font-size: 14px;
  margin: 10px 0;
}

.upload-status {
  font-size: 14px;
  margin: 10px 0;
  text-align: center;
}

.upload-status.success {
  color: #28a745;
}

.upload-status.partial {
  color: #ffc107;
}

.upload-status.error {
  color: #dc3545;
}

.upload-button {
  padding: 8px 16px;
  background-color: #26b4b4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.upload-button:hover {
  background-color: #149f9f;
}

.upload-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.documents-list {
  max-height: 60vh;
  overflow-y: auto;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

.documents-table th,
.documents-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.documents-table th {
  background: #f5f5f5;
  font-size: 14px;
  color: #333;
}

.documents-table td {
  font-size: 14px;
  color: #333;
}

.documents-table tr:hover {
  background-color: #e8f0fe;
}

.delete-button {
  padding: 6px 12px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.delete-button:hover {
  background-color: #c82333;
}

.delete-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.loading,
.empty-state {
  padding: 10px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.clear-documents-button {
  padding: 8px 16px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 20px;
  transition: background-color 0.2s;
}

.clear-documents-button:hover {
  background-color: #c82333;
}

.clear-documents-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.documents-list-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.clear-button-container {
  position: relative;
  display: inline-block;
}

.clear-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  z-index: 1000;
}

.clear-popup-content {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px 16px;
  min-width: 200px;
  position: relative;
}

.clear-popup-content::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 20px;
  border: 6px solid transparent;
  border-top-color: white;
}

.clear-popup-content::before {
  content: "";
  position: absolute;
  top: 100%;
  right: 19px;
  border: 7px solid transparent;
  border-top-color: #ddd;
  z-index: -1;
}

.clear-popup-content p {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #333;
  text-align: center;
}

.clear-popup-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.popup-cancel-button,
.popup-clear-button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.popup-cancel-button {
  background-color: #f5f5f5;
  color: #666;
}

.popup-cancel-button:hover {
  background-color: #e0e0e0;
}

.popup-clear-button {
  background-color: #dc3545;
  color: white;
}

.popup-clear-button:hover {
  background-color: #c82333;
}

/* ZIP file processing results styles */
.file-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.upload-details {
  margin-top: 8px;
  font-size: 12px;
  background-color: #f8f9fa;
  border-radius: 4px;
  padding: 8px;
}

.zip-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zip-summary {
  font-weight: 600;
  color: #28a745;
  margin-bottom: 4px;
}

.processed-files {
  color: #28a745;
}

.skipped-files {
  color: #ffc107;
}

.error-files {
  color: #dc3545;
}

.single-file-result {
  color: #28a745;
  font-weight: 500;
}

.processed-files strong,
.skipped-files strong,
.error-files strong {
  font-weight: 600;
  margin-right: 4px;
}

/* Mobile card layout (hidden by default) */
.documents-cards {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.document-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.document-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.document-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.document-card-title {
  font-weight: 500;
  font-size: 16px;
  color: #333;
  margin: 0;
  word-break: break-word;
  line-height: 1.3;
}

.document-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

.document-card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #666;
}

.document-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.document-card-date {
  font-size: 13px;
  color: #888;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .document-management {
    padding: 16px;
    max-width: none;
    margin: 0;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .header h2 {
    font-size: 20px;
  }

  .back-button {
    padding: 10px 16px;
    font-size: 15px;
    align-self: flex-start;
  }

  .upload-section {
    margin-bottom: 16px;
  }

  .file-drop-area {
    min-height: 120px;
    padding: 16px;
  }

  .drop-message {
    font-size: 15px;
  }

  .drop-subtitle {
    font-size: 13px;
  }

  .upload-button {
    padding: 10px 20px;
    font-size: 15px;
    width: 100%;
    max-width: 200px;
  }

  .documents-list {
    max-height: 70vh;
  }

  /* Hide table on mobile */
  .documents-table {
    display: none;
  }

  /* Show cards on mobile */
  .documents-cards {
    display: flex;
  }

  .clear-documents-button {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 16px;
  }

  .documents-list-header {
    margin-bottom: 16px;
  }

  .delete-button {
    padding: 8px 12px;
    font-size: 14px;
    min-height: 36px;
  }
}

@media (max-width: 640px) {
  .document-management {
    padding: 12px;
  }

  .header {
    gap: 10px;
    margin-bottom: 12px;
  }

  .header h2 {
    font-size: 18px;
  }

  .back-button {
    padding: 8px 14px;
    font-size: 14px;
  }

  .file-drop-area {
    min-height: 100px;
    padding: 12px;
  }

  .drop-message {
    font-size: 14px;
  }

  .drop-subtitle {
    font-size: 12px;
  }

  .upload-button {
    padding: 8px 16px;
    font-size: 14px;
  }

  .document-card {
    padding: 12px;
  }

  .document-card-title {
    font-size: 15px;
  }

  .document-card-info {
    font-size: 13px;
  }

  .document-card-date {
    font-size: 12px;
  }

  .delete-button {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
  }

  .clear-documents-button {
    padding: 10px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .document-management {
    padding: 10px;
  }

  .header h2 {
    font-size: 16px;
  }

  .back-button {
    padding: 6px 12px;
    font-size: 13px;
  }

  .file-drop-area {
    min-height: 80px;
    padding: 10px;
  }

  .drop-message {
    font-size: 13px;
  }

  .upload-button {
    padding: 6px 14px;
    font-size: 13px;
  }

  .document-card {
    padding: 10px;
  }

  .document-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .document-card-actions {
    margin-left: 0;
    align-self: flex-end;
  }

  .document-card-title {
    font-size: 14px;
  }

  .document-card-info {
    font-size: 12px;
  }

  .document-card-date {
    font-size: 11px;
  }

  .delete-button {
    padding: 4px 8px;
    font-size: 12px;
    min-height: 28px;
  }

  .clear-documents-button {
    padding: 8px;
    font-size: 13px;
  }

  .error-message,
  .upload-status {
    font-size: 13px;
  }

  .clear-popup-content {
    padding: 10px 14px;
    min-width: 180px;
  }

  .clear-popup-content p {
    font-size: 13px;
  }

  .popup-cancel-button,
  .popup-clear-button {
    padding: 5px 10px;
    font-size: 11px;
  }
}

