/* ============================================
   Brand Color Accessibility Checker — Styles
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Light Theme */
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-border: rgba(255, 255, 255, 0.3);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --fail: #ef4444;
  --fail-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0b0f1a;
  --bg-secondary: #131825;
  --bg-glass: rgba(19, 24, 37, 0.75);
  --bg-glass-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.15);
  --border: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* --- App Container --- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* --- Glass Panel --- */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition), transform var(--transition);
}

.glass-panel:hover {
  box-shadow: var(--shadow-lg);
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 32px;
  gap: 16px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* --- Theme Toggle --- */
.btn-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(15deg) scale(1.05);
}

.hidden {
  display: none !important;
}

/* --- Main Content Grid --- */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* --- Color Inputs Panel --- */
.color-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
}

.input-group {
  flex: 1;
}

.input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: none;
  transition: border-color var(--transition), transform var(--transition);
}

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

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

.mono-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  width: 100%;
  min-width: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.mono-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Swap Button --- */
.btn-swap {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  margin-top: 16px;
}

.btn-swap:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(180deg);
}

/* --- Preview Panel --- */
.preview-panel {
  padding: 32px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), color var(--transition);
}

.preview-content {
  width: 100%;
}

.preview-large {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.preview-normal {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 20px;
  opacity: 0.9;
}

.preview-ui {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: default;
  border: 2px solid currentColor;
  background: transparent;
  transition: none;
}

.preview-border {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  border: 2px dashed currentColor;
  opacity: 0.7;
}

/* --- Ratio Panel --- */
.ratio-panel {
  padding: 24px;
  text-align: center;
}

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

.ratio-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ratio-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
}

.ratio-number {
  font-size: 3.5rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ratio-suffix {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ratio-feedback {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 100px;
  display: inline-block;
  transition: all var(--transition);
}

.ratio-feedback.excellent {
  color: #16a34a;
  background: var(--success-soft);
}

.ratio-feedback.good {
  color: #16a34a;
  background: var(--success-soft);
}

.ratio-feedback.poor {
  color: #f59e0b;
  background: var(--warning-soft);
}

.ratio-feedback.fail {
  color: #ef4444;
  background: var(--fail-soft);
}

/* --- Buttons --- */
.btn-primary {
  padding: 8px 18px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-text {
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-text:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-text.danger:hover {
  background: var(--fail-soft);
  color: var(--fail);
  border-color: var(--fail);
}

/* --- WCAG Panel --- */
.wcag-panel {
  padding: 20px 24px;
}

.wcag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wcag-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.wcag-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.wcag-card.full-width {
  grid-column: 1 / -1;
}

.wcag-card-header {
  margin-bottom: 12px;
}

.wcag-card-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-muted);
}

/* --- Badges --- */
.wcag-badges {
  display: flex;
  gap: 8px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.badge-wide {
  flex: 1;
}

.badge-label {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-status {
  font-weight: 600;
}

.badge.pass {
  background: var(--success-soft);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.2);
}

.badge.fail {
  background: var(--fail-soft);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

/* --- History Section --- */
.history-section {
  padding: 24px;
}

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

.history-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  min-height: 60px;
}

/* --- Saved Color Item --- */
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  animation: slideUp 0.3s ease;
}

.history-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.history-swatches {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.swatch:last-child {
  margin-left: -8px;
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-colors {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-ratio {
  font-weight: 700;
  font-size: 0.85rem;
}

.history-wcag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-wcag.pass {
  color: #16a34a;
  background: var(--success-soft);
}

.history-wcag.fail {
  color: #ef4444;
  background: var(--fail-soft);
}

.history-delete {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition);
  flex-shrink: 0;
  opacity: 0;
}

.history-item:hover .history-delete {
  opacity: 1;
}

.history-delete:hover {
  background: var(--fail-soft);
  color: var(--fail);
}

/* --- Empty State --- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --- Animations --- */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 16px 12px 32px;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .color-inputs {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .btn-swap {
    margin-top: 0;
    transform: rotate(90deg);
  }

  .btn-swap:hover {
    transform: rotate(270deg);
  }

  .ratio-number {
    font-size: 2.5rem;
  }

  .wcag-grid {
    grid-template-columns: 1fr;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    padding: 20px;
  }

  .preview-large {
    font-size: 1.2rem;
  }
}
