/**
 * Admin Theme Editor - Enhanced UX Styles
 * Provides a polished, accessible theme customization experience
 */

/* ========================================
   Theme Editor Layout
   ======================================== */

.theme-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 80px; /* Space for fixed actions */
}

@media (max-width: 768px) {
  .theme-editor-grid {
    grid-template-columns: 1fr;
  }
}

.theme-card {
  background: var(--bg-secondary, #0f1e2e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.theme-card h4 {
  margin-bottom: 20px;
  font-size: 1.25rem;
  color: var(--text-primary);
}

/* ========================================
   Color Input Groups
   ======================================== */

.color-input-group {
  margin-bottom: 16px;
}

.color-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.color-input:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.color-input label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  margin: 0;
}

.color-input input[type="color"] {
  border: 2px solid rgba(255, 255, 255, 0.1);
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-input input[type="color"]:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.color-input .hex-value {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 80px;
  text-align: center;
}

/* ========================================
   Contrast Checker
   ======================================== */

.contrast-checker {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.contrast-checker h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contrast-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.contrast-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.contrast-pass {
  background: rgba(22, 163, 74, 0.2);
  color: #22c55e;
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.contrast-fail {
  background: rgba(185, 28, 28, 0.2);
  color: #ef4444;
  border: 1px solid rgba(185, 28, 28, 0.3);
}

.contrast-ratio {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.wcag-levels {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.wcag-level {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.wcag-level.pass {
  background: rgba(22, 163, 74, 0.15);
  color: #22c55e;
}

.wcag-level.fail {
  background: rgba(185, 28, 28, 0.15);
  color: #ef4444;
}

/* ========================================
   Preset Selector
   ======================================== */

.preset-selector {
  margin-bottom: 24px;
}

.preset-selector label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.preset-select {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-select:hover,
.preset-select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  outline: none;
}

.preset-palette {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-left: 8px;
}

.preset-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.preset-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.preset-card.selected {
  border-color: var(--accent-primary);
  background: rgba(11, 92, 137, 0.1);
}

.preset-card-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* ========================================
   Live Preview Box
   ======================================== */

.preview-box {
  background: var(--bg-primary, #0a2030);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  min-height: 400px;
}

.preview-box h4 {
  margin-bottom: 20px;
  color: var(--text-primary);
  text-align: center;
}

.preview-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.preview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.preview-card h4 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.preview-card p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 14px;
}

.preview-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-text-samples {
  margin-top: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.preview-text-samples p {
  margin-bottom: 8px;
}

/* ========================================
   Form Controls
   ======================================== */

.form-section {
  margin-bottom: 24px;
}

.form-section h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  outline: none;
}

/* ========================================
   Fixed Action Buttons
   ======================================== */

.fixed-actions {
  position: fixed;
  bottom: 0;
  left: 240px; /* Sidebar width */
  right: 0;
  background: rgba(15, 17, 26, 0.95);
  backdrop-filter: blur(10px);
  padding: 16px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .fixed-actions {
    left: 0;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
}

.action-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.action-btn-primary {
  background: var(--gradient-accent);
  color: white;
}

.action-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(22, 163, 74, 0.95);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.error {
  background: rgba(239, 68, 68, 0.95);
}

.toast.info {
  background: rgba(59, 130, 246, 0.95);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   Tooltip System
   ======================================== */

.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: help;
  margin-left: 6px;
  transition: all 0.2s ease;
}

.tooltip-trigger:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--accent-primary);
}

/* ========================================
   Utility Classes
   ======================================== */

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 24px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.help-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(22, 163, 74, 0.2);
  color: #22c55e;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
