/* Reset & BaseStyles */
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background-color: #000;
  color: #fff;
}

/* Canvas Fullscreen */
#visualCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  display: block;
}

/* Fluted Glass Effect Overlay */
.fluted-glass {
  position: absolute;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  will-change: opacity, background-size;
}

.fluted-glass.active {
  opacity: 1;
  backdrop-filter: blur(14px) brightness(1.05) contrast(1.1);
  -webkit-backdrop-filter: blur(14px) brightness(1.05) contrast(1.1);
  background-image: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.0) 0%,
      rgba(255, 255, 255, 0.4) 15%,
      rgba(255, 255, 255, 0.1) 30%,
      rgba(0, 0, 0, 0.0) 50%,
      rgba(0, 0, 0, 0.1) 80%,
      rgba(0, 0, 0, 0.4) 95%,
      rgba(255, 255, 255, 0.0) 100%
  );
  box-shadow: inset 0 0 100px rgba(0,0,0,0.4);
}

/* Control Panel - Glassmorphism */
.control-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 320px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 10;
  
  background: rgba(20, 20, 24, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Scrollbar ẩn cho panel mượt mà */
.control-panel::-webkit-scrollbar {
  width: 6px;
}
.control-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.panel-header {
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
}

.panel-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #aaa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel-header p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Control Groups */
.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.control-group label span {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* Custom Range Slider */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  transition: background 0.3s;
}

.slider:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Palette Options & Color Controls */
.radio-group {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}
.radio-label {
  font-size: 13px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.color-add-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
}

.color-picker {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: transparent;
}
.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.color-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 0 8px;
  font-family: monospace;
  font-size: 13px;
  outline: none;
}
.color-input:focus {
  border-color: rgba(255, 255, 255, 0.5);
}

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

.custom-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pair-swatch {
  width: 40px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s;
}
.pair-swatch:hover {
  transform: scale(1.1);
  border-color: #fff;
}
.pair-swatch::after {
  content: '×';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  opacity: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 5px;
  text-shadow: 0 1px 2px #000;
}
.pair-swatch:hover::after {
  opacity: 1;
}

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: #fff;
  color: #000;
}

.btn-primary:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,255,255,0.2);
}

.btn-primary:active {
  transform: translateY(1px);
}

.radiate-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
}

.hint-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 10px;
  line-height: 1.4;
}

.image-upload-btn {
  display: block;
  background: rgba(16, 166, 236, 0.2);
  border: 1px dashed rgba(16, 166, 236, 0.5);
  color: #10A6EC;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.image-upload-btn:hover {
  background: rgba(16, 166, 236, 0.3);
  border-color: #10A6EC;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Section Title */
.section-title {
  margin: 0 0 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

/* Toggle checkbox label */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 10px;
}
.toggle-check {
  transform: scale(1.3);
  cursor: pointer;
  accent-color: #05D9E8;
}

/* Radiate effect box */
.radiate-box {
  background: rgba(255, 42, 109, 0.08);
  border: 1px solid rgba(255, 42, 109, 0.3);
  border-radius: 10px;
  padding: 14px;
}

/* Hint text */
.hint-text {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin: 8px 0 0 0;
  line-height: 1.5;
}

/* Select control */
.select-control {
  width: 100%;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  margin-top: 4px;
  transition: border-color 0.2s;
}
.select-control:hover,
.select-control:focus {
  border-color: rgba(255,255,255,0.5);
}
.select-control option {
  background: #1a1a2e;
  color: #fff;
}

/* Section Title */
.section-title {
  margin: 0 0 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

/* Select control */
.select-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  margin-top: 4px;
  transition: border-color 0.2s;
}
.select-control:hover,
.select-control:focus {
  border-color: rgba(255, 255, 255, 0.5);
}
.select-control option {
  background: #1a1a2e;
  color: #fff;
}

@media (max-width: 600px) {
  .control-panel {
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 50vh;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }
}
