/* ═══════════════════════════════════════════════
   Components — panels, buttons, forms, chips, etc.
   ═══════════════════════════════════════════════ */

/* ─── PANEL ─── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  user-select: none;
}

.panel--collapsible .panel-header {
  cursor: pointer;
}

.panel--collapsible .panel-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.panel-chevron {
  margin-left: auto;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--speed-med);
}

.panel.collapsed .panel-chevron {
  transform: rotate(-90deg);
}

.panel.collapsed .panel-header {
  border-bottom-color: transparent;
}

.panel-content {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--speed-med);
  overflow: hidden;
}

.panel.collapsed .panel-content {
  grid-template-rows: 0fr;
}

.panel-body {
  padding: 16px;
  min-height: 0;
}

/* ─── STATUS DOTS ─── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--green   { background: var(--green); }
.dot--magenta { background: var(--magenta); }
.dot--yellow  { background: var(--yellow); }
.dot--blue    { background: var(--blue); }

/* ─── FORM FIELDS ─── */
.field {
  margin-bottom: 14px;
}
.field:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

input[type="text"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-bright);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border var(--speed-med), box-shadow var(--speed-med);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(86, 212, 221, 0.1);
}

/* Prevent autofill from overriding styles */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px var(--bg) inset !important;
  -webkit-text-fill-color: var(--text-bright) !important;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236e7681'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ─── BUTTONS ─── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--speed-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--text-dim);
  color: var(--text-bright);
}

.btn-primary {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
  font-weight: 600;
}

.btn-primary:hover {
  background: #6ee0e8;
  border-color: #6ee0e8;
}

.btn-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-size: 11px;
}

/* ─── COLOR SWATCHES ─── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.color-swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--speed-fast);
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--text-bright);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.color-swatch[data-name]::after {
  content: attr(data-name);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--speed-fast);
  pointer-events: none;
}

.color-swatch:hover::after {
  opacity: 1;
}

/* ─── TOGGLE CHIPS ─── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--speed-fast);
  user-select: none;
}

.chip:hover {
  border-color: var(--text-dim);
}

.chip.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(86, 212, 221, 0.08);
}

/* ─── ASCII ART SELECTOR ─── */
.ascii-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ascii-option {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: all var(--speed-fast);
  text-align: center;
}

.ascii-option:hover {
  border-color: var(--text-dim);
}

.ascii-option.active {
  border-color: var(--cyan);
  background: rgba(86, 212, 221, 0.05);
}

.ascii-option pre {
  font-size: 6px;
  line-height: 1.1;
  color: var(--cyan);
  margin-bottom: 6px;
  overflow: hidden;
  height: 50px;
}

.ascii-option .name {
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── LAYOUT SELECTOR ─── */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.layout-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--speed-fast);
  text-align: center;
}

.layout-card:hover {
  border-color: var(--text-dim);
}

.layout-card.active {
  border-color: var(--cyan);
  background: rgba(86, 212, 221, 0.05);
}

.layout-card .name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.layout-card .desc {
  font-size: 10px;
  color: var(--text-dim);
}

/* ─── CMD BLOCKS ─── */
.cmd-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  margin-bottom: 12px;
}

.cmd-block code {
  color: var(--green);
  font-size: 13px;
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
}

.cmd-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── GALLERY CARD ─── */
.gallery-card {
  cursor: pointer;
  transition: transform var(--speed-fast), border-color var(--speed-fast);
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--text-dim);
}

.gallery-card-art {
  padding: 12px;
  text-align: center;
}

.gallery-card-art pre {
  font-size: 7px;
  line-height: 1.1;
  height: 48px;
  overflow: hidden;
  text-align: center;
}

.gallery-card-body {
  padding: 12px;
}

.gallery-card-title {
  color: var(--text-bright);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.gallery-card-meta {
  color: var(--text-dim);
  font-size: 11px;
}

.gallery-card-cmd {
  margin-top: 8px;
  font-size: 10px;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  word-break: break-all;
}

/* ─── ANIMATIONS ─── */
@keyframes blink {
  0%, 50%  { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--cursor);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.5s ease forwards;
}
