/**
 * Admin styles for AHM AI Post Summary
 * Version: 1.1.6
 */

/* Admin Settings Page Styles */
.ahmaipsu-saving {
  position: relative;
  overflow: hidden;
}

.ahmaipsu-saving::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: ahmaipsu-shimmer 1.5s infinite;
}

@keyframes ahmaipsu-shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Enhanced notice styles */
.notice.notice-success {
  border-left-color: #00a32a;
  background: #f0f8f0;
}

.notice.notice-error {
  border-left-color: #d63638;
  background: #fdf0f0;
}

.notice p {
  font-size: 14px;
  line-height: 1.5;
  margin: 0.5em 0;
}

/* Admin settings specific styles */
.ahmaipsu-api-key-container {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ahmaipsu-api-key-input {
  width: 400px;
}

.ahmaipsu-validate-button {
  white-space: nowrap;
}

.ahmaipsu-validate-button.hidden {
  display: none;
  white-space: nowrap;
}

.ahmaipsu-validate-icon {
  margin-right: 5px;
  vertical-align: text-bottom;
}

.ahmaipsu-validation-result {
  margin-top: 10px;
}

.ahmaipsu-instructions {
  /* Base instructions styling */
}

.ahmaipsu-instructions.hidden {
  display: none;
}

.ahmaipsu-warning-notice {
  margin: 10px 0;
  padding: 10px;
}

.ahmaipsu-disclaimer-textarea {
  width: 100%;
}

.ahmaipsu-test-container {
  margin-top: 20px;
  padding: 15px;
  background: #f1f1f1;
  border: 1px solid #ccd0d4;
}

.ahmaipsu-test-result {
  margin-top: 10px;
}

/* Post Editor Styles */
.ahmaipsu-warning-text {
  color: orange;
  font-style: italic;
  margin-top: 10px;
}

.ahmaipsu-summary-preview {
  margin-top: 15px;
  padding: 10px;
  background: #f0f8ff;
  border: 1px solid #b3d9ff;
  border-radius: 4px;
}

.ahmaipsu-summary-preview.hidden {
  display: none;
}

.ahmaipsu-summary-title {
  margin: 0 0 10px 0;
  color: #0073aa;
}

.ahmaipsu-summary-text {
  margin: 0;
  line-height: 1.5;
  color: #333;
}

.ahmaipsu-summary-actions {
  margin-top: 10px;
}

.ahmaipsu-regenerate-button {
  margin-right: 10px;
}

.ahmaipsu-regenerate-status {
  color: #666;
  font-style: italic;
  display: none;
}

.ahmaipsu-summary-placeholder {
  color: #666;
  font-style: italic;
  margin-top: 10px;
}

.ahmaipsu-info-notice {
  margin: 10px 0 0 0;
  padding: 8px 12px;
  background: #e7f3ff;
  border-left: 4px solid #0073aa;
}

.ahmaipsu-info-notice p {
  margin: 0;
  font-size: 13px;
}

.ahmaipsu-summary-status {
  margin-top: 10px;
  padding: 8px;
  display: none;
  border-radius: 4px;
}

.ahmaipsu-status-spinner {
  float: left;
  margin-right: 8px;
}

.ahmaipsu-summary-footer {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
}

/* Post Editor Meta Box Styles */
.ahmaipsu-meta-box {
  padding: 15px;
}

.ahmaipsu-meta-box .form-table {
  margin-top: 0;
}

.ahmaipsu-meta-box .form-table th {
  width: 150px;
  font-weight: 600;
}

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

/* Status Display */
#gpt-summary-status {
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
  display: none;
}

#gpt-summary-status.success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

#gpt-summary-status.error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

#gpt-summary-status.generating {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

/* Button Styles */
.ahmaipsu-button {
  background: #0073aa;
  border: 1px solid #0073aa;
  color: #fff;
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.ahmaipsu-button:hover {
  background: #005a87;
  border-color: #005a87;
  color: #fff;
}

.ahmaipsu-button:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}

/* Spinner Animation */
.ahmaipsu-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #0073aa;
  border-radius: 50%;
  animation: ahmaipsu-spin 1s linear infinite;
  margin-right: 5px;
}

.ahmaipsu-spinning {
  animation: ahmaipsu-spin 1s linear infinite;
}

@keyframes ahmaipsu-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Regenerate Status */
#ahmaipsu-regenerate-status {
  margin-top: 10px;
  font-style: italic;
  color: #666;
  display: none;
}

/* Regenerate Button Styles */
#ahmaipsu-regenerate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#ahmaipsu-regenerate-btn .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
}

#ahmaipsu-regenerate-btn.ahmaipsu-spinning .dashicons {
  animation: ahmaipsu-spin 1s linear infinite;
}

/* Settings Page Styles */
.ahmaipsu-settings {
  max-width: 800px;
}

.ahmaipsu-note {
  margin: 10px 0;
  padding: 10px;
  background: #fff6e5;
  border-left: 4px solid #ffb86b;
  border-radius: 0 4px 4px 0;
}

.ahmaipsu-note p {
  margin: 0;
}

/* Instructions Display */
.ahmaipsu-instructions {
  margin-top: 15px;
  padding: 15px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.ahmaipsu-instructions h4 {
  margin-top: 0;
  color: #333;
}

.ahmaipsu-instructions ol {
  margin: 10px 0;
  padding-left: 20px;
}

/* Theme Selector Styles */
.ahmaipsu-theme-selector {
  max-width: 1000px;
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.ahmaipsu-theme-selector > p.description {
  margin-bottom: 25px;
  font-size: 14px;
  color: #666;
  background: #f8f9fa;
  padding: 12px 16px;
  border-radius: 4px;
  border-left: 4px solid #0073aa;
  grid-column: 1 / -1;
}

.ahmaipsu-theme-selector > input[type="hidden"] {
  display: none;
}

.ahmaipsu-theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  background: #ffffff;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ahmaipsu-theme-option:hover {
  border-color: #0073aa;
  background: #f8fcff;
  box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
  transform: translateY(-1px);
}

.ahmaipsu-theme-option.selected {
  border-color: #0073aa;
  background: #f0f8ff;
  box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

/* Radio button styles (not currently used in HTML) */
/*
.ahmaipsu-theme-radio {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.ahmaipsu-theme-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #0073aa;
  cursor: pointer;
}
*/

.ahmaipsu-theme-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  margin-bottom: 15px;
}

.ahmaipsu-theme-name {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1d2327;
  line-height: 1.3;
}

.ahmaipsu-theme-description {
  margin: 0;
  color: #646970;
  font-size: 14px;
  line-height: 1.5;
}

.ahmaipsu-theme-preview {
  width: 100%;
  max-width: 280px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e1e5e9;
  background: #fff;
  transition: transform 0.3s ease;
}

.ahmaipsu-theme-option:hover .ahmaipsu-theme-preview {
  transform: scale(1.02);
}

.ahmaipsu-theme-note {
  margin-top: 30px;
  padding: 16px 20px;
  background: #fff6e5;
  border-left: 4px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ahmaipsu-theme-note p {
  margin: 0;
  color: #92400e;
  font-size: 14px;
  line-height: 1.5;
}

/* Theme Preview Styles */
.ahmaipsu-preview-classic {
  padding: 16px;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-bottom: 1px solid #e1e5e9;
}

.ahmaipsu-preview-classic h4 {
  margin: 0 0 12px 0;
  color: #1d2327;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 2px solid #0073aa;
  padding-bottom: 6px;
  display: inline-block;
}

.ahmaipsu-preview-classic p {
  margin: 0 0 12px 0;
  color: #3c434a;
  line-height: 1.6;
  font-size: 14px;
}

.ahmaipsu-preview-classic small {
  color: #646970;
  font-style: italic;
  font-size: 12px;
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f1;
}

.ahmaipsu-preview-minimal {
  padding: 16px;
  background: #f6f7f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ahmaipsu-preview-minimal h4 {
  margin: 0 0 12px 0;
  color: #1d2327;
  font-size: 15px;
  font-weight: 500;
}

.ahmaipsu-preview-minimal p {
  margin: 0 0 12px 0;
  color: #3c434a;
  line-height: 1.5;
  font-size: 14px;
}

.ahmaipsu-preview-minimal small {
  color: #646970;
  font-size: 12px;
}

.ahmaipsu-preview-modern {
  padding: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ahmaipsu-preview-modern h4 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
}

.ahmaipsu-preview-modern p {
  margin: 0 0 12px 0;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
  font-size: 14px;
}

.ahmaipsu-preview-modern small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.ahmaipsu-preview-elegant {
  padding: 20px;
  background: #ffffff;
  border-left: 4px solid #8e44ad;
  font-family: Georgia, "Times New Roman", serif;
}

.ahmaipsu-preview-elegant h4 {
  margin: 0 0 14px 0;
  color: #8e44ad;
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
}

.ahmaipsu-preview-elegant p {
  margin: 0 0 14px 0;
  color: #2c3e50;
  line-height: 1.7;
  font-size: 15px;
}

.ahmaipsu-preview-elegant small {
  color: #7f8c8d;
  font-size: 13px;
  font-style: italic;
}

.ahmaipsu-preview-card {
  padding: 18px;
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 4px;
}

.ahmaipsu-preview-card h4 {
  margin: 0 0 14px 0;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ahmaipsu-preview-card p {
  margin: 0 0 14px 0;
  color: #3c434a;
  line-height: 1.6;
  font-size: 14px;
}

.ahmaipsu-preview-card small {
  color: #646970;
  font-size: 12px;
  background: #f0f0f1;
  padding: 4px 8px;
  border-radius: 3px;
  display: inline-block;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .ahmaipsu-theme-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .ahmaipsu-theme-selector {
    grid-template-columns: repeat(1, 1fr);
  }

  .ahmaipsu-theme-option {
    padding: 15px;
  }

  .ahmaipsu-theme-preview {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .ahmaipsu-theme-selector {
    grid-template-columns: repeat(1, 1fr);
    gap: 15px;
  }

  .ahmaipsu-theme-option {
    padding: 15px;
  }

  .ahmaipsu-theme-name {
    font-size: 16px;
  }

  .ahmaipsu-theme-description {
    font-size: 13px;
  }

  .ahmaipsu-theme-preview {
    max-width: 100%;
  }
}

/* Animation Classes */
.ahmaipsu-preview-selected {
  animation: ahmaipsu-theme-pulse 0.6s ease-in-out;
}

@keyframes ahmaipsu-theme-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.ahmaipsu-theme-selected-message {
  animation: ahmaipsu-slide-in 0.3s ease-out;
  margin: 15px 0;
  padding: 12px 16px;
  background: #d1edda;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
  color: #155724;
}

@keyframes ahmaipsu-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings Form Feedback Styles */
.ahmaipsu-saving {
  position: relative;
  overflow: hidden;
}

.ahmaipsu-saving::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: ahmaipsu-shimmer 1.5s infinite;
}

@keyframes ahmaipsu-shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Enhanced notice styles */
.notice.notice-success {
  border-left-color: #00a32a !important;
  background: #f0f8f0 !important;
  animation: ahmaipsu-slide-in 0.3s ease-out;
}

.notice.notice-error {
  border-left-color: #d63638 !important;
  background: #fdf0f0 !important;
  animation: ahmaipsu-slide-in 0.3s ease-out;
}

.notice.notice-info {
  border-left-color: #0073aa !important;
  background: #f0f8ff !important;
  animation: ahmaipsu-slide-in 0.3s ease-out;
}

.notice p {
  font-size: 14px !important;
  line-height: 1.5 !important;
  margin: 0.5em 0 !important;
}

.ahmaipsu-temp-notice {
  margin: 15px 0 !important;
  padding: 10px 15px !important;
  border-radius: 4px !important;
}

/* Settings saved animation */
.settings-saved-flash {
  animation: ahmaipsu-success-flash 2s ease-out;
}

@keyframes ahmaipsu-success-flash {
  0% {
    background: #f0f8f0;
  }
  50% {
    background: #d4edda;
  }
  100% {
    background: #f0f8f0;
  }
}

/* Tab functionality styles - High specificity to override WordPress defaults */
.wrap form#ahmaipsu-settings-form div.tab-content,
.wrap #ahmaipsu-settings-form div.tab-content,
#ahmaipsu-settings-form div.tab-content,
.ahmaipsu-settings-form div.tab-content,
form#ahmaipsu-settings-form div.tab-content,
div#ahmaipsu-settings-form div.tab-content {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.wrap form#ahmaipsu-settings-form div.tab-content.active,
.wrap #ahmaipsu-settings-form div.tab-content.active,
#ahmaipsu-settings-form div.tab-content.active,
.ahmaipsu-settings-form div.tab-content.active,
form#ahmaipsu-settings-form div.tab-content.active,
div#ahmaipsu-settings-form div.tab-content.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

.nav-tab-wrapper .nav-tab.nav-tab-active,
.nav-tab-wrapper a.nav-tab-active {
  background: #fff !important;
  border-bottom: 1px solid #fff !important;
  color: #2271b1 !important;
  border-color: #ccc #ccc #fff !important;
}
