/* PScan Modal Styles */
.pscan-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pscan-modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 1200px;
  border-radius: 8px;
  position: relative;
  animation: slideIn 0.3s ease-in-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  top: 50%;
  left: 40%;
  transform: translate(-50%, -50%);
  margin: 0;
}

@keyframes slideIn {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

.pscan-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 15px;
  transition: color 0.3s ease;
}

.pscan-close:hover,
.pscan-close:focus {
  color: #dc3545;
  text-decoration: none;
}

.pscan-modal-body {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.pscan-pdf-section {
  flex: 2;
  min-height: 400px;
}

.pscan-files-section {
  flex: 1;
  min-width: 300px;
}

.pscan-section {
  margin: 20px 0;
  text-align: left;
}

.pscan-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background-color: #6c757d;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
  overflow: hidden;
  min-width: 200px;
}

.pscan-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.5);
  background-color: #5a6268;
}

.pscan-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.pscan-btn:focus {
  outline: none;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4),
    0 0 0 3px rgba(108, 117, 125, 0.3);
}

.pscan-icon {
  width: 20px;
  height: 20px;
  color: white;
  transition: transform 0.3s ease;
}

.pscan-btn:hover .pscan-icon {
  transform: scale(1.1);
}

.pscan-btn span {
  position: relative;
  z-index: 1;
}

.pscan-modal h2 {
  margin-top: 0;
  color: #007bff;
  border-bottom: 2px solid #007bff;
  padding-bottom: 10px;
}

.pscan-modal h3 {
  margin-bottom: 15px;
  padding-bottom: 5px;
  font-size: 18px;
}

.pscan-txt-files h3 {
  color: #dc3545;
  border-bottom: 2px solid #dc3545;
}

.pscan-root-files h3 {
  color: #fd7e14;
  border-bottom: 2px solid #fd7e14;
}

.pscan-pdf-section h3 {
  color: #28a745;
  border-bottom: 2px solid #28a745;
}

.file-list {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  background-color: #f8f9fa;
}

.file-list::-webkit-scrollbar {
  width: 8px;
}

.file-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.file-item {
  padding: 8px;
  margin-bottom: 8px;
  background-color: #ffffff;
  border-radius: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.pscan-txt-files .file-item {
  border-left: 4px solid #dc3545;
}

.pscan-root-files .file-item {
  border-left: 4px solid #fd7e14;
}

.file-item a {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item a:hover {
  color: #0056b3;
  text-decoration: underline;
}

.pscan-modal iframe {
  width: 100%;
  height: 350px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive design */
@media (max-width: 768px) {
  .pscan-modal-content {
    width: 95%;
    margin: 1% auto;
    padding: 15px;
  }

  .pscan-modal-body {
    flex-direction: column;
    gap: 15px;
  }

  .pscan-pdf-section {
    min-height: 300px;
  }

  .pscan-modal iframe {
    height: 300px;
  }

  .pscan-files-section {
    min-width: auto;
  }

  .file-list {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .pscan-modal-content {
    width: 98%;
    padding: 10px;
  }

  .pscan-modal h2 {
    font-size: 20px;
  }

  .pscan-modal h3 {
    font-size: 16px;
  }

  .pscan-modal iframe {
    height: 250px;
  }

  .file-list {
    max-height: 120px;
  }
}

/* Loading animation for iframe */
.pscan-pdf-section::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Hide loading animation when iframe is loaded */
.pscan-pdf-section iframe[src] ~ ::before {
  display: none;
}
