/**
 * ModernMail File Upload Styles
 * Styles for file upload, preview, and modal functionality
 */

/* ===== FILE UPLOAD SECTION ===== */
.file-upload-section {
  margin-bottom: 1.5rem;
}

.file-upload-container {
  border: 2px dashed #d1d5db;
  border-radius: 0.75rem;
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.file-upload-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(240, 102, 102, 0.1), transparent);
  transition: left 0.6s ease;
}

.file-upload-container:hover::before {
  left: 100%;
}

.file-upload-container:hover {
  border-color: #f06666;
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(240, 102, 102, 0.2);
}

/* Override hover behavior when file is present - keep green theme */
.file-upload-container.has-file:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  transform: none;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.file-upload-container.drag-over {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  animation: dragPulse 1.5s ease-in-out infinite;
}

@keyframes dragPulse {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.3);
  }
}

.file-upload-container.has-file {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
  animation: containerSuccess 0.5s ease-out;
}

@keyframes containerSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.file-upload-container.success {
  animation: successPulse 0.6s ease-out;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.upload-icon {
  font-size: 7rem;
  color: #9ca3af;
  transition: all 0.3s ease;
}

.file-upload-container:hover .upload-icon {
  color: #f06666;
  transform: scale(1.1);
  animation: iconBounce 0.6s ease-in-out;
}

/* Override icon hover when file is present - keep green theme */
.file-upload-container.has-file:hover .upload-icon {
  color: #10b981;
  transform: none;
  animation: none;
}

@keyframes iconBounce {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.2); }
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.upload-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
}

.upload-subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  line-height: 1.4;
}

/* ===== FILE SUMMARY ===== */
.file-summary {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-label {
  font-weight: 600;
  color: #374151;
}

.file-name {
  color: #10b981;
  font-weight: 500;
}

/* ===== FILE PREVIEW ===== */
.file-preview {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  animation: fileSlideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-preview-info{
  padding-bottom:15px;
}

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

/* ===== FILE PREVIEW COMPONENTS ===== */
.file-preview-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.file-preview-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.file-preview-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.file-preview-btn {
  padding: 0.75rem 1.5rem;
  min-width: 120px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.file-preview-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.file-preview-btn.view {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.file-preview-btn.view:hover {
  background: #059669;
  border-color: #059669;
}

.file-preview-btn.remove {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.file-preview-btn.remove:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Special hover effect when remove button is hovered - allow red theme */
.file-upload-container.has-file:hover .file-preview-btn.remove:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Change container background when remove button is hovered */
.file-upload-container.has-file.remove-warning {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2) !important;
}

.file-preview-note {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #92400e;
}

.file-preview-note small {
  color: #78350f;
  font-size: 0.75rem;
}

/* ===== FILE PREVIEW MODAL ===== */
.file-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 1rem;
  animation: modalFadeIn 0.3s ease-out;
  overflow: hidden;
  isolation: isolate;
  /* Force full viewport coverage */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
}

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

.file-preview-modal-content {
  background: white;
  border-radius: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1000001;
}

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

.file-preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 1rem 1rem 0 0;
  position: relative;
  z-index: 1000002;
}

.file-preview-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  word-break: break-word;
}

.file-preview-modal-close-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1000003;
}

.file-preview-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 0.5rem;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  z-index: 1000000;
  pointer-events: auto;
}

.file-preview-modal-close:hover {
  background: #e5e7eb;
  color: #374151;
  transform: scale(1.05);
}

.file-preview-modal-close:active {
  transform: scale(0.95);
}

.close-icon {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
}

.file-preview-modal-body {
  padding: 0;
  background: #fff;
  border-radius: 0 0 1rem 1rem;
  min-height: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.pdf-viewer-container {
  width: 100%;
  height: 600px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: #fff;
}

.pdf-viewer-container embed {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  min-height: 600px;
}

.pdf-viewer-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  min-height: 600px;
}



.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: #6b7280;
}

.pdf-loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid #e5e7eb;
  border-top: 3px solid #f06666;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pdf-loading p {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.file-preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: #6b7280;
  text-align: center;
}

.file-preview-unsupported p {
  margin: 0;
  font-size: 0.875rem;
}

.pdf-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
}

.pdf-fallback-content {
  text-align: center;
  color: #6b7280;
}

.pdf-fallback-content p {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.pdf-fallback-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #f06666;
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.pdf-fallback-link:hover {
  background: #e55a5a;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .file-upload-container {
    padding: 2.5rem 1.5rem;
    min-height: 160px;
  }
  
  .upload-icon {
    font-size: 5rem;
  }
  
  .upload-title {
    font-size: 1.125rem;
  }
  
  .file-preview-modal {
    padding: 0.5rem;
    z-index: 999999;
    isolation: isolate;
  }
  
  .file-preview-modal-content {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0.75rem;
  }
  
  .file-preview-modal-header {
    padding: 1rem;
  }
  
  .file-preview-modal-header h3 {
    font-size: 1.125rem;
  }
  
  .file-preview-modal-body {
    padding: 1rem;
  }
  
  .file-preview-modal-close {
    width: 2rem;
    height: 2rem;
  }
  
  .close-icon {
    font-size: 1.25rem;
  }
  
  .pdf-loading {
    gap: 0.75rem;
  }
  
  .pdf-loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .pdf-loading p {
    font-size: 0.8125rem;
  }
  
  .file-preview-unsupported p {
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .file-preview-modal {
    z-index: 999999;
    isolation: isolate;
  }
  
  .file-upload-container {
    padding: 2rem 1rem;
    min-height: 140px;
  }
  
  .upload-icon {
    font-size: 4.5rem;
  }
  
  .upload-title {
    font-size: 1rem;
  }
  
  .upload-subtitle {
    font-size: 0.8rem;
  }
  
  .file-preview {
    flex-direction: column;
    text-align: left;
  }
  
  .file-preview-actions {
    justify-content: center;
  }
  
  .file-preview-header {
    align-items: flex-start;
  }
  
  .file-preview-btn {
    padding: 0.5rem 0.75rem;
    min-width: 90px;
    font-size: 0.75rem;
  }
  
  .file-preview-info {
    gap: 8px;
  }
  
  .file-preview-details {
    gap: 2px;
  }
  
  .file-preview-modal-header h3 {
    font-size: 1rem;
  }
  
  .file-preview-modal-body {
    padding: 0.75rem;
  }
  
  .pdf-loading-spinner {
    width: 2rem;
    height: 2rem;
  }
  
  .file-preview-unsupported {
    gap: 0.75rem;
  }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .file-preview-modal {
    z-index: 999999;
    isolation: isolate;
  }
  
  .file-preview-modal-content {
    max-height: 95vh;
  }
  
  .file-preview-modal-header {
    padding: 0.75rem 1rem;
  }
  
  .file-preview-modal-header h3 {
    font-size: 1rem;
  }
  
  .file-preview-modal-body {
    padding: 0.75rem;
  }
  
  .file-preview-modal-close {
    width: 1.75rem;
    height: 1.75rem;
  }
  
  .close-icon {
    font-size: 1rem;
  }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  .file-preview-modal {
    z-index: 999999;
    isolation: isolate;
  }
  
  .file-preview-modal-close {
    width: 2.5rem;
    height: 2.5rem;
    z-index: 1000000;
  }
  
  .close-icon {
    font-size: 1.5rem;
  }
}

/* ===== ENHANCED FILE PREVIEW STYLES ===== */

/* ===== FILE PREVIEW ICONS ===== */
.file-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 2px solid #10b981;
  color: #065f46;
  transition: all 0.3s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 24px;
  cursor: pointer;
}

.file-preview-icon:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  border-color: #059669;
}

.file-preview-icon.pdf {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
  color: #065f46;
}

.file-preview-icon.pdf:hover {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  border-color: #059669;
}

.file-preview-icon.word {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
  color: #065f46;
}

.file-preview-icon.word:hover {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  border-color: #059669;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== PROGRESS BAR ===== */
.upload-progress {
  margin-top: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== PROGRESS BAR ENHANCEMENT ===== */
.upload-progress-bar {
  height: 8px;
  background: linear-gradient(90deg, #f06666 0%, #e61145 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  flex: 1;
  box-shadow: 0 2px 4px rgba(240, 102, 102, 0.3);
}

.upload-percentage {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  min-width: 40px;
  text-align: right;
}

/* ===== ERROR AND SUCCESS MESSAGES ===== */
.error-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  color: #dc2626;
  font-size: 0.875rem;
}

.success-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.375rem;
  color: #16a34a;
  font-size: 0.875rem;
} 



.file-size-limit {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  font-weight: 500;
} 







.file-preview-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.file-preview-name {
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
  text-align: left;
  word-break: break-word;
}

.file-type-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
  margin-top: 2px;
}

.file-type-badge.pdf-badge {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.file-type-badge.word-badge {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.file-preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #6b7280;
}

.file-preview-size {
  font-weight: 500;
}

.file-preview-time {
  color: #9ca3af;
  font-size: 11px;
}



/* ===== PROCESSING STATE ===== */
.file-preview.processing {
  opacity: 0.8;
}

.processing-icon {
  position: relative;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%) !important;
  border-color: #d1d5db !important;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.file-preview-status {
  color: #6b7280;
  font-style: italic;
}

/* File Processing Progress Bar */
.file-processing-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.file-processing-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.file-processing-bar {
  flex: 1;
  height: 4px;
  background: rgba(16, 185, 129, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.file-processing-fill {
  height: 100%;
  background: #10b981;
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

.file-processing-percentage {
  font-size: 0.75rem;
  font-weight: 500;
  color: #10b981;
  min-width: 2.5rem;
  text-align: right;
}

.file-preview-status.processed {
  color: #10b981;
  font-weight: 600;
} 

/* ===== MODAL OVERRIDES TO PREVENT INTERFERENCE ===== */
.file-preview-modal,
.file-preview-modal * {
  /* Override any potential interference from other CSS */
  position: static !important;
  z-index: auto !important;
}

.file-preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
}

.file-preview-modal-close {
  position: relative !important;
  z-index: 1000000 !important;
  pointer-events: auto !important;
}

.file-preview-modal-close * {
  position: static !important;
  z-index: auto !important;
} 