/* ============================================================
   MyGahoo Color Group Designer
   All selectors are scoped under #designer-root / .ds-* to
   avoid conflicts with MkDocs Material styles.
   ============================================================ */

#designer-root {
  margin: 1.5rem 0;
}

.ds-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ----------------------------------------------------------
   Device selector tabs
   ---------------------------------------------------------- */
.ds-device-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ds-device-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1.1rem;
  border: 2px solid var(--md-default-fg-color--lighter, #ccc);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  color: inherit;
  font-family: inherit;
  line-height: 1.3;
}

.ds-device-btn:hover {
  border-color: var(--md-primary-fg-color, #2196f3);
  background: var(--md-code-bg-color, #f5f5f5);
}

.ds-device-btn.ds-active {
  border-color: var(--md-primary-fg-color, #2196f3);
  background: var(--md-primary-fg-color, #2196f3);
  color: var(--md-primary-bg-color, #fff);
}

.ds-device-rows {
  font-size: 1.25rem;
  font-weight: 700;
}

.ds-device-label {
  font-size: 0.68rem;
  opacity: 0.85;
  text-align: center;
  white-space: nowrap;
}

/* ----------------------------------------------------------
   Main two-column layout
   ---------------------------------------------------------- */
.ds-main {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   Device preview panel
   ---------------------------------------------------------- */
.ds-preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.ds-preview-device {
  border: 2px solid #333;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0; /* remove inline gap under SVG */
}

.ds-preview-caption {
  font-size: 0.72rem;
  opacity: 0.55;
  text-align: center;
}

/* ----------------------------------------------------------
   Color groups panel
   ---------------------------------------------------------- */
.ds-groups-panel {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ds-groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Group card */
.ds-group-card {
  border: 1px solid var(--md-default-fg-color--lightest, #e0e0e0);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  background: var(--md-code-bg-color, #f8f8f8);
}

.ds-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.ds-group-name {
  flex: 1;
  min-width: 100px;
  border: none;
  border-bottom: 1.5px solid #bbb;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: inherit;
  font-family: inherit;
  padding: 0.15rem 0;
  outline: none;
}

.ds-group-name:focus {
  border-bottom-color: var(--md-primary-fg-color, #2196f3);
}

/* Type badge */
.ds-type-badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--md-default-fg-color--light, #555);
  white-space: nowrap;
  user-select: none;
}

.ds-type-variable {
  background: rgba(33, 150, 243, 0.12);
  color: #1565c0;
}

[data-md-color-scheme="slate"] .ds-type-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #aaa;
}

[data-md-color-scheme="slate"] .ds-type-variable {
  background: rgba(100, 181, 246, 0.15);
  color: #90caf9;
}

/* Remove group button */
.ds-remove-group {
  margin-left: auto;
  border: none;
  background: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.1rem;
  line-height: 1;
  transition: color 0.15s;
}

.ds-remove-group:hover {
  color: #e53935;
}

/* ----------------------------------------------------------
   Color swatches
   ---------------------------------------------------------- */
.ds-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ds-swatch-wrap {
  position: relative;
  display: inline-flex;
}

.ds-color-input {
  width: 36px;
  height: 36px;
  border: 2px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: none;
  transition: border-color 0.15s;
}

.ds-color-input:hover {
  border-color: var(--md-primary-fg-color, #2196f3);
}

/* Remove color button — appears on hover */
.ds-color-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: none;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  z-index: 1;
}

.ds-swatch-wrap:hover .ds-color-remove {
  display: flex;
}

/* Add color slot button */
.ds-add-color {
  width: 36px;
  height: 36px;
  border: 2px dashed #bbb;
  border-radius: 6px;
  background: transparent;
  color: #bbb;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  padding: 0;
  line-height: 1;
}

.ds-add-color:hover {
  border-color: var(--md-primary-fg-color, #2196f3);
  color: var(--md-primary-fg-color, #2196f3);
}

/* Add color group button */
.ds-add-group {
  border: 2px dashed #bbb;
  border-radius: 8px;
  background: transparent;
  padding: 0.5rem 1rem;
  color: #999;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
  width: 100%;
  text-align: center;
}

.ds-add-group:hover {
  border-color: var(--md-primary-fg-color, #2196f3);
  color: var(--md-primary-fg-color, #2196f3);
}

/* ----------------------------------------------------------
   Dark mode overrides for cards
   ---------------------------------------------------------- */
[data-md-color-scheme="slate"] .ds-group-card {
  border-color: #3a3a4a;
  background: #1e1e2e;
}

[data-md-color-scheme="slate"] .ds-group-name {
  border-bottom-color: #555;
}

[data-md-color-scheme="slate"] .ds-color-input {
  border-color: #555;
}

/* ----------------------------------------------------------
   Output panel
   ---------------------------------------------------------- */
.ds-output-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ds-output-label {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.65;
  letter-spacing: 0.02em;
}

.ds-output-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.ds-output-textarea {
  flex: 1;
  font-family: monospace;
  font-size: 0.82rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--md-default-fg-color--lightest, #e0e0e0);
  border-radius: 6px;
  background: var(--md-code-bg-color, #f5f5f5);
  color: inherit;
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
}

[data-md-color-scheme="slate"] .ds-output-textarea {
  background: #1e1e2e;
  border-color: #3a3a4a;
}

.ds-copy-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--md-primary-fg-color, #2196f3);
  border-radius: 6px;
  background: var(--md-primary-fg-color, #2196f3);
  color: var(--md-primary-bg-color, #fff);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ds-copy-btn:hover {
  opacity: 0.88;
}

.ds-copy-btn.ds-copied {
  background: #43a047;
  border-color: #43a047;
}

/* ----------------------------------------------------------
   Responsive — narrow screens
   ---------------------------------------------------------- */
@media (max-width: 560px) {
  .ds-main {
    flex-direction: column;
  }

  .ds-preview-panel {
    width: 100%;
    align-items: center;
  }

  .ds-preview-device svg {
    width: 100%;
    height: auto;
  }
}
