/* === ROOT TOKENS ======================================================= */

:root {
  --bg: #101010;
  --bg2: #121212;
  --panel: #181818;
  --panel-soft: #1c1c1c;
  --ink: #f2f2f2;
  --ink-muted: #a0a0a0;
  --accent: #e0e0e0;        /* neutral light grey, no blue */
  --border: #282828;
  --border-soft: #2e2e2e;
  --danger: #ff4b6b;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Your softer shadow */
  --shadow-soft: 0px 0px 20px 1px #090909;
  --shadow-subtle: 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* === RESET & BASE ====================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--ink);
}

/* === APP SHELL ========================================================= */

.app-shell {
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* === HEADER ============================================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #151515;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo-wrap { /* I removed it to keepo it the same as Palette Grabber Pro */
  /* width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #2e2e2e;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-subtle);
  overflow: hidden; */
}

.app-logo {
  max-width: 38px;
  max-height: 38px;
  display: block;
}

.app-title-block {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
}

.ver {
	color: #888;
	font-size: 11px;
	margin-left: 6px
}

/* Header controls */

.app-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === BUTTONS =========================================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: #2e2e2e;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.btn:hover:not(:disabled) {
  background: #262626;
  border-color: var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

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

.btn-primary {
  background: #e6e6e6;
  border-color: #d0d0d0;
  color: #111111;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #f0f0f0;
}

.btn-ghost {
  background: #181818;
  border-color: var(--border-soft);
}

.btn-small {
  padding: 4px 9px;
  font-size: 12px;
}

/* File input disguised as button */

.file-button input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* === MAIN LAYOUT ======================================================= */

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1.3fr);
  gap: 12px;
}

/* Panels */

.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-list {
  padding: 10px 10px 12px;
}

.panel-side {
  padding: 10px 10px 12px;
}

/* Panel header */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid #2e2e2e;
}

.panel-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
}

.panel-meta {
  font-size: 11px;
  color: var(--ink-muted);
  text-align: right;
}

.palette-name-label {
  opacity: 0.85;
}

/* === TOOLBAR ROW ======================================================= */

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 4px 8px;
  border-bottom: 1px solid #2e2e2e;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: #1c1c1c;
  border: 1px solid #2e2e2e;
}

.toolbar-label {
  font-size: 11px;
  color: var(--ink-muted);
}

.toolbar-buttons {
  display: flex;
  gap: 4px;
}

/* === SWATCH LIST ======================================================= */

.swatch-list {
  margin-top: 6px;
  padding: 0 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  max-height: calc(100vh - 220px);
}

/* Swatch row */

.sw-row {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  padding-right: 14px;
  padding-top: 6px;
  padding-bottom: 6px;
  border-radius: 10px;
  background: #191919;
  border: 1px solid #2e2e2e;
}

/* === SWATCH ROW — SELECTED GLOW ======================================= */

.sw-row.is-selected{
  border-color: #6aa3ff;
  box-shadow:
    0 0 0 1px rgba(106, 163, 255, 0.55),
    0 0 14px rgba(106, 163, 255, 0.22);
}

.sw-row.is-selected:focus-within{
  border-color: #6aa3ff;
  box-shadow:
    0 0 0 1px rgba(106, 163, 255, 0.65),
    0 0 18px rgba(106, 163, 255, 0.28);
}



/* === DRAG DROP INDICATOR LINE === */
.sw-row.drop-before::before{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  top:-1px;
  height:2px;
  background:#ffffff;
  border-radius:2px;
  opacity:0.9;
  pointer-events:none;
}

.sw-row.drop-after::after{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  bottom:-1px;
  height:2px;
  background:#ffffff;
  border-radius:2px;
  opacity:0.9;
  pointer-events:none;
}
.sw-row:nth-child(odd) {
  background: #151515;
}

.sw-row:hover {
  border-color: #2a2a2a;
}

/* Drag states */

.sw-row-dragging {
  opacity: 0.55;
}

.sw-row-drop-before::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  border-top: 2px solid var(--accent);
}

/* Drag handle placeholder */

.sw-handle {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 14px;
  cursor: grab;
  opacity: 0.8;
}

/* Color chip */

.sw-chip {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: var(--sw-color, #888888);
}

/* Info block */

.sw-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sw-name-input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #2e2e2e;
  background: #141414;
  color: var(--ink);
  padding: 3px 8px;
  font: inherit;
  font-size: 13px;
}

.sw-name-input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.sw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
}

.sw-meta code {
  font-family: ui-monospace, Menlo, Monaco, Consolas, "SF Mono", monospace;
}

/* Row actions */

.sw-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sw-actions .btn-small {
  min-width: 28px;
}

/* === SIDE PANEL: TABS ================================================== */

.side-tabs {
  display: flex;
  gap: 6px;
  padding: 2px 4px 8px;
  border-bottom: 1px solid #2e2e2e;
}

.tab-button {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #181818;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.tab-button:hover {
  border-color: #2a2a2a;
  background: #202020;
}

.tab-active {
  background: #2e2e2e;
  color: var(--ink);
  border-color: #e0e0e0;
}

.tab-panel {
  padding: 8px 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-panel-hidden {
  display: none;
}

/* === FIELDS & PANELS =================================================== */

.panel-section {
  padding: 6px 6px 4px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid #2e2e2e;
}

.section-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.field-label {
  font-size: 12px;
  color: var(--ink-muted);
}

.field-input {
  border-radius: 8px;
  border: 1px solid #2e2e2e;
  background: #141414;
  color: var(--ink);
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
}

.field-input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.field-help {
  margin: 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.bullet-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--ink-muted);
}

.bullet-list li + li {
  margin-top: 2px;
}

/* === CODE EDITOR ======================================================= */

.code-editor-wrap {
  margin-top: 2px;
  border-radius: 10px;
  border: 1px solid #2e2e2e;
  background: #121212;
  overflow: hidden;
}

.code-editor {
  width: 100%;
  min-height: 220px;
  max-height: calc(100vh - 280px);
  padding: 8px 10px;
  border: none;
  outline: none;
  resize: vertical;
  background: #121212;
  color: #e4e4f4;
  font-family: ui-monospace, Menlo, Monaco, Consolas, "SF Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.code-buttons {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

/* === FOOTER ============================================================ */

.app-footer {
  padding: 6px 10px 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #151515;
  font-size: 11px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.footer-main {
  color: var(--ink);
}

.footer-sub {
  opacity: 0.8;
}

.footer-status {
  font-size: 11px;
  color: var(--ink-muted);
}


/* === COPYRIGHT LINE === */

.copyright{
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #24242a;
  font-size: 11px;
  color: #8d8d98;
  text-align: center;
}

/* === MEDIA QUERIES ===================================================== */

@media (max-width: 960px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-side {
    order: -1;
  }

  .swatch-list {
    max-height: none;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header-controls {
    align-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* === FOOTER – GUIDE / TIPS ============================================ */

.app-footer {
  padding: 8px 10px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #151515;
  font-size: 11px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.app-footer .fhd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.app-footer .fbd {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-footer .grid5 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
}

.app-footer .gi {
  font-size: 11px;
  color: var(--ink-muted);
}

.app-footer .kbd {
  display: inline-block;
  padding: 2px 10px;
  margin-left: 2px;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  background: #111111;
  font-size: 16px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, "SF Mono", monospace;
}

.tip-note {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.footer-link {
  margin: 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.footer-status {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-muted);
}

/* Footer links forced to white */
.app-footer a,
.app-footer a:visited {
  color: #ffffff;
  text-decoration: underline;
}

.app-footer a:hover,
.app-footer a:focus {
  color: #f0f0f0;
  text-decoration: underline;
}

/* === COLOR BASICS MODAL =============================================== */

.cb-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
  z-index: 190;
}

.cb-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: 520px;
  width: calc(100% - 32px);
  max-height: calc(100% - 80px);
  background: #181818;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  z-index: 195;
  display: flex;
  flex-direction: column;
}

.cb-back.cb-show,
.cb-modal.cb-show {
  opacity: 1;
  pointer-events: auto;
}

.cb-modal.cb-show {
  transform: translate(-50%, -50%) scale(1);
}

.cb-modal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #242424;
  background: #1b1b1b;
  font-size: 13px;
  font-weight: 600;
}

.cb-modal-body {
  padding: 10px 12px 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}

.cb-modal-body h3 {
  margin: 8px 0 4px;
  font-size: 13px;
}

.cb-modal-body p {
  margin: 4px 0;
}

.cb-modal-body ul {
  margin: 4px 0 4px 18px;
  padding: 0;
}

.cb-modal-bar .cb-close {
  margin-left: auto;
}


/* Footer links */
.app-footer a,
.app-footer a:visited {
  color: #ffffff;
  text-decoration: underline;
}

.app-footer a:hover,
.app-footer a:focus {
  color: #f0f0f0;
  text-decoration: underline;
}

/* === COLOR MIXER & NAMER MODAL ======================================== */

.mix-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
  z-index: 210;
}

.mix-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: 520px;
  width: calc(100% - 32px);
  max-height: calc(100% - 80px);
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  z-index: 215;
  display: flex;
  flex-direction: column;
}

.mix-back.mix-show,
.mix-modal.mix-show {
  opacity: 1;
  pointer-events: auto;
}

.mix-modal.mix-show {
  transform: translate(-50%, -50%) scale(1);
}

.mix-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: #181818;
  font-size: 13px;
  font-weight: 600;
}

.mix-modal-body {
  padding: 10px 12px 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 10px 16px;
}

.mix-preview {
  height: 90px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #181818;
}

.mix-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.mix-row label {
  font-size: 11px;
  color: var(--ink-muted);
}

.mix-row input[type="text"] {
  min-width: 0;
}

.mix-chip-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mix-chip-wrap input[type="color"] {
  width: 32px;
  height: 28px;
  border: none;
  padding: 0;
  background: transparent;
}

.mix-chip-button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mix-chip-inner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.mix-slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.mix-slider-row .slider {
  width: 100%;
}

.mix-slider-value {
  width: 42px;
  text-align: right;
  font-size: 11px;
  color: var(--ink-muted);
}

.mix-name-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}

.mix-name-row label {
  font-size: 11px;
  color: var(--ink-muted);
}

.mix-auto-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-muted);
}

.mix-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.mix-copy-btn {
  font-size: 11px;
  padding: 4px 8px;
}

/* Compact on very small screens */
@media (max-width: 480px) {
  .mix-modal-body {
    grid-template-columns: 1fr;
  }
}
