.themed-popup{
  background: linear-gradient(180deg, hsl(240, 2%, 13%) 0%, hsl(0, 0%, 7%) 100%);
  padding: 24px 28px;
  border-radius: 14px;
  min-width: 420px;
  width: min(92vw, 820px);
  max-width: 820px;
  color: var(--white-2);
  /* Subtle, thinner border using a dull gold */
  border: 1.2px solid hsla(45, 100%, 72%, 0.45);
  /* Softer shadow for separation */
  box-shadow: 0 0 0 1.5px rgba(45, 45, 45, 0.5), 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08);
  font-family: var(--ff-poppins);
  animation: popupFade 220ms cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Scrollbar styles moved to .popup-content */

/* Responsive min-width adjustments */
@media (max-width: 1200px) {
  .themed-popup {
    /* slightly smaller min width on medium screens */
    min-width: 360px;
  }
}

@media (max-width: 920px) {
  .themed-popup {
    /* allow the popup to shrink more on small/tablet screens */
    min-width: unset;
    width: 80vw;
    max-width: 80vw;
  }
}

@media (max-width: 480px) {
  .themed-popup {
    /* full-bleed popup on phones */
    min-width: 0;
    width: 80vw;
    max-width: 80vw;
    border-radius: 0;
    margin: 0;
    padding-left: 12px;
    padding-right: 12px;
  }
}

.popup-title{
  margin: 0;
  padding-bottom: 14px;
  color: var(--white-1);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, var(--orange-yellow-crayola), var(--vegas-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  padding-bottom: 4px;
  margin-bottom: 0;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--light-gray-70);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease, background 150ms ease;

  mat-icon, i {
    font-size: 18px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &:hover {
    color: var(--white-1);
    background: rgba(255,255,255,0.08);
  }
}

.popup-form label{
  display:block;
  margin-bottom:6px;
  color: var(--light-gray-70);
  font-size: 0.95rem;
}

.popup-form input,
.popup-form textarea,
.popup-form select{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--white-1);
  min-height: 42px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.popup-form textarea{ min-height: 92px; resize: vertical; }

.popup-form input:focus,
.popup-form textarea:focus,
.popup-form select:focus{
  border-color: var(--orange-yellow-crayola);
  box-shadow: 0 6px 18px rgba(36,26,18,0.12);
  outline: none;
}

.popup-content{
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 6px 8px 0;
  min-height: 0; /* allow flex child to shrink below content size */
}

.popup-actions{
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  align-items: center;
  flex-shrink: 0;
  padding-top: 14px;
  padding-bottom: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.submit-btn{
  padding: 8px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--white-2);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  font-weight: 500;
}

.submit-btn.primary{
  background: linear-gradient(90deg, var(--orange-yellow-crayola), var(--vegas-gold));
  color: var(--smoky-black);
  border: none;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(45,30,10,0.22);
}

.submit-btn:hover{
  filter: brightness(1.08);
  transform: translateY(-1px);
  transition: all 120ms ease;
}

.submit-btn:active{
  transform: translateY(0);
}

.array-item{ margin-bottom:8px; padding:8px; border-radius:8px; background: rgba(255,255,255,0.02); }

/* Themed scrollbar for popup content */
.popup-content::-webkit-scrollbar { width: 10px; }
.popup-content::-webkit-scrollbar-track { background: transparent; }
.popup-content::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--orange-yellow-crayola), var(--vegas-gold)); border-radius: 8px; }
.popup-content { scrollbar-width: thin; scrollbar-color: var(--orange-yellow-crayola) transparent; }

/* textarea scrollbar */
.popup-form textarea::-webkit-scrollbar { width: 10px; }
.popup-form textarea::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); border-radius:6px; }
.popup-form textarea::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--orange-yellow-crayola), var(--vegas-gold)); border-radius:6px; }

/* Material-specific color fixes inside the themed popup */
.themed-popup {
  /* Floating labels */
  .mat-form-field-label,
  .mat-mdc-floating-label {
    color: var(--light-gray-70) !important;
  }

  /* Input / textarea text */
  .mat-input-element,
  textarea.mat-input-element,
  .mat-mdc-text-field-input {
    color: var(--white-1) !important;
  }

  /* Select value text */
  .mat-select-value-text,
  .mat-mdc-select-value-text {
    color: var(--white-1) !important;
  }

  /* Placeholder visibility */
  input::placeholder,
  textarea::placeholder {
    color: var(--light-gray-70) !important;
    opacity: 1 !important;
  }

  /* Outline/border color adjustments for outlined fields */
  .mat-form-field-appearance-outline .mat-form-field-outline,
  .mat-mdc-notched-outline {
    stroke: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.06) !important;
  }

  /* Focused state accent */
  .mat-form-field.mat-focused .mat-form-field-outline,
  .mat-mdc-text-field.mat-mdc-focused .mat-mdc-notched-outline {
    stroke: var(--orange-yellow-crayola) !important;
    border-color: var(--orange-yellow-crayola) !important;
    box-shadow: 0 6px 18px rgba(36,26,18,0.12) !important;
  }

  /* Make mat-hint lighter */
  .mat-hint {
    color: var(--light-gray-70) !important;
  }

  /* Scrollbar for material textarea/input */
  textarea.mat-input-element::-webkit-scrollbar { width: 10px; }
  textarea.mat-input-element::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); border-radius:6px; }
  textarea.mat-input-element::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--orange-yellow-crayola), var(--vegas-gold)); border-radius:6px; }
}

@keyframes popupFade{ from{opacity:0; transform:translateY(-8px);} to{opacity:1; transform:none;} }
