/* Glassmorphism Base */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-subtle {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
}

.glass-strong {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--glass-border-light);
  box-shadow: var(--glass-shadow-lg);
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal),
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-lg);
}

.glass-card:active {
  transform: translateY(0);
}

/* Glass Input */
.glass-input {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
}

[data-theme="light"] .glass-input {
  background: rgba(255, 255, 255, 0.6);
}

.glass-input::placeholder { color: var(--text-tertiary); }
.glass-input:hover { border-color: var(--glass-border-light); }
.glass-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Glass Textarea */
.glass-textarea {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  resize: none;
  outline: none;
  width: 100%;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

[data-theme="light"] .glass-textarea {
  background: rgba(255, 255, 255, 0.6);
}

.glass-textarea::placeholder { color: var(--text-tertiary); }
.glass-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Glass Buttons */
.glass-button {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.glass-button:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
}

.glass-button:active { transform: scale(0.98); }

.glass-button-accent {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.glass-button-accent:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.glass-button-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.glass-button-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.glass-button-icon svg {
  width: 18px;
  height: 18px;
}

/* Gradient Border Effect */
.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--accent-gradient);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Glow Effects */
.glow {
  box-shadow:
    0 0 20px rgba(99, 102, 241, 0.15),
    0 0 40px rgba(99, 102, 241, 0.1),
    0 0 60px rgba(99, 102, 241, 0.05);
}

.glow-accent {
  box-shadow:
    0 0 20px rgba(99, 102, 241, 0.3),
    0 0 40px rgba(99, 102, 241, 0.2),
    0 0 60px rgba(99, 102, 241, 0.1);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: var(--glass-bg-active);
  border: 1px solid var(--glass-border);
}

.badge-accent {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-primary-light);
}

.badge-success {
  background: var(--success-bg);
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

.badge-error {
  background: var(--error-bg);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--error);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--space-md) 0;
}

/* Slider / Range Input */
.glass-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--glass-border);
  border-radius: var(--radius-full);
  outline: none;
}

.glass-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--glass-border);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  padding: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform var(--transition-fast);
}

.toggle.active {
  background: var(--accent-primary);
}

.toggle.active::after {
  transform: translateX(20px);
}
