/* ===========================================================
   A11y Contrast Matrix — Styles
   Theme: Dark mode · Glassmorphism · Premium feel
   =========================================================== */

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --accent: #00CEC9;
  --bg: #0B0E11;
  --bg-card: rgba(20, 24, 32, 0.7);
  --bg-hover: rgba(108, 92, 231, 0.08);
  --border: rgba(108, 92, 231, 0.15);
  --border-hover: rgba(108, 92, 231, 0.35);
  --text: #E8E6F0;
  --text-muted: #8B8A9E;
  --text-dim: #5A5872;
  --success: #00B894;
  --danger: #FF6B6B;
  --warning: #FDCB6E;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 220ms ease;
  --glass-border: rgba(255, 255, 255, 0.06);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }

.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }

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

/* ── Header ─────────────────────────────────────────────── */
.app-header { margin-bottom: 28px; }
.logo-group { display: flex; align-items: center; gap: 14px; }
.app-header h1 {
  font-size: 1.5rem; font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.tagline { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.83rem; font-weight: 600;
  cursor: pointer; border: none; transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #7f6cf7); color: #fff; box-shadow: 0 4px 14px rgba(108,92,231,0.3); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(108,92,231,0.45); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

/* ── Palette Section ────────────────────────────────────── */
.palette-section {
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 20px; backdrop-filter: blur(12px);
  margin-bottom: 20px;
}
.palette-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.color-list { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: 200px; }
.palette-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Color chip */
.color-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  transition: border-color var(--transition);
}
.color-chip:hover { border-color: var(--border-hover); }
.color-chip input[type="color"] {
  width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; border-radius: 4px; padding: 0;
}
.color-chip input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-chip input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; }
.color-chip input[type="text"] {
  width: 80px; background: transparent; border: none;
  color: var(--text); font-family: 'SF Mono', monospace; font-size: 0.8rem;
  outline: none;
}
.color-chip .chip-label {
  font-size: 0.75rem; color: var(--text-muted); max-width: 60px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.color-chip .remove-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 1rem; padding: 0 2px; transition: color var(--transition);
}
.color-chip .remove-btn:hover { color: var(--danger); }

/* ── Import Dialog ──────────────────────────────────────── */
.import-dialog {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  color: var(--text); max-width: 480px; width: 90vw;
  backdrop-filter: blur(20px);
}
.import-dialog::backdrop { background: rgba(0,0,0,0.6); }
.import-dialog h3 { font-size: 1.1rem; margin-bottom: 12px; }
.import-dialog textarea {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; color: var(--text);
  font-family: 'SF Mono', monospace; font-size: 0.8rem; resize: vertical;
}
.import-dialog textarea:focus { outline: none; border-color: var(--primary); }
.dialog-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  margin-bottom: 20px; padding: 12px 16px;
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); backdrop-filter: blur(12px);
}
.toolbar-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
}
.toolbar-label input[type="checkbox"] { accent-color: var(--primary); }
.toolbar-label select {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; color: var(--text);
  font-family: var(--font); font-size: 0.8rem;
}
.toolbar .btn { margin-left: auto; }

/* ── Matrix ─────────────────────────────────────────────── */
.matrix-section { margin-bottom: 20px; overflow-x: auto; }
.matrix-wrapper { display: inline-block; min-width: 100%; }

.matrix-table {
  border-collapse: separate; border-spacing: 2px;
  width: auto; background: transparent;
}
.matrix-table th, .matrix-table td {
  padding: 0; text-align: center; font-size: 0.72rem;
}
.matrix-table th {
  font-weight: 600; color: var(--text-muted);
  padding: 6px 8px; white-space: nowrap;
}
.matrix-table .header-swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  vertical-align: middle; margin-right: 4px; border: 1px solid rgba(255,255,255,0.12);
}
.matrix-table .corner-cell { background: transparent; }

.matrix-cell {
  width: 72px; height: 54px;
  border-radius: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(255,255,255,0.05); position: relative;
}
.matrix-cell:hover { transform: scale(1.08); z-index: 2; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.matrix-cell .cell-ratio { font-weight: 700; font-size: 0.78rem; }
.matrix-cell .cell-badges { display: flex; gap: 2px; }
.cell-badge {
  font-size: 0.55rem; font-weight: 700; padding: 1px 4px;
  border-radius: 3px; line-height: 1.3;
}
.cell-badge.pass { background: rgba(0,184,148,0.2); color: var(--success); }
.cell-badge.fail { background: rgba(255,107,107,0.2); color: var(--danger); }
.matrix-cell.diagonal { opacity: 0.15; cursor: default; }
.matrix-cell.diagonal:hover { transform: none; box-shadow: none; }

/* ── Detail Section ─────────────────────────────────────── */
.detail-section { margin-bottom: 20px; }
.detail-card {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 20px; backdrop-filter: blur(12px);
}
.detail-preview {
  border-radius: var(--radius-sm); padding: 24px 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; min-height: 120px;
}
.detail-info h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text); }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.82rem; }
.detail-list dt { color: var(--text-muted); font-weight: 500; }
.detail-list dd { color: var(--text); font-weight: 600; }
.detail-list dd.pass { color: var(--success); }
.detail-list dd.fail { color: var(--danger); }
.detail-suggestion {
  margin-top: 14px; padding: 10px 14px;
  background: rgba(0,0,0,0.2); border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--text-muted); display: none;
}
.detail-suggestion.visible { display: block; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(108,92,231,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(108,92,231,0.4); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .app-container { padding: 16px 12px 40px; }
  .detail-card { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { margin-left: 0; }
  .app-header h1 { font-size: 1.2rem; }
}
