/* Modal Animation - Enhanced with modern easing */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(52, 152, 219, 0.6);
  }
}

/* Dark Trendy Modal Styling */
.custom-popup-modal {
  position: relative;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  color: #ffffff;
  overflow-y: auto;
  max-height: 90vh;
  max-width: 500px;
  width: 100%;
}

.custom-popup-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
  z-index: 1;
}

.custom-popup-modal > * {
  position: relative;
  z-index: 2;
}

.custom-popup-modal .modal-item {
  margin-bottom: 10px;
  animation: slideInFromTop 0.3s ease-out;
  animation-fill-mode: both;
}

.custom-popup-modal .modal-item:nth-child(1) { animation-delay: 0.1s; }
.custom-popup-modal .modal-item:nth-child(2) { animation-delay: 0.15s; }
.custom-popup-modal .modal-item:nth-child(3) { animation-delay: 0.2s; }
.custom-popup-modal .modal-item:nth-child(4) { animation-delay: 0.25s; }
.custom-popup-modal .modal-item:nth-child(5) { animation-delay: 0.3s; }
.custom-popup-modal .modal-item:nth-child(6) { animation-delay: 0.35s; }

/* Modal Header Styling */
.custom-popup-modal h2 {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 15px;
  text-align: center;
  letter-spacing: 0.3px;
  position: relative;
}

.custom-popup-modal h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border-radius: 2px;
}

/* Modal Labels */
.custom-popup-modal .modal-item label {
  color: #ecf0f1;
  font-weight: 500;
  font-size: 0.75rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.2px;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.custom-popup-modal .modal-item label.required {
  color: #e74c3c;
  text-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

/* Stylish Modal Buttons */
.custom-popup-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 5px;
}

.custom-popup-modal .btn {
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  min-width: 70px;
  backdrop-filter: blur(10px);
}

.custom-popup-modal .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.3s ease;
}

.custom-popup-modal .btn:hover::before {
  left: 100%;
}

.custom-popup-modal .btn-primary {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(44, 62, 80, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-popup-modal .btn-primary:hover {
  background: linear-gradient(135deg, #1a252f 0%, #273746 100%);
  box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
  transform: translateY(-2px);
}

.custom-popup-modal .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}

.custom-popup-modal .btn-secondary {
  background: linear-gradient(135deg, #5d4e75 0%, #4a3c64 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(93, 78, 117, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-popup-modal .btn-secondary:hover {
  background: linear-gradient(135deg, #4a3c64 0%, #3d3052 100%);
  box-shadow: 0 6px 20px rgba(93, 78, 117, 0.4);
  transform: translateY(-2px);
}

.custom-popup-modal .btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(93, 78, 117, 0.3);
}

/* Dark Trendy Table Styling for Modal */
.custom-popup-modal .custom-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-popup-modal .custom-table th,
.custom-popup-modal .custom-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #ecf0f1;
  font-size: 0.9rem;
  font-weight: 500;
}

.custom-popup-modal .custom-table th {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.2) 0%, rgba(41, 128, 185, 0.2) 100%);
  color: #ffffff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  border-bottom: 2px solid rgba(52, 152, 219, 0.3);
}

.custom-popup-modal .custom-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.custom-popup-modal .custom-table tr:last-child td {
  border-bottom: none;
}

/* Form Elements Dark Styling */
.custom-popup-modal input,
.custom-popup-modal select,
.custom-popup-modal textarea {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.custom-popup-modal input:focus,
.custom-popup-modal select:focus,
.custom-popup-modal textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

.custom-popup-modal input::placeholder,
.custom-popup-modal textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.custom-popup-modal select option {
  background: #2c3e50;
  color: #ffffff;
  padding: 8px 12px;
}

/* Warning Notice Dark Styling */
.custom-popup-modal .warning-notice {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 8px;
  padding: 10px 15px;
  margin-bottom: 15px;
  color: #e74c3c;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.1);
}

/* Disabled Input Dark Styling */
.custom-popup-modal .disabled-input {
  background: rgba(108, 117, 125, 0.2) !important;
  color: rgba(255, 255, 255, 0.4) !important;
  cursor: not-allowed !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.custom-popup-modal .disabled-input:disabled {
  pointer-events: none;
  opacity: 0.6;
}

/* Modal-specific form control styling */
.custom-popup-modal .form-control {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 5px !important;
  color: #ffffff !important;
  padding: 6px 10px !important;
  font-size: 0.75rem !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  backdrop-filter: blur(10px) !important;
  width: calc(100% - 5px) !important;
  box-sizing: border-box !important;
  line-height: 1.2 !important;
  min-height: 28px !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  margin-right: 5px !important;
}

.custom-popup-modal .form-control:focus {
  outline: none !important;
  border-color: #3498db !important;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3) !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

.custom-popup-modal .form-control:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

.custom-popup-modal .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Modal dropdown specific styling */
.custom-popup-modal select.form-control {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D'http%3A//www.w3.org/2000/svg'%20viewBox%3D'0%200%204%205'%3E%3Cpath%20fill%3D'%23ffffff'%20d%3D'M2%200L0%202h4zM2%205L0%203h4z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px !important;
  padding-right: 35px !important;
  cursor: pointer !important;
}

.custom-popup-modal select.form-control option {
  background: #2c3e50 !important;
  color: #ffffff !important;
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
}

.custom-popup-modal select.form-control option:hover {
  background: #34495e !important;
}

/* Modal disabled form control styling */
.custom-popup-modal .form-control.disabled,
.custom-popup-modal .form-control:disabled {
  background: rgba(108, 117, 125, 0.2) !important;
  color: rgba(255, 255, 255, 0.4) !important;
  cursor: not-allowed !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  opacity: 0.6 !important;
}

.custom-popup-modal .form-control.disabled:hover,
.custom-popup-modal .form-control:disabled:hover {
  background: rgba(108, 117, 125, 0.2) !important;
}

/* Modal number input styling */
.custom-popup-modal input[type="number"].form-control {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.custom-popup-modal input[type="number"].form-control::-webkit-outer-spin-button,
.custom-popup-modal input[type="number"].form-control::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .custom-popup-modal {
    max-width: 450px;
    max-height: 85vh;
    margin: 10px;
  }
  
  .custom-popup-modal .modal-actions {
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
  }
  
  .custom-popup-modal .btn {
    width: calc(100% - 10px);
    padding: 12px 16px;
    margin-right: 5px;
  }
  
  .custom-popup-modal .modal-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .custom-popup-modal .modal-item label {
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .custom-popup-modal {
    max-width: 400px;
    max-height: 80vh;
    margin: 5px;
  }
  
  .custom-popup-modal h2 {
    font-size: 1rem;
  }
  
  .custom-popup-modal .modal-item label {
    font-size: 0.65rem;
  }
  
  .custom-popup-modal .form-control {
    font-size: 0.7rem !important;
    padding: 5px 8px !important;
    min-height: 24px !important;
  }
  
  .custom-popup-modal .warning-notice {
    font-size: 0.7rem;
    padding: 8px 12px;
  }
}

/* Modern Glow Effects */
.custom-popup-modal .btn-primary:hover {
  animation: glow 2s infinite alternate;
}

.custom-popup-modal input:focus,
.custom-popup-modal select:focus,
.custom-popup-modal textarea:focus {
  animation: glow 2s infinite alternate;
}
