/* Elementor AI Prompt Form - Frontend Styles */

/* Base Styles */
.eapf-form-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Form Elements */
.eapf-form {
  margin: 0;
  padding: 0;
}

.eapf-form-field {
  margin-bottom: 20px;
}

.eapf-form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #1e1e1e;
}

.eapf-form-field .eapf-field {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.eapf-form-field .eapf-field:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
  outline: none;
}

.eapf-form-field textarea.eapf-field {
  min-height: 120px;
  resize: vertical;
}

.eapf-form-field select.eapf-field {
  height: 48px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Button Styles */
.eapf-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: #2271b1;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.eapf-button:hover {
  background-color: #135e96;
  transform: translateY(-1px);
}

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

.eapf-button:disabled {
  background-color: #a7aaad;
  cursor: not-allowed;
  transform: none;
}

/* Status Messages */
.eapf-status {
  margin: 20px 0;
  padding: 15px;
  background-color: #f0f6fc;
  border-left: 4px solid #72aee6;
  border-radius: 4px;
}

.eapf-status p {
  margin: 0;
  color: #1e1e1e;
}

.eapf-status .eapf-error {
  color: #d63638;
}

.eapf-status .eapf-success {
  color: #008a20;
  font-weight: 500;
}

/* Result Container */
.eapf-result {
  margin: 25px 0;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #dcdcde;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.7;
}

/* Image Gallery under result */
.eapf-gallery {
  margin: 10px 0 0 0;
}
.eapf-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.eapf-gallery-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.eapf-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* PDF Download Link */
.eapf-pdf-link {
  margin: 15px 0 0 0;
}

.eapf-pdf-download {
  text-align: center;
}

.eapf-pdf-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background-color: #dc3545;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.eapf-pdf-button:hover {
  background-color: #c82333;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.eapf-pdf-button:active {
  transform: translateY(0);
}

.eapf-pdf-icon {
  font-size: 16px;
}

/* Error States */
.eapf-form-field.eapf-has-error .eapf-field {
  border-color: #d63638;
  background-color: rgba(214, 54, 56, 0.05);
}

.eapf-required {
  color: #d63638;
  margin-right: 4px;
}

/* Loading Animation */
@keyframes eapf-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.eapf-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: eapf-spin 1s ease-in-out infinite;
  margin-right: 10px;
  vertical-align: middle;
}

/* RTL Support */
.rtl .eapf-form-field select.eapf-field {
  background-position: left 12px center;
  padding-right: 15px;
  padding-left: 36px;
}

.rtl .eapf-required {
  margin-right: 0;
  margin-left: 4px;
}

/* Responsive Design */
@media (max-width: 767px) {
  .eapf-form-field .eapf-field {
    padding: 10px 12px;
    font-size: 14px;
  }

  .eapf-button {
    width: 100%;
    padding: 12px;
  }

  .eapf-result {
    padding: 15px;
  }

  .eapf-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* Print Styles */
@media print {
  .eapf-form,
  .eapf-status {
    display: none !important;
  }

  .eapf-result {
    border: none;
    padding: 0;
    background: none;
  }
}

/* Button Badge Widget */
.eapf-badge-button-wrapper {
  text-align: left;
}

.eapf-badge-button {
  position: relative;
  display: inline-block;
  padding: 12px 24px;
  background-color: #2271b1;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.eapf-badge-button:hover {
  background-color: #135e96;
  transform: translateY(-1px);
}

.eapf-badge-button:active {
  transform: translateY(0);
}

.eapf-badge {
  position: absolute;
  min-width: 24px;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background-color: #e11d48; /* default can be overridden by Elementor control */
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  --bb-off-x: 0px;
  --bb-off-y: 0px;
}

/* Badge position variants */
.eapf-badge.pos-tr {
  top: 0;
  right: 0;
  transform: translate(
    calc(50% + var(--bb-off-x)),
    calc(-50% + var(--bb-off-y))
  );
}
.eapf-badge.pos-tl {
  top: 0;
  left: 0;
  transform: translate(
    calc(-50% + var(--bb-off-x)),
    calc(-50% + var(--bb-off-y))
  );
}
.eapf-badge.pos-br {
  bottom: 0;
  right: 0;
  transform: translate(
    calc(50% + var(--bb-off-x)),
    calc(50% + var(--bb-off-y))
  );
}
.eapf-badge.pos-bl {
  bottom: 0;
  left: 0;
  transform: translate(
    calc(-50% + var(--bb-off-x)),
    calc(50% + var(--bb-off-y))
  );
}

/* RTL support tweaks */
.rtl .eapf-badge.pos-tr {
  right: 0;
  left: auto;
}
.rtl .eapf-badge.pos-tl {
  left: 0;
  right: auto;
}

/* File Upload with Icons & Previews */
.eapf-file-upload-wrapper {
  position: relative;
  width: 100%;
  min-height: 120px;
  border: 2px dashed #ddd;
  border-radius: 12px;
  background-color: #fcfcfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  padding: 15px;
  text-align: center;
}

.eapf-file-upload-wrapper:hover {
  border-color: #2271b1;
  background-color: #f0f6fc;
}

.eapf-file-upload-wrapper.has-file {
  border-style: solid;
  border-color: #2271b1;
}

.eapf-file-placeholder {
  pointer-events: none;
}

.eapf-file-placeholder .eapf-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  color: #888;
  opacity: 0.6;
}

.eapf-file-placeholder .eapf-label {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

.eapf-upload-hint {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
  pointer-events: none;
}

.eapf-file-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  background: #fff;
}

.eapf-file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eapf-remove-file {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(220, 53, 69, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
  margin: 0;
}

.eapf-remove-file:hover {
  background: #dc3545;
}

.eapf-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

/* Cropper Modal */
.eapf-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.eapf-modal.is-visible {
  display: flex;
}

.eapf-modal-content {
  background-color: #fff;
  width: 100%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.eapf-modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eapf-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.eapf-close-modal {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}

.eapf-close-modal:hover {
  color: #333;
}

.eapf-modal-body {
  padding: 20px;
  flex: 1;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8f8f8;
}

.eapf-cropper-container {
  width: 100%;
  max-height: 50vh;
}

#eapf-cropper-image {
  max-width: 100%;
  display: block;
}

.eapf-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.eapf-button-secondary {
  background-color: #6c757d;
}

.eapf-button-secondary:hover {
  background-color: #5a6268;
}

/* RTL fix for modal */
.rtl .eapf-modal-footer {
  flex-direction: row-reverse;
}

@media (max-width: 767px) {
  .eapf-modal-content {
    max-width: 100%;
  }
}
