:root{
  /* Enhanced Professional Color Palette */
  --bg: #0a0e1a;           /* Deeper, richer background */
  --panel: #0f1424;         /* More sophisticated panel color */
  --muted: #8b95a8;         /* Better contrast muted text */
  --text: #f1f5f9;          /* Cleaner, more readable text */
  --brand: #6366f1;         /* Modern indigo brand color */
  --ok: #10b981;            /* Professional green */
  --warn: #f59e0b;          /* Professional amber */
  --accent: #8b5cf6;        /* Purple accent for highlights */
  --success: #059669;        /* Success states */
  --error: #dc2626;          /* Error states */
  --card: #111827;           /* Rich card background */
  --border: rgba(148, 163, 184, 0.1); /* Subtle borders */
  --swatch-radius: 14px;
  --toast-bg: rgba(8,12,26,.95);
  --input-bg: #0e1530;
  --input-border: rgba(148, 163, 184, 0.2);
  --button-bg: #1e293b;
  --button-hover: #334155;
  --button-border: rgba(148, 163, 184, 0.2);
  
  /* Professional Spacing System */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  
  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  
  /* Enhanced Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --muted: #64748b;
  --text: #1e293b;
  --brand: #4f46e5;
  --ok: #059669;
  --warn: #d97706;
  --accent: #7c3aed;
  --success: #047857;
  --error: #b91c1c;
  --card: #ffffff;
  --border: rgba(0,0,0,.08);
  --toast-bg: rgba(255,255,255,.95);
  --input-bg: #f1f5f9;
  --input-border: rgba(0,0,0,.1);
  --button-bg: #f1f5f9;
  --button-hover: #e2e8f0;
  --button-border: rgba(0,0,0,.1);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial; 
  background:radial-gradient(1200px 600px at 80% -10%, var(--panel) 0%, transparent 60%) ,var(--bg); 
  color:var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

header{
  position:sticky;
  top:0;
  z-index:10;
  backdrop-filter:saturate(1.2) blur(12px); 
  background:linear-gradient(180deg, rgba(15,22,47,.95) 0%, rgba(15,22,47,.7) 100%); 
  border-bottom:1px solid var(--border);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] header {
  background:linear-gradient(180deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,.6) 100%);
}

.wrap{max-width:1220px;margin:0 auto;padding:var(--space-md) var(--space-xl)}
.title{display:flex;align-items:center;gap:var(--space-md);justify-content:space-between}
.badge{
  font-size:var(--text-xs);
  padding:var(--space-xs) var(--space-sm);
  border:1px solid var(--border);
  border-radius:999px;
  color:var(--muted);
  background: rgba(99, 102, 241, 0.1);
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.badge:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--brand);
  transform: translateY(-1px);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  transition: left 0.5s ease;
}

.theme-toggle:hover {
  background: var(--button-hover);
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover::before {
  left: 100%;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
  transform: rotate(15deg) scale(1.1);
}

main{
  max-width:1220px;
  margin:var(--space-xl) auto;
  padding:0 var(--space-xl); 
  display:grid; 
  grid-template-columns: 1.25fr .95fr; 
  gap:var(--space-xl)
}

@media (max-width: 1080px){ 
  main{grid-template-columns:1fr; gap: var(--space-lg);}
}

.card{
  background:var(--card); 
  border:1px solid var(--border); 
  border-radius:18px; 
  box-shadow:var(--shadow-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card h2{
  font-size:var(--text-lg);
  margin:0 0 var(--space-md) 0;
  color:var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
}

.card h2 .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.card h2:hover .icon {
  opacity: 1;
  transform: scale(1.1);
  color: var(--brand);
}

.card .body{padding:var(--space-md)}

.drop{
  border:2px dashed var(--border); 
  border-radius:16px; 
  padding:var(--space-xl); 
  display:flex; 
  align-items:center; 
  justify-content:center; 
  text-align:center; 
  min-height:160px; 
  cursor:pointer; 
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.02), rgba(139, 92, 246, 0.02));
  position: relative;
  overflow: hidden;
}

.drop::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drop:hover{
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.drop:hover::before {
  opacity: 1;
}

.drop.drag{
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--brand);
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.hint{color:var(--muted); font-size:var(--text-sm); line-height: 1.5; opacity: 0.8}

.bar{
  display:flex; 
  gap:var(--space-sm); 
  flex-wrap:wrap; 
  align-items:center;
  margin: var(--space-md) 0;
}

.bar .grow{flex:1}

.btn{
  appearance:none; 
  border:1px solid var(--button-border); 
  background:var(--button-bg); 
  color:var(--text); 
  padding:var(--space-sm) var(--space-md); 
  border-radius:12px; 
  font-weight:600; 
  cursor:pointer; 
  transition: all 0.2s ease; 
  display:inline-flex; 
  align-items:center; 
  gap:var(--space-sm);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn:hover{
  transform:translateY(-2px); 
  background:var(--button-hover); 
  border-color:var(--brand);
  box-shadow: var(--shadow-md);
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn[disabled]{
  opacity:.5; 
  cursor:not-allowed; 
  transform:none
}

.btn.ok{
  background:var(--ok); 
  border-color:var(--ok);
  color: white;
}

.btn.warn{
  background:var(--warn); 
  border-color:var(--warn);
  color: white;
}

.btn.ghost{
  background:transparent
}

.row{
  display:grid; 
  grid-template-columns: repeat(2,minmax(0,1fr)); 
  gap:var(--space-md);
  margin: var(--space-md) 0;
}

@media (max-width:640px){ 
  .row{grid-template-columns:1fr; gap: var(--space-sm);}
  .wrap{padding: var(--space-sm) var(--space-md);}
  main{padding: 0 var(--space-sm);}
}

label{
  font-size:var(--text-sm);
  color:var(--muted); 
  display:block; 
  margin-bottom:var(--space-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="number"], select{
  width:100%; 
  background:var(--input-bg); 
  border:1px solid var(--input-border); 
  color:var(--text); 
  padding:var(--space-sm) var(--space-md); 
  border-radius:10px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  font-size: var(--text-sm);
}

input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

input[type="number"]:hover, select:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.swatches{
  display:grid; 
  grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); 
  gap:var(--space-md);
  margin: var(--space-md) 0;
}

.swatch{
  border-radius:var(--swatch-radius); 
  overflow:hidden; 
  border:1px solid var(--border); 
  background:var(--card);
  transition: all 0.3s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.swatch:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--brand);
}

.swatch::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

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

.swatch .edit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 10;
}

.swatch:hover .edit-overlay {
  opacity: 1;
  pointer-events: auto;
}

.swatch .edit-btn {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  font-size: var(--text-xs);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative;
  z-index: 20;
}

.swatch .edit-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.chip{
  height:84px;
  position: relative;
  z-index: 1;
}
.swmeta{
  padding:var(--space-sm);
  position: relative;
  z-index: 1;
}

.code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; 
  font-size:var(--text-xs); 
  background:var(--input-bg); 
  border:1px solid var(--border); 
  padding:var(--space-xs) var(--space-sm); 
  border-radius:9px; 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  gap:var(--space-sm);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
}

.code:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

.code .copy{cursor:pointer; opacity:.8; transition: all 0.2s ease; padding: var(--space-xs); border-radius: 4px;}
.code .copy:hover{opacity: 1; background: rgba(99, 102, 241, 0.1); transform: scale(1.1);}

.image-preview{
  max-width:100%; 
  border-radius:14px; 
  border:1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.image-preview:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.02);
}

.grid{display:grid; gap:var(--space-md); margin: var(--space-md) 0}
.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}

.palette-roles{
  display:grid; 
  grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); 
  gap:var(--space-md);
  margin: var(--space-md) 0;
}

.role{
  border:1px solid var(--border); 
  border-radius:14px; 
  overflow:hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.role:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
  transform: translateY(-2px);
}

.role .top{height:50px}
.role .meta{padding:var(--space-sm)}

.footer{
  opacity:.7; 
  font-size:var(--text-xs); 
  text-align:center; 
  padding:var(--space-2xl);
  border-top: 1px solid var(--border);
  margin-top: var(--space-2xl);
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.02));
}

.toast{
  position:fixed; 
  right:var(--space-md); 
  bottom:var(--space-md); 
  background:var(--toast-bg); 
  color:var(--text); 
  border:1px solid var(--border); 
  border-radius:12px; 
  padding:var(--space-md); 
  box-shadow:var(--shadow-xl); 
  max-width:380px; 
  z-index:50;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  transform: translateX(100%);
  opacity: 0;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
  animation: toast-slide-in 0.3s ease-out;
}

@keyframes toast-slide-in {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast .t-title{
  font-weight:800; 
  margin-bottom:var(--space-xs);
  font-size: var(--text-sm);
}

.toast.ok{
  border-color: rgba(16,185,129,.4);
  background: linear-gradient(135deg, var(--toast-bg), rgba(16,185,129,.1));
}

.toast.err{
  border-color: rgba(220,38,38,.4);
  background: linear-gradient(135deg, var(--toast-bg), rgba(220,38,38,.1));
}

.toast.warn{
  border-color: rgba(245,158,11,.5);
  background: linear-gradient(135deg, var(--toast-bg), rgba(245,158,11,.1));
}

.small{
  font-size:var(--text-xs); 
  color:var(--muted);
  opacity: 0.8;
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace
}

.tests{font-size:var(--text-sm); margin: var(--space-md) 0}
.tests .pass{color:var(--ok); font-weight: 600;}
.tests .fail{color:var(--error); font-weight: 600;}
.tests .case{
  display:flex; 
  justify-content:space-between; 
  border-bottom:1px dashed var(--border); 
  padding:var(--space-xs) 0;
  transition: all 0.2s ease;
}

.tests .case:hover {
  background: rgba(99, 102, 241, 0.05);
  padding-left: var(--space-sm);
  border-radius: 4px;
}

/* Theme preview panel */
.preview{
  display:grid; 
  gap:var(--space-sm); 
  grid-template-columns:1fr 1fr;
  margin: var(--space-md) 0;
}

.pane{
  border:1px solid var(--border); 
  border-radius:14px; 
  overflow:hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.pane:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

.pane .head{
  padding:var(--space-sm); 
  font-weight:700;
  background: linear-gradient(135deg, var(--card), var(--input-bg));
  border-bottom: 1px solid var(--border);
}

.pane .content{
  padding:var(--space-md); 
  display:grid; 
  gap:var(--space-sm);
  background: var(--card);
}

.chiprow{
  display:flex; 
  gap:var(--space-sm); 
  flex-wrap:wrap;
  margin: var(--space-xs) 0;
}

.pill{
  padding:var(--space-xs) var(--space-sm); 
  border-radius:999px; 
  font-size:var(--text-xs);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Enhanced palette controls */
.palette-controls {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  flex-wrap: wrap;
}

.palette-controls .btn {
  font-size: var(--text-xs);
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(135deg, var(--button-bg), var(--button-hover));
}

/* Color picker modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
}

.modal-overlay.active .modal {
  transform: translateY(0);
  animation: modal-appear 0.4s ease-out;
}

@keyframes modal-appear {
  0% {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal h3 {
  margin: 0 0 var(--space-md) 0;
  color: var(--text);
  font-size: var(--text-xl);
  font-weight: 600;
  text-align: center;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.modal h4 {
  margin: 0 0 var(--space-md) 0;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

/* Color preview section */
.color-preview-section {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  align-items: center;
  padding: var(--space-md);
  background: var(--input-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.color-preview {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #000;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.color-preview:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.color-info {
  flex: 1;
}

.current-color, .new-color {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.current-color span, .new-color span {
  font-family: monospace;
  color: var(--text);
  font-weight: 600;
  background: var(--card);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Color wheel section */
.color-wheel-section {
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background: var(--input-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.color-wheel-container {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-md);
  text-align: center;
}

#colorWheel {
  border-radius: 50%;
  border: 3px solid var(--border);
  cursor: crosshair;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

#colorWheel:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

.wheel-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(0,0,0,0.7);
  transition: all 0.2s ease;
}

.wheel-cursor:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 12px rgba(0,0,0,0.9);
}

.wheel-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.control-group label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  text-align: center;
}

.control-group input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.2s ease;
}

.control-group input[type="range"]:hover {
  background: var(--button-hover);
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-lg);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-lg);
}

.control-group span {
  font-size: var(--text-xs);
  color: var(--text);
  font-family: monospace;
  text-align: center;
  font-weight: 600;
  background: var(--card);
  padding: var(--space-xs);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.modal .form-group {
  margin-bottom: var(--space-md);
}

.modal .form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--text);
  font-weight: 500;
  font-size: var(--text-sm);
}

.modal .form-group input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.modal .form-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal .form-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* Algorithm options */
.algorithm-options {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-md);
  margin: var(--space-md) 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.algorithm-options::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0.7;
}

.algorithm-options h4 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.algorithm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.algorithm-option {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.algorithm-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.algorithm-option:hover {
  border-color: var(--brand);
  background: var(--button-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.algorithm-option:hover::before {
  left: 100%;
}

.algorithm-option.active {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white;
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* Loading States & Skeleton Loading */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

.skeleton {
  background: linear-gradient(90deg, var(--input-bg) 25%, var(--button-hover) 50%, var(--input-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Enhanced focus states for accessibility */
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
.algorithm-option:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .modal {
    max-width: 95%;
    padding: var(--space-lg);
  }
  
  .color-wheel-container {
    text-align: center;
  }
  
  .wheel-controls {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .color-preview-section {
    flex-direction: column;
    text-align: center;
  }
  
  .algorithm-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
  }
  
  .palette-controls {
    flex-direction: column;
  }
  
  .palette-controls .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Sample Images Section */
.sample-images-section {
  background: var(--card-bg, #1e293b) !important;
  border: 1px solid var(--border, #334155) !important;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.sample-images-section h4 {
  margin: 0 0 12px 0;
  color: var(--text, #e2e8f0);
  font-size: 16px;
  font-weight: 600;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.sample-btn {
  padding: 8px;
  border: 1px solid var(--border, #334155);
  border-radius: 6px;
  background: var(--card-bg, #1e293b);
  color: var(--text, #e2e8f0);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.sample-btn:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--hover-bg, #334155);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sample-btn:active {
  transform: translateY(0);
}

.sample-btn .sample-preview {
  width: 100%;
  height: 60px;
  border-radius: 4px;
  margin-bottom: 6px;
  background-size: cover;
  background-position: center;
}

.sample-btn .sample-label {
  font-size: 12px;
  text-align: center;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sample-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .sample-grid {
    grid-template-columns: 1fr;
  }
}

/* Animations for warning states */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes highlight {
  0% {
    border-color: #f59e0b;
  }
  50% {
    border-color: #ef4444;
  }
  100% {
    border-color: #f59e0b;
  }
}

/* Corporate environment warning styles */
.corporate-warning {
  border-color: #f59e0b !important;
  border-width: 2px !important;
  animation: highlight 3s ease-in-out infinite;
}

/* Enhanced error states */
.upload-error {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Accessibility improvements */
.sample-btn:focus {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

.sample-btn:focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

/* Corporate Information Section */
.corporate-info {
  background: var(--info-bg, #0f172a) !important;
  border: 1px solid var(--info-border, #1e40af) !important;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.corporate-info h4 {
  margin: 0 0 12px 0;
  color: var(--info-text, #60a5fa);
  font-size: 14px;
  font-weight: 600;
}

.corporate-info .hint {
  color: var(--info-text-muted, #93c5fd);
  font-size: 13px;
  line-height: 1.5;
}

.corporate-info p {
  margin: 0 0 8px 0;
}

.corporate-info p:last-child {
  margin: 0;
}

.corporate-info strong {
  color: var(--info-text, #60a5fa);
  font-weight: 600;
}

/* CSS Variables for info section */
:root {
  --info-bg: #0f172a;
  --info-border: #1e40af;
  --info-text: #60a5fa;
  --info-text-muted: #93c5fd;
}

[data-theme="light"] {
  --info-bg: #eff6ff;
  --info-border: #3b82f6;
  --info-text: #1d4ed8;
  --info-text-muted: #2563eb;
}

/* Success colors for Excel compatibility note */
:root {
  --success-bg: #064e3b;
  --success-border: #059669;
  --success-text: #6ee7b7;
}

[data-theme="light"] {
  --success-bg: #ecfdf5;
  --success-border: #10b981;
  --success-text: #065f46;
}
