.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-container {
  background: var(--white);
  border-radius: 12px;
  padding: 1.2rem;
  max-width: 380px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  transform: scale(0.7) translateY(-20px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.popup-overlay.active .popup-container {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: var(--navy-blue);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
}

.popup-close:hover {
  background: var(--medical-blue);
  transform: rotate(90deg);
}

.popup-container h2 {
  color: var(--navy-blue);
  margin-bottom: 0.3rem;
  font-size: 1.1rem;
  line-height: 1.2;
}

.popup-container p {
  color: var(--dark-text);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.popup-form .form-group {
  margin-bottom: 0.7rem;
}

.popup-form label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--dark-text);
  font-weight: 500;
  font-size: 0.9rem;
}

.popup-form input,
.popup-form select,
.popup-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border 0.3s, box-shadow 0.3s;
  font-family: inherit;
  resize: vertical;
}

.popup-form input:focus,
.popup-form select:focus,
.popup-form textarea:focus {
  outline: none;
  border-color: var(--medical-blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 175, 0.1);
}

.popup-form button {
  width: 100%;
  padding: 0.7rem;
  background: var(--medical-blue);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

.popup-form button:hover {
  background: var(--navy-blue);
  transform: translateY(-2px);
}

.popup-form button:active {
  transform: translateY(0);
}

.popup-form button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.popup-message {
  text-align: center;
  padding: 0.6rem;
  border-radius: 6px;
  margin-top: 0.7rem;
  display: none;
  animation: slideIn 0.3s ease;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
}

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

.popup-message.success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
  border-color: #c3e6cb;
  display: block;
  box-shadow: 0 2px 8px rgba(21, 87, 36, 0.1);
}

.popup-message.error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border-color: #f5c6cb;
  display: block;
  box-shadow: 0 2px 8px rgba(114, 28, 36, 0.1);
}

@media (max-width: 480px) {
  .popup-container {
    padding: 1rem;
    max-width: 95%;
    max-height: 90vh;
  }
  
  .popup-container h2 {
    font-size: 1rem;
  }
  
  .popup-container p {
    font-size: 0.85rem;
  }
  
  .popup-form input,
  .popup-form select,
  .popup-form textarea {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  .popup-form button {
    padding: 0.6rem;
  }
}
