/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
  }
  
  /* Modal Content Box */
  .modal-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 1600px;
    position: relative;
  }
  
  /* Close Button */
  .modal-content .close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  /* Form Styles inside Modal */
  .modal-content form .form-group {
    margin-bottom: 15px;
    text-align: left;
  }
  
  .modal-content form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
  }
  
  .modal-content form input[type="text"],
  .modal-content form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
  }

  #adDescription {
    height: 150px;
    resize: vertical; 
    max-height: 30%;
  }

  #mediaPreview, #existingMediaPreview, #newMediaPreview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  #mediaPreview img, 
  #existingMediaPreview img, 
  #newMediaPreview img {
    flex: 0 1 calc(33.333% - 10px);
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .form-row {
    display: flex;
    gap: 20px;
  }
  
  .form-row .form-group {
    flex: 1;
  }

  .media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .media-thumb {
    position: relative;
  }
  
  .media-thumb img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
  }
  
  .media-thumb .remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: red;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    cursor: pointer;
    font-size: 16px;
    user-select: none;
  }

  /* Smaller Subscription Payment Modal */
.modal-content.subscription-payment {
  max-width: 400px; /* Smaller width */
  width: 90%;
  max-height: 300px;
  text-align: center;
}

.modal-content.subscription-payment h3 {
  margin-bottom: 15px;
}

.modal-content.subscription-payment button {
  margin-top: 15px;
}

  .stripe-button {
    background: #5469d4;
    color: #fff;
    border: 0;
    font-size: 1em;
    font-family: 'Montserrat', sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    height: 46px;
    width: 155px;
    align-items: center;       /* Vertically center */
    justify-content: center;
  }
  
  .stripe-button:hover {
    background-color: #4154b7;
  }

/* ══════════════════════════════
   AD EDIT OVERLAY  .ae-*
══════════════════════════════ */

.ae-modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.ae-header {
  background: #2d3d1a;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ae-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  text-align: left;
}

.ae-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.ae-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

#adEditForm {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ae-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.ae-section {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f4e8;
}
.ae-section-last {
  border-bottom: none;
}

.ae-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #556B2F;
  margin-bottom: 14px;
}

.ae-subsection-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0 10px;
}

.ae-section .form-group {
  margin-bottom: 14px;
}

.ae-section .form-group:last-child {
  margin-bottom: 0;
}

.ae-section .form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3a4a2a;
  margin-bottom: 5px;
}

.ae-section .form-group input[type="text"],
.ae-section .form-group input[type="number"],
.ae-section .form-group textarea,
.ae-section .form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d4ddc8;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #1c2b0e;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  margin-bottom: 0;
}

.ae-section .form-group input:focus,
.ae-section .form-group textarea:focus,
.ae-section .form-group select:focus {
  outline: none;
  border-color: #556B2F;
  box-shadow: 0 0 0 3px rgba(85,107,47,0.12);
}

.ae-section .form-group textarea {
  min-height: 130px;
  resize: vertical;
  max-height: 320px;
}

#adDescription {
  height: 130px;
  max-height: 320px;
}

.ae-section select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D'10'%20height%3D'10'%20viewBox%3D'0%200%2010%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpolygon%20points%3D'0,0%2010,0%205,7'%20fill%3D'%23556B2F'%2F%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 30px;
  cursor: pointer;
}

.ae-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.ae-row-4.form-row { gap: 12px; }
.ae-row-4 .form-group { flex: unset; margin-bottom: 0; }

.ae-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f4f6f0;
  border: 1.5px dashed #a0b878;
  color: #556B2F;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 12px;
}
.ae-upload-btn:hover {
  background: #eef4e4;
  border-color: #556B2F;
}

.ae-upload-count {
  font-size: 0.8rem;
  color: #777;
  margin-top: 8px;
}

.ae-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid #e8eee0;
  background: #fafcf7;
  flex-shrink: 0;
  gap: 12px;
}

.ae-message {
  font-size: 0.875rem;
  color: #556B2F;
  flex: 1;
}

.ae-save-btn {
  padding: 10px 28px;
  background: #556B2F;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ae-save-btn:hover {
  background: #47592a;
}

@media (max-width: 640px) {
  .ae-modal {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
  .ae-row-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .ae-section { padding: 16px; }
  .ae-footer { padding: 12px 16px; }
}
