/* ==========================================================================
   LuminaBG - Premium Stylesheet
   ========================================================================== */

/* Color Variables & Theme Configurations */
:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Transition curve */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
}

/* Dark Theme Variables */
body.dark-theme {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1b1b26;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(138, 43, 226, 0.5);
  --text-primary: #f5f5f7;
  --text-secondary: #9ea0a5;
  --text-muted: #5e6168;
  
  --accent-primary: #7b2cbf;
  --accent-secondary: #00f2fe;
  --accent-gradient: linear-gradient(135deg, #7b2cbf 0%, #00f2fe 100%);
  --accent-glow: 0 0 20px rgba(123, 44, 191, 0.4);
  
  --card-bg: rgba(18, 18, 26, 0.7);
  --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  --backdrop-blur: blur(12px);
  --checkerboard-color-1: #161622;
  --checkerboard-color-2: #0f0f17;
}

/* Light Theme Variables */
body.light-theme {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-focus: rgba(123, 44, 191, 0.4);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  
  --accent-primary: #7b2cbf;
  --accent-secondary: #00b4d8;
  --accent-gradient: linear-gradient(135deg, #7b2cbf 0%, #00b4d8 100%);
  --accent-glow: 0 0 20px rgba(123, 44, 191, 0.2);
  
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
  --backdrop-blur: blur(12px);
  --checkerboard-color-1: #e9ecef;
  --checkerboard-color-2: #ffffff;
}

/* General Resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.5s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography & Utilities */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p {
  line-height: 1.6;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.hidden {
  display: none !important;
}

/* Container & Wrappers */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(var(--bg-primary), 0.7);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  transition: border-color 0.3s;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.logo-icon {
  background: var(--accent-gradient);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  font-size: 1.1rem;
}

.logo-accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons Styling */
.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--accent-glow);
  border-color: transparent;
}

.icon-btn-small {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.icon-btn-small:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
}

.action-btn {
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 0.8rem 1.8rem;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  font-size: 0.95rem;
}

.primary-btn {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--accent-glow);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(123, 44, 191, 0.5);
  filter: brightness(1.1);
}

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

.secondary-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.secondary-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
}

.outline-btn {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--text-primary);
}

.outline-btn:hover {
  background: rgba(123, 44, 191, 0.1);
  transform: translateY(-2px);
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.text-btn:hover {
  color: var(--text-primary);
  transform: translateX(-3px);
}

.full-width {
  width: 100%;
}

/* Hero Section */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-section {
  width: 100%;
}

.hero-container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 800;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
}

/* Drag & Drop Upload Zone */
.drop-zone-card {
  background: var(--card-bg);
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
}

.drop-zone-card:hover, .drop-zone-card.dragover {
  border-color: var(--accent-primary);
  box-shadow: var(--accent-glow);
  transform: translateY(-2px);
}

.drop-zone-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.03) 0%, rgba(0, 242, 254, 0.03) 100%);
  opacity: 0;
  transition: var(--transition-smooth);
}

.drop-zone-card:hover::before, .drop-zone-card.dragover::before {
  opacity: 1;
}

.file-input-hidden {
  display: none;
}

.drop-zone-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-icon-wrapper {
  background: var(--bg-tertiary);
  width: 70px;
  height: 70px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  transition: var(--transition-smooth);
}

.drop-zone-card:hover .upload-icon-wrapper {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--accent-glow);
}

.drop-zone-content h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

.drop-zone-subtext {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.paste-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

/* Sample Images Gallery */
.samples-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.samples-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.samples-grid {
  display: flex;
  gap: 1rem;
}

.sample-item {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border-color);
  transition: var(--transition-smooth);
}

.sample-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}

.sample-item:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
  box-shadow: var(--accent-glow);
}

.sample-item:hover img {
  transform: scale(1.1);
}

.sample-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  padding: 0.2rem 0;
  backdrop-filter: blur(2px);
}

/* Before / After Slider Demo */
.slider-wrapper-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

.slider-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  user-select: none;
  cursor: ew-resize;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.slider-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.img-before {
  z-index: 1;
}

.img-after-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  clip-path: inset(0 0 0 50%); /* JS controlará esto */
}

.img-after {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* Light/Dark background grid adjustment for transparent badge */
body.dark-theme .img-after {
  background-image: linear-gradient(45deg, #181824 25%, transparent 25%), linear-gradient(-45deg, #181824 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #181824 75%), linear-gradient(-45deg, transparent 75%, #181824 75%);
  background-color: #0c0c12;
}
body.light-theme .img-after {
  background-image: linear-gradient(45deg, #e5e5e5 25%, transparent 25%), linear-gradient(-45deg, #e5e5e5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e5e5 75%), linear-gradient(-45deg, transparent 75%, #e5e5e5 75%);
  background-color: #fafafa;
}

.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%; /* JS will control this */
  width: 4px;
  background: white;
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.handle-line {
  width: 100%;
  height: 100%;
  background: var(--accent-secondary);
}

.handle-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: white;
  color: black;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  border: 3px solid var(--accent-secondary);
}

.slider-badge {
  position: absolute;
  bottom: 15px;
  z-index: 4;
  padding: 0.4rem 0.8rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-transform: uppercase;
}

.badge-before {
  left: 15px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-after {
  right: 15px;
  background: var(--accent-gradient);
  box-shadow: var(--accent-glow);
}

.demo-info {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Loading Section */
.loading-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.loader-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 4rem 3rem;
  max-width: 550px;
  width: 100%;
  text-align: center;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.spinner-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.glow-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  animation: spin 1.5s linear infinite;
}

.glow-spinner::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  filter: blur(10px);
  opacity: 0.6;
  animation: spin 1.5s linear infinite;
}

.pulse-icon {
  font-size: 2.2rem;
  color: var(--text-primary);
  animation: pulse 2s infinite ease-in-out;
  z-index: 1;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

.loader-title {
  font-size: 1.6rem;
}

.loader-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  width: 0%; /* JS controlled */
  background: var(--accent-gradient);
  box-shadow: var(--accent-glow);
  border-radius: 10px;
  transition: width 0.3s ease-out;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.loading-tips {
  background: rgba(123, 44, 191, 0.06);
  border: 1px solid rgba(123, 44, 191, 0.15);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: left;
}

/* Editor Section Workspace */
.editor-section {
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.editor-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  align-items: stretch;
}

.editor-canvas-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.canvas-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.6rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

.canvas-workspace {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  height: 550px;
  overflow: auto;
  box-shadow: var(--card-shadow);
  position: relative;
}

/* Transp Checkered pattern styling */
.canvas-container {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  transition: transform 0.2s ease-out;
}

.transparent-pattern {
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

body.dark-theme .transparent-pattern {
  background-image: linear-gradient(45deg, var(--checkerboard-color-1) 25%, transparent 25%), linear-gradient(-45deg, var(--checkerboard-color-1) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--checkerboard-color-1) 75%), linear-gradient(-45deg, transparent 75%, var(--checkerboard-color-1) 75%);
  background-color: var(--checkerboard-color-2);
}

body.light-theme .transparent-pattern {
  background-image: linear-gradient(45deg, var(--checkerboard-color-1) 25%, transparent 25%), linear-gradient(-45deg, var(--checkerboard-color-1) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--checkerboard-color-1) 75%), linear-gradient(-45deg, transparent 75%, var(--checkerboard-color-1) 75%);
  background-color: var(--checkerboard-color-2);
}

#output-canvas {
  max-width: 100%;
  max-height: 500px;
  display: block;
  object-fit: contain;
}

.canvas-footer-actions {
  display: flex;
  justify-content: center;
}

/* Sidebar Column & Controls */
.editor-sidebar-column {
  display: flex;
  flex-direction: column;
}

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-title {
  font-size: 1.35rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

/* Tab buttons for edit modes */
.tabs-header {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  padding: 0.25rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.6rem 0.2rem;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-smooth);
}

.tab-btn i {
  font-size: 1rem;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border: 1px solid var(--border-color);
}

/* Tab Panels Content */
.tab-content-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.3s ease-out;
}

.tab-content-panel.active {
  display: flex;
}

.tab-content-panel h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-info-box {
  background: rgba(0, 242, 254, 0.05);
  border: 1px solid rgba(0, 242, 254, 0.15);
  color: var(--text-secondary);
  padding: 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
}

.panel-info-box i {
  color: var(--accent-secondary);
  margin-right: 0.4rem;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Colors Panel Grids */
.colors-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.color-swatch-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.color-swatch-btn:hover {
  transform: scale(1.15);
}

.color-swatch-btn.active {
  border-color: var(--accent-primary);
  transform: scale(1.1);
  box-shadow: var(--accent-glow);
}

.color-swatch-btn.active::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Ensure checkmark is black on white swatch */
.color-swatch-btn[data-color="#ffffff"].active::after {
  color: black;
  text-shadow: none;
}

.custom-color-picker-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

.custom-color-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

#custom-color-input {
  border: none;
  background: transparent;
  width: 44px;
  height: 28px;
  cursor: pointer;
  border-radius: 6px;
}

/* Background Image Grid */
.background-images-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.bg-preset-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition-smooth);
}

.bg-preset-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-preset-item:hover {
  transform: scale(1.03);
}

.bg-preset-item.active {
  border-color: var(--accent-primary);
  box-shadow: var(--accent-glow);
}

.bg-preset-item.active::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.9rem;
  color: white;
  background: var(--accent-primary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.bg-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 0.65rem;
  text-align: center;
  padding: 0.15rem 0;
  pointer-events: none;
}

/* Custom Upload BG Wrapper */
.custom-bg-upload-wrapper {
  margin-bottom: 0.5rem;
}

/* Blur Tab Slider & Presets */
.blur-slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 1.25rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

#blur-value-text {
  color: var(--accent-secondary);
}

.custom-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: var(--bg-secondary);
  outline: none;
}

.custom-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: var(--accent-glow);
  transition: transform 0.1s;
}

.custom-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.blur-presets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blur-preset-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.blur-preset-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.blur-preset-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--accent-glow);
}

/* Sidebar Action Area (Downloads) */
.sidebar-action-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: auto;
}

/* Footer styling */
.main-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  background-color: var(--bg-primary);
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.footer-security {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-security i {
  color: var(--accent-secondary);
}

/* Theme specific overrides */
body.light-theme .logo-icon {
  box-shadow: 0 4px 10px rgba(123, 44, 191, 0.2);
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .hero-container {
    gap: 2rem;
  }
  .hero-title {
    font-size: 2.8rem;
  }
}

@media (max-width: 1024px) {
  .editor-container {
    grid-template-columns: 1fr;
  }
  
  .canvas-workspace {
    height: 450px;
  }
  
  .editor-sidebar-column {
    height: auto;
  }
  
  .sidebar-card {
    height: auto;
  }
}

@media (max-width: 768px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .hero-left {
    text-align: center;
    align-items: center;
  }
  
  .hero-subtitle {
    margin: 0 auto;
  }
  
  .drop-zone-card {
    width: 100%;
    max-width: 500px;
  }
  
  .slider-wrapper-card {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
  }
  
  .main-header {
    padding: 1rem;
  }
  
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .colors-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .background-images-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Feature Pills
   ========================================================================== */

.feature-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(123, 44, 191, 0.08);
  border: 1px solid rgba(123, 44, 191, 0.2);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.feature-pill i {
  color: var(--accent-primary);
  font-size: 0.75rem;
}

.feature-pill:hover {
  background: rgba(123, 44, 191, 0.15);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ==========================================================================
   Slider Drag Improvements
   ========================================================================== */

.slider-container {
  cursor: ew-resize;
}

.slider-container.dragging {
  cursor: grabbing;
}

/* Make handle receive pointer events for better interaction */
.slider-handle {
  pointer-events: all;
  cursor: ew-resize;
}

.slider-handle:hover .handle-button {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--border-radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 360px;
  min-width: 220px;
  pointer-events: all;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  /* Start hidden and shifted down */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-hiding {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast span {
  flex: 1;
  line-height: 1.4;
}

.toast i:first-child {
  font-size: 1rem;
  flex-shrink: 0;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast type colors */
.toast-success {
  border-left: 3px solid #22c55e;
}
.toast-success i:first-child { color: #22c55e; }

.toast-error {
  border-left: 3px solid #ef4444;
}
.toast-error i:first-child { color: #ef4444; }

.toast-warning {
  border-left: 3px solid #f59e0b;
}
.toast-warning i:first-child { color: #f59e0b; }

.toast-info {
  border-left: 3px solid var(--accent-secondary);
}
.toast-info i:first-child { color: var(--accent-secondary); }

/* ==========================================================================
   Brush Toolbar
   ========================================================================== */

.brush-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  flex-wrap: wrap;
  animation: fadeIn 0.3s ease;
}

.brush-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* Mode toggle buttons */
.brush-mode-group {
  display: flex;
  gap: 0.4rem;
}

.brush-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.brush-mode-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Erase mode active = red accent */
#brush-erase-btn.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Restore mode active = green accent */
#brush-restore-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #22c55e;
}

/* Slider controls */
.brush-control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brush-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.brush-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.brush-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 6px rgba(123, 44, 191, 0.5);
  cursor: grab;
  transition: transform 0.15s;
}

.brush-range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.brush-value-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}

/* Undo/Redo history group */
.brush-history-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brush-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.brush-reset-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

/* ==========================================================================
   Custom Brush Cursor
   ========================================================================== */

.canvas-container {
  position: relative;
  cursor: none; /* hide system cursor when over canvas */
}

.brush-cursor {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  opacity: 0;
  z-index: 10;
  transition: opacity 0.15s ease;
  mix-blend-mode: difference;
}

/* Erase mode: reddish ring */
.brush-cursor[data-mode="erase"] {
  border-color: rgba(255, 100, 100, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Restore mode: greenish ring */
.brush-cursor[data-mode="restore"] {
  border-color: rgba(100, 255, 150, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 8px rgba(34, 197, 94, 0.4);
}

