/* PDF Modal Dialog Styles - Ottimizzato per Mobile e Desktop */

.pdf-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.85);
  animation: fadeIn 0.3s ease-in-out;
}

.pdf-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.pdf-modal__content {
  position: relative;
  background-color: #1b1b1b;
  width: 90%;
  height: 90%;
  max-width: 1200px;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
}

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

.pdf-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #0f0f0f;
  background-color: #1b1b1b;
  border-radius: 8px 8px 0 0;
}

.pdf-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #e7e7e7;
}

.pdf-modal__close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #979797;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.pdf-modal__close:hover {
  background-color: #e0e0e0;
  color: #000;
}

.pdf-modal__close:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.pdf-modal__body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: #525659;
}

.pdf-modal__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.pdf-modal__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #fff;
}

.pdf-modal__spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

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

/* Mobile Optimizations */
@media screen and (max-width: 768px) {
  .pdf-modal__content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .pdf-modal__header {
    padding: 12px 15px;
    border-radius: 0;
  }

  .pdf-modal__title {
    font-size: 16px;
  }

  .pdf-modal__close {
    font-size: 24px;
    width: 28px;
    height: 28px;
  }
}

/* Landscape mobile optimization */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .pdf-modal__header {
    padding: 8px 15px;
  }

  .pdf-modal__title {
    font-size: 14px;
  }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
  .pdf-modal__title {
    font-size: 14px;
    max-width: calc(100% - 50px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Prevent body scroll when modal is open */
body.pdf-modal-open {
  overflow: hidden;
  height: 100vh;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  .pdf-modal__content {
    height: -webkit-fill-available;
  }
}
