/**
 * Admin CSS for Bulk Post Importer
 *
 * @package Bulk_Post_Importer
 */

/* Mapping table styles */
.bulkpostimporter-mapping-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.bulkpostimporter-mapping-table th,
.bulkpostimporter-mapping-table td {
  padding: 12px 8px;
  vertical-align: top;
  border-bottom: 1px solid #e1e1e1;
}

.bulkpostimporter-mapping-table thead th {
  background: #f9f9f9;
  font-weight: 600;
  border-bottom: 2px solid #c3c4c7;
}

.bulkpostimporter-mapping-table tbody tr:hover {
  background: #f6f7f7;
}

.bulkpostimporter-mapping-table select,
.bulkpostimporter-mapping-table input[type="text"] {
  min-width: 200px;
  width: 95%;
  max-width: 400px;
  padding: 6px 8px;
  border: 1px solid #8c8f94;
  border-radius: 3px;
  background: #fff;
}

.bulkpostimporter-mapping-table select:focus,
.bulkpostimporter-mapping-table input[type="text"]:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
  outline: 2px solid transparent;
}

.bulkpostimporter-mapping-table select:disabled {
  background-image: unset;
}

.bulkpostimporter-mapping-table label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.bulkpostimporter-mapping-table label code,
.bulkpostimporter-mapping-table label i {
  font-size: 0.9em;
  color: #646970;
  font-weight: normal;
}

.bulkpostimporter-mapping-table .bulkpostimporter-remove-row {
  margin-left: 5px;
  vertical-align: middle;
  color: #d63638;
  border-color: #d63638;
}

.bulkpostimporter-mapping-table .bulkpostimporter-remove-row:hover {
  background: #d63638;
  color: #fff;
}

.bulkpostimporter-mapping-table p.description {
  font-size: 0.85em;
  font-style: italic;
  margin: 4px 0 0 0;
  color: #646970;
}

/* Section dividers */
hr {
  border: 0;
  border-top: 1px solid #c3c4c7;
  margin: 30px 0;
}

/* Custom field table specific styles */
#bji-custom-fields-table tbody tr:first-child .bji-remove-row {
  opacity: 0.5;
}

#bji-add-custom-field {
  margin-top: 10px;
}

/* Notice improvements */
.notice.is-dismissible {
  position: relative;
  padding-right: 38px;
}

.notice p {
  margin: 0.5em 0;
  padding: 2px;
}

/* Form improvements */
.form-table th {
  width: 200px;
  padding: 20px 10px 20px 0;
  vertical-align: top;
}

.form-table td {
  padding: 15px 10px;
  vertical-align: top;
}

/* Progress indication */
.submit input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Results page styles */
.bulkpostimporter-results-summary {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 3px;
  padding: 15px;
  margin: 20px 0;
}

.bulkpostimporter-results-summary h3 {
  margin-top: 0;
  color: #1d2327;
}

.bulkpostimporter-error-log {
  border: 1px solid #c3c4c7;
  background: #fff;
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
  border-radius: 3px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.bulkpostimporter-error-log ul {
  list-style: disc;
  margin-left: 20px;
  margin-bottom: 0;
}

.bulkpostimporter-error-log li {
  margin-bottom: 5px;
  padding: 2px 0;
}

/* Responsive improvements */
@media screen and (max-width: 782px) {
  .bulkpostimporter-mapping-table {
    font-size: 14px;
  }

  .bulkpostimporter-mapping-table th,
  .bulkpostimporter-mapping-table td {
    padding: 8px 4px;
  }

  .bulkpostimporter-mapping-table select,
  .bulkpostimporter-mapping-table input[type="text"] {
    min-width: 150px;
    width: 100%;
  }

  .form-table th {
    width: auto;
    padding: 10px 0;
  }

  .form-table td {
    padding: 10px 0;
  }
}

/* Accessibility improvements */
.bulkpostimporter-mapping-table select:focus,
.bulkpostimporter-mapping-table input:focus {
  outline: 2px solid #2271b1;
  outline-offset: -2px;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* Loading state */
.bulkpostimporter-loading {
  opacity: 0.6;
  pointer-events: none;
}

.bulkpostimporter-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #c3c4c7;
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* File validation feedback styles */
.bulkpostimporter-file-feedback {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 14px;
}

.bulkpostimporter-file-feedback.success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.bulkpostimporter-file-feedback.error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.bulkpostimporter-success-feedback,
.bulkpostimporter-error-feedback {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bulkpostimporter-success-feedback .dashicons,
.bulkpostimporter-error-feedback .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.bulkpostimporter-success-feedback strong,
.bulkpostimporter-error-feedback strong {
  font-weight: 600;
}

.bulkpostimporter-success-feedback .file-details {
  margin-top: 4px;
  font-size: 13px;
  color: #0f5132;
}

.bulkpostimporter-error-feedback ul {
  margin: 4px 0 0 0;
  padding-left: 16px;
  list-style: disc;
}

.bulkpostimporter-error-feedback li {
  margin-bottom: 2px;
  line-height: 1.4;
}

/* File input improvements */
#bulkpostimporter_json_file {
  padding: 8px;
  border: 2px dashed #c3c4c7;
  border-radius: 4px;
  background: #f9f9f9;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 500px;
}

#bulkpostimporter_json_file:hover {
  border-color: #8c8f94;
  background: #fff;
}

#bulkpostimporter_json_file:focus {
  outline: 2px solid #2271b1;
  outline-offset: -2px;
  border-color: #2271b1;
  background: #fff;
}

/* Submit button disabled state for file validation */
input[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f6f7f7 !important;
  color: #a7aaad !important;
  border-color: #dcdcde !important;
}

/* Responsive adjustments for file feedback */
@media screen and (max-width: 782px) {
  .bulkpostimporter-file-feedback {
    font-size: 13px;
    padding: 6px 8px;
  }
  
  .bulkpostimporter-success-feedback .file-details {
    font-size: 12px;
  }
  
  #bulkpostimporter_json_file {
    max-width: 100%;
  }
}
