/* PR Manager Frontend Styles */

.pr-manager-form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pr-form-title {
  margin: 0 0 30px 0;
  padding: 0;
  font-size: 28px;
  font-weight: 600;
  color: #333;
  text-align: center;
  border-bottom: 2px solid #e1e1e1;
  padding-bottom: 15px;
}

/* Form Messages */
#pr-form-messages {
  margin-bottom: 20px;
}

.pr-message {
  padding: 12px 20px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-weight: 500;
}

.pr-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.pr-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Form Structure */
.pr-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pr-form-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.pr-form-group {
  display: flex;
  flex-direction: column;
}

.pr-form-group-full {
  flex: 1;
  width: 100%;
}

.pr-form-group-half {
  flex: 1;
  min-width: 280px;
}

/* Labels */
.pr-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.pr-form label.required::after {
  content: " *";
  color: #dc3545;
}

/* Form Inputs */
.pr-form input[type="text"],
.pr-form input[type="url"],
.pr-form input[type="email"],
.pr-form select,
.pr-form textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1e1e1;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.pr-form input[type="text"]:focus,
.pr-form input[type="url"]:focus,
.pr-form input[type="email"]:focus,
.pr-form select:focus,
.pr-form textarea:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.pr-form textarea {
  resize: vertical;
  min-height: 100px;
}

/* Form Sections */
.pr-form-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e1e1e1;
}

.pr-form-section h4 {
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

/* Upload Area */
.pr-upload-area {
  margin-top: 15px;
}

.pr-upload-dropzone {
  border: 2px dashed #007cba;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative;
}

.pr-upload-dropzone:hover,
.pr-upload-dropzone.dragover {
  border-color: #005a87;
  background-color: #e6f3ff;
}

.pr-upload-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.pr-upload-text p {
  margin: 5px 0;
  font-size: 16px;
  color: #333;
}

.pr-upload-text p:last-child {
  font-size: 14px;
  color: #666;
}

.pr-upload-instructions {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

/* Uploaded Files */
.pr-uploaded-files {
  margin-top: 20px;
}

/* Product Picker */
.pr-products-picker {
  margin-top: 8px;
}
.pr-products-picker .pr-button {
  background: #007cba;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 6px 10px;
  cursor: pointer;
}
.pr-products-picker .pr-button:hover {
  background: #005a87;
}
.pr-product-search {
  margin-top: 8px;
}
#pr-product-search-input {
  width: 100%;
  padding: 8px 36px 8px 10px;
  border: 2px solid #e1e1e1;
  border-radius: 4px;
  position: relative;
}
/* Container to position clear/spinner overlayed in the right side */
.pr-product-search {
  position: relative;
}
/* Inline clear button inside the search bar (right side) */
.pr-search-clear {
  position: absolute !important;
  top: 20px;
  right: 10px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50% !important;
  border: none;
  background: #e1e1e1;
  color: #333;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px !important;
  line-height: 1;
  padding: 5px !important;
  /* max-width: 20px !important; */
  min-height: 10px !important;
  /* min-width: 20px !important; */
}
.pr-search-clear:hover {
  background: #d6d6d6;
}
/* Inline spinner in the same right corner; sits under the clear button when visible */
.pr-search-spinner {
  position: absolute;
  top: 13px;
  right: 50px;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  border: 2px solid #ccc;
  border-top-color: #007cba;
  border-radius: 50%;
  animation: pr-spin 0.8s linear infinite;
}
@keyframes pr-spin {
  to {
    transform: rotate(360deg);
  }
}
.pr-product-search-results {
  margin-top: 10px;
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  max-height: 260px;
  overflow: auto;
  position: relative;
}
.pr-product-result {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #eee;
  align-items: center;
}
.pr-product-result:last-child {
  border-bottom: none;
}
.pr-product-result-thumb {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f6f6;
  border-radius: 4px;
  overflow: hidden;
}
.pr-product-result-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
}
.pr-product-result-info {
  flex: 1;
  min-width: 0;
}
.pr-product-result-name {
  font-weight: 600;
  color: #333;
}
.pr-product-result-url {
  font-size: 12px;
  color: #555;
  word-break: break-all;
}
.pr-product-result-desc {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}
.pr-product-result-action {
}

.pr-selected-products {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pr-selected-product {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  align-items: center;
}
.pr-selected-thumb {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f6f6;
  border-radius: 4px;
  overflow: hidden;
}
.pr-selected-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
}
.pr-selected-info {
  flex: 1;
  min-width: 0;
}
.pr-selected-name {
  font-weight: 600;
  color: #333;
}
.pr-selected-url {
  font-size: 12px;
  color: #007cba;
  word-break: break-all;
  display: inline-block;
  margin-top: 2px;
}
.pr-selected-desc {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}
.pr-selected-action .pr-button {
  background: #dc3545;
}
.pr-selected-action .pr-button:hover {
  background: #c82333;
}
.pr-thumb-placeholder {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eee;
  color: #666;
  border-radius: 4px;
}

.pr-file-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  margin-bottom: 10px;
}

.pr-file-thumbnail {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.pr-file-info {
  flex: 1;
}

.pr-file-name {
  font-weight: 500;
  margin: 0 0 5px 0;
}

.pr-file-size {
  font-size: 12px;
  color: #666;
  margin: 0;
}

.pr-file-remove {
  background: #dc3545;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.pr-file-remove:hover {
  background: #c82333;
}

.pr-file-progress {
  height: 4px;
  background: #e1e1e1;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 5px;
}

.pr-file-progress-bar {
  height: 100%;
  background: #28a745;
  transition: width 0.3s ease;
}

/* Submit Button */
.pr-submit-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-height: 50px;
}

.pr-submit-btn:hover {
  background: #005a87;
}

.pr-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.pr-submit-loading {
  display: none;
}

.pr-submit-btn.loading .pr-submit-text {
  display: none;
}

.pr-submit-btn.loading .pr-submit-loading {
  display: inline;
}

/* Cloudflare Turnstile */
.pr-turnstile {
  margin: 20px 0;
  text-align: center;
}

.pr-turnstile iframe {
  margin: 0 auto;
  display: block;
}

/* Success Message */
.pr-success-message {
  text-align: center;
  padding: 40px 20px;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 500;
}

.pr-success-icon {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
  .pr-manager-form-container {
    margin: 10px;
    padding: 15px;
  }

  .pr-form-row {
    flex-direction: column;
    gap: 15px;
  }

  .pr-form-group-half {
    min-width: unset;
  }

  .pr-form-title {
    font-size: 24px;
  }

  .pr-upload-dropzone {
    padding: 30px 15px;
  }

  .pr-file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .pr-file-thumbnail {
    margin-right: 0;
  }
}

@media (max-width: 480px) {
  .pr-manager-form-container {
    margin: 5px;
    padding: 10px;
  }

  .pr-form input[type="text"],
  .pr-form input[type="url"],
  .pr-form input[type="email"],
  .pr-form select,
  .pr-form textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .pr-submit-btn {
    padding: 12px 20px;
    font-size: 16px;
  }
}

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

.pr-loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007cba;
  border-radius: 50%;
  animation: pr-spin 1s linear infinite;
}

/* Validation Styles */
.pr-form input.error,
.pr-form select.error,
.pr-form textarea.error {
  border-color: #dc3545;
}

.pr-form .field-error {
  color: #dc3545;
  font-size: 12px;
  margin-top: 5px;
}

/* Upload pending state */
.pr-submit-btn.uploads-pending {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
  cursor: not-allowed;
  opacity: 0.8;
}

.pr-submit-btn.uploads-pending:hover {
  background-color: #ffc107;
  border-color: #ffc107;
  opacity: 0.8;
}
