/* Base layout */

:root {
  --bg-body: #050509;
  --bg-elevated: #111119;
  --bg-elevated-soft: #17171f;
  --bg-sidebar: #090910;
  --accent: #ffb35a;
  --accent-soft: rgba(255, 179, 90, 0.18);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text-main: #f8f5ff;
  --text-subtle: #b7b5c5;
  --text-muted: #7f7d8d;
  --chip-bg: rgba(0, 0, 0, 0.45);
  --chip-bg-hover: rgba(0, 0, 0, 0.75);
  --toast-bg: rgba(12, 12, 18, 0.96);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 999px;
}

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

body.palette-page {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #161623 0, #050509 55%);
  color: var(--text-main);
}

/* Shared header */

.ha-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(to bottom, rgba(5, 5, 9, 0.94), rgba(5, 5, 9, 0.85));
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
}

.ha-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.ha-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.ha-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 13px;
}

.ha-logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: conic-gradient(
    from 210deg,
    #ffb35a,
    #ff6a6a,
    #6d8bff,
    #3bdacb,
    #ffb35a
  );
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7),
    0 10px 30px rgba(0, 0, 0, 0.7);
}

.ha-logo-text {
  position: relative;
  top: 1px;
}

.ha-nav {
  display: flex;
  gap: 10px;
}

.ha-nav-link {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-subtle);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ha-nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.ha-nav-link-active {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at top, rgba(255, 179, 90, 0.16), transparent);
}

/* Shell layout */

.palette-shell {
  max-width: 1200px;
  margin: 32px auto 40px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
}

/* Sidebar */

.palette-sidebar {
  position: sticky;
  top: 90px; /* header height + margin */
  align-self: flex-start;
}

.sidebar-card {
  background: var(--bg-sidebar);
  border-radius: 20px;
  padding: 14px 10px 10px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.65);
}

.sidebar-title {
  padding: 0 10px 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.sidebar-tree {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom thin scrollbar */

.sidebar-tree::-webkit-scrollbar {
  width: 6px;
}
.sidebar-tree::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.sidebar-group {
  margin-bottom: 8px;
}

.sidebar-group-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  opacity: 0.9;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-item-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 10px 6px;
  font-size: 13px;
  color: var(--text-subtle);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.sidebar-item-btn span.sidebar-emoji {
  font-size: 14px;
  width: 18px;
  display: inline-flex;
  justify-content: center;
}

.sidebar-item-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.sidebar-item-btn.active {
  background: linear-gradient(to right, #ffb35a, #ff7f5a);
  color: #141218;
  transform: translateX(1px);
}

.sidebar-item-btn.active .sidebar-emoji {
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.4));
}

.sidebar-status {
  margin-top: 10px;
  padding: 6px 10px 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Main content */

.palette-main {
  min-width: 0;
}

.app-header {
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0;
  font-family: "Playfair Display", "Georgia", serif;
  font-size: 36px;
  letter-spacing: 0.03em;
}

.app-subtitle {
  margin: 4px 0 0;
  color: var(--text-subtle);
  font-size: 14px;
}

.palette-meta {
  background: var(--bg-elevated-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  padding: 16px 20px 14px;
  margin-bottom: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.palette-meta-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Playfair Display", "Georgia", serif;
  font-size: 20px;
}

.palette-meta-emoji {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(255, 179, 90, 0.26), transparent);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.palette-meta-description {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-subtle);
}

.palette-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Color cards */

.color-card {
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid rgba(0, 0, 0, 0.65);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
}

.color-card.light-card {
  color: #1d1a1f;
}

.card-content {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.color-name {
  font-family: "Playfair Display", "Georgia", serif;
  font-size: 24px;
  margin-bottom: 4px;
}

.color-description {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

.light-card .color-description {
  color: rgba(0, 0, 0, 0.74);
}

.color-codes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.color-code {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: #fdfbff;
  cursor: pointer;
  user-select: none;
}

.color-card.light-card .color-code {
  background: rgba(0, 0, 0, 0.45);
  color: #f5f5ff;
}

.color-code:hover {
  background: var(--chip-bg-hover);
}

.copy-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Export section */

.export-section {
  margin-top: 28px;
  background: var(--bg-elevated-soft);
  border-radius: var(--radius-lg);
  padding: 16px 20px 18px;
  border: 1px solid var(--border-soft);
}

.export-section h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.export-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-subtle);
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.export-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at top, rgba(255, 179, 90, 0.16), transparent);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.export-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.export-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
}

.export-status {
  font-size: 12px;
  color: var(--text-subtle);
}

/* Footer */

.palette-footer {
  padding: 20px 0 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 20px;
}

.palette-footer p {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.palette-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--toast-bg);
  color: var(--text-main);
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

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

/* Responsive */

@media (max-width: 900px) {
  .palette-shell {
    grid-template-columns: 1fr;
  }

  .palette-sidebar {
    position: static;
    order: -1;
  }
}



/* Layout for sidebar + main content */
.palette-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  padding: 2.5rem 3rem 3rem;
}

/* Sidebar */
.palette-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.palette-sidebar-inner {
  background: radial-gradient(circle at top left, #14161f, #05060a);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65);
}

.palette-sidebar-header {
  margin-bottom: 0.75rem;
}

.palette-sidebar-title {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

/* Category sections */
.palette-sidebar-section + .palette-sidebar-section {
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1rem;
}

.palette-sidebar-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.55);
}

.palette-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Sidebar buttons (reuse your existing palette-nav-btn styling if present) */
.palette-nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.palette-nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.palette-nav-btn.active {
  background: linear-gradient(135deg, #ff9b4a, #ff5e59);
  color: #111015;
}
 
/* Main area flex */
.app-main {
  flex: 1;
}
