/* OCR Modal Styles */
.ocr-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ocr-modal-content {
  background-color: #ffffff;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ocr-modal-header {
  background-color: #f8f9fa;
  padding: 20px 30px;
  border-bottom: 1px solid #e9ecef;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.ocr-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.ocr-close:hover {
  color: #333;
}

.ocr-modal-body {
  padding: 30px;
}

/* Upload Area */
.ocr-upload-section {
  margin-bottom: 20px;
}

.ocr-upload-area {
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f8fafc;
}

.ocr-upload-area:hover {
  border-color: #4f93ce;
  background-color: #f0f7ff;
}

.ocr-upload-area.drag-over {
  border-color: #4f93ce;
  background-color: #e6f2ff;
  transform: scale(1.02);
}

.ocr-upload-icon {
  font-size: 48px;
  color: #cbd5e0;
  margin-bottom: 16px;
}

.ocr-upload-area:hover .ocr-upload-icon,
.ocr-upload-area.drag-over .ocr-upload-icon {
  color: #4f93ce;
}

.ocr-upload-text {
  font-size: 18px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
}

.ocr-upload-hint {
  font-size: 14px;
  color: #718096;
  margin: 0;
}

/* OCR Limitations Notice */
.ocr-limitations-notice {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: #856404;
  text-align: left;
}

.ocr-limitations-notice i {
  color: #ff6b6b;
  margin-right: 8px;
}

.ocr-limitations-notice ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

.ocr-limitations-notice li {
  margin: 4px 0;
  list-style-type: disc;
}

/* File List */
.ocr-file-list {
  margin-bottom: 20px;
}

.ocr-file-list h3 {
  font-size: 16px;
  color: #333;
  margin-bottom: 12px;
  font-weight: 600;
}

.ocr-file-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background-color 0.2s;
}

.ocr-file-item:hover {
  background-color: #e9ecef;
}

.ocr-file-item i {
  font-size: 20px;
  margin-right: 12px;
  color: #718096;
}

.ocr-file-item .fa-file-pdf {
  color: #dc3545;
}

.ocr-file-item .fa-file-image {
  color: #28a745;
}

.ocr-file-name {
  flex: 1;
  font-size: 14px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ocr-file-size {
  font-size: 12px;
  color: #718096;
  margin-right: 12px;
}

.ocr-file-remove {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  transition: color 0.2s;
}

.ocr-file-remove:hover {
  color: #c82333;
}

/* Consolidation Option */
.ocr-consolidation {
  margin-bottom: 20px;
  padding: 12px 16px;
  background-color: #f0f7ff;
  border-radius: 8px;
}

.ocr-consolidation label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

.ocr-consolidation input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

/* Action Buttons */
.ocr-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.ocr-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ocr-actions .primary-button {
  background-color: #4f93ce;
  color: white;
}

.ocr-actions .primary-button:hover {
  background-color: #3a7bb8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 147, 206, 0.3);
}

.ocr-actions .secondary-button {
  background-color: #e9ecef;
  color: #333;
}

.ocr-actions .secondary-button:hover {
  background-color: #dee2e6;
}

/* Progress Section */
.ocr-progress {
  margin-top: 24px;
  text-align: center;
}

.ocr-progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.ocr-progress-fill {
  height: 100%;
  background-color: #4f93ce;
  width: 0%;
  transition: width 0.3s ease;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: progress-animation 1s linear infinite;
}

@keyframes progress-animation {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 1rem 0;
  }
}

.ocr-progress-text {
  font-size: 14px;
  color: #718096;
  margin: 0;
}

/* Error Message */
.ocr-error {
  background-color: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 14px;
}

.ocr-error i {
  margin-right: 8px;
}

/* OCR Button in Essay Form */
.ocr-button-container {
  margin-bottom: 20px;
  text-align: center;
}

#ocrButton {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#ocrButton:hover {
  background-color: #218838;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#ocrButton i {
  font-size: 18px;
}

#ocrButton.success {
  background-color: #28a745;
}

#ocrButton.error {
  background-color: #dc3545;
}

#ocrButton:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

#ocrButton:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .ocr-modal-content {
    width: 95%;
    margin: 10% auto;
  }

  .ocr-modal-header {
    padding: 16px 20px;
  }

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

  .ocr-modal-body {
    padding: 20px;
  }

  .ocr-upload-area {
    padding: 30px 16px;
  }

  .ocr-upload-icon {
    font-size: 36px;
  }

  .ocr-upload-text {
    font-size: 16px;
  }

  .ocr-actions {
    flex-direction: column-reverse;
  }

  .ocr-actions button {
    width: 100%;
  }
}

/* Progressive Capture Preview Styles */
.ocr-preview-container {
  margin: 20px 0;
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e9ecef;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: #333;
}

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

.clear-all-btn:hover {
  background-color: #c82333;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.preview-item {
  position: relative;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 3/4;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .file-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: rgba(220, 53, 69, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
  opacity: 0;
}

.preview-item:hover .remove-btn {
  opacity: 1;
}

.remove-btn:hover {
  background-color: #dc3545;
  transform: scale(1.1);
}

.preview-item.add-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f7ff;
  border: 2px dashed #4f93ce;
}

.add-photo-btn {
  background: none;
  border: none;
  color: #4f93ce;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 16px;
  width: 100%;
  height: 100%;
  transition: all 0.2s;
}

.add-photo-btn:hover {
  background-color: #e6f2ff;
}

.add-photo-btn i {
  font-size: 24px;
}

.preview-actions {
  text-align: center;
}

.process-all-btn {
  background-color: #4f93ce;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.process-all-btn:hover {
  background-color: #3a7bb8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 147, 206, 0.3);
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .preview-item .file-name {
    font-size: 10px;
    padding: 2px;
  }
  
  .add-photo-btn {
    font-size: 12px;
    padding: 12px;
  }
  
  .add-photo-btn i {
    font-size: 20px;
  }
}