/* ============================================
   DOCUMENT PREVIEW MODAL SYSTEM
   Professional modal for document previews
   ============================================ */

/* Modal Container */
.document-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.document-modal.active {
  display: flex;
}

/* Modal Overlay */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

/* Modal Container */
.modal-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 85vh;
  background: var(--text-white);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  z-index: 10000;
}

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-gray);
  background: var(--soft-gray);
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: var(--university-blue);
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.modal-close:hover {
  background: var(--light-blue);
  color: var(--university-blue);
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 0;
  background: var(--soft-gray);
}

/* Document Iframe */
.document-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.document-iframe[onload] {
  opacity: 1;
}

/* Loading State */
.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 1rem;
}

.modal-loading i {
  font-size: 3rem;
  color: var(--university-blue);
}

.modal-loading p {
  font-size: 1.1rem;
  margin: 0;
}

/* Preview Note */
.preview-note {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 58, 138, 0.95);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  z-index: 10;
  max-width: 90%;
}

.preview-note i {
  font-size: 1.2rem;
}

/* Preview Error */
.preview-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
}

.preview-error i {
  font-size: 4rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.preview-error h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.preview-error p {
  margin: 0.25rem 0;
  font-size: 1rem;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border-gray);
  background: var(--soft-gray);
  border-radius: 0 0 12px 12px;
  gap: 1rem;
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .modal-container {
    width: 95%;
    height: 90vh;
    max-width: 100%;
  }

  .modal-header {
    padding: 1rem 1.5rem;
  }

  .modal-header h3 {
    font-size: 1.2rem;
  }

  .modal-footer {
    padding: 1rem 1.5rem;
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .preview-note {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    bottom: 0.5rem;
  }
}

@media screen and (max-width: 480px) {
  .modal-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    border-radius: 0;
  }

  .modal-footer {
    border-radius: 0;
  }
}
