/* chromapilot-components.css - Comprehensive Component Library */
/* A beautiful, modern component system for ChromaPilot */

/* === COLOR SYSTEM === */
:root {
  /* Primary Gradients */
  --cp-gradient-primary: linear-gradient(135deg, #5B8CFF 0%, #22D3EE 100%);
  --cp-gradient-secondary: linear-gradient(135deg, #A78BFA 0%, #7C5CFF 100%);
  --cp-gradient-accent: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  --cp-gradient-success: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
  --cp-gradient-warning: linear-gradient(135deg, #FFA07A 0%, #FF8C42 100%);
  --cp-gradient-danger: linear-gradient(135deg, #F093FB 0%, #F5576C 100%);

  /* Glow Effects */
  --cp-glow-primary: 0 0 30px rgba(91, 140, 255, 0.4);
  --cp-glow-secondary: 0 0 30px rgba(167, 139, 250, 0.4);
  --cp-glow-accent: 0 0 30px rgba(255, 107, 107, 0.4);

  /* Shadows */
  --cp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --cp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --cp-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --cp-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);

  /* Spacing */
  --cp-space-xs: 4px;
  --cp-space-sm: 8px;
  --cp-space-md: 16px;
  --cp-space-lg: 24px;
  --cp-space-xl: 32px;
  --cp-space-2xl: 48px;

  /* Border Radius */
  --cp-radius-sm: 8px;
  --cp-radius-md: 12px;
  --cp-radius-lg: 16px;
  --cp-radius-xl: 20px;
  --cp-radius-full: 9999px;
}

/* === BUTTONS === */
.cp-btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #fff);
  padding: 12px 24px;
  border-radius: var(--cp-radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--cp-shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.cp-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;
}

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

.cp-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--cp-shadow-md);
  border-color: rgba(255, 255, 255, 0.15);
}

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

.cp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button Variants */
.cp-btn--primary {
  background: var(--cp-gradient-primary);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(91, 140, 255, 0.4);
}

.cp-btn--primary:hover {
  box-shadow: 0 8px 32px rgba(91, 140, 255, 0.5);
  transform: translateY(-2px) scale(1.02);
}

.cp-btn--secondary {
  background: var(--cp-gradient-secondary);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.4);
}

.cp-btn--accent {
  background: var(--cp-gradient-accent);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

.cp-btn--success {
  background: var(--cp-gradient-success);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(78, 205, 196, 0.4);
}

.cp-btn--warning {
  background: var(--cp-gradient-warning);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(255, 160, 122, 0.4);
}

.cp-btn--danger {
  background: var(--cp-gradient-danger);
  color: white;
  border: 0;
  box-shadow: 0 4px 20px rgba(240, 147, 251, 0.4);
}

.cp-btn--outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.cp-btn--ghost {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.cp-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Button Sizes */
.cp-btn--xs {
  padding: 6px 12px;
  font-size: 12px;
}

.cp-btn--sm {
  padding: 8px 16px;
  font-size: 13px;
}

.cp-btn--lg {
  padding: 16px 32px;
  font-size: 17px;
}

.cp-btn--xl {
  padding: 20px 40px;
  font-size: 19px;
}

.cp-btn--icon {
  padding: 12px;
  aspect-ratio: 1;
  justify-content: center;
}

/* === CARDS === */
.cp-card {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--cp-radius-xl);
  padding: var(--cp-space-xl);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.cp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.cp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cp-shadow-xl);
  border-color: rgba(91, 140, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.cp-card--gradient {
  background: var(--cp-gradient-primary);
  color: white;
  border: 0;
}

.cp-card--glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cp-card--elevated {
  box-shadow: var(--cp-shadow-lg);
}

.cp-card__header {
  margin-bottom: var(--cp-space-lg);
  padding-bottom: var(--cp-space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cp-card__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: var(--cp-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cp-card__subtitle {
  font-size: 14px;
  opacity: 0.7;
  margin: 0;
}

.cp-card__body {
  margin-bottom: var(--cp-space-lg);
}

.cp-card__footer {
  padding-top: var(--cp-space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: var(--cp-space-sm);
  justify-content: flex-end;
}

/* === INPUTS === */
.cp-input {
  appearance: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--cp-radius-md);
  padding: 12px 16px;
  color: var(--text, #fff);
  font-size: 15px;
  font-family: inherit;
  width: 100%;
  transition: all 0.2s ease;
}

.cp-input:focus {
  outline: none;
  border-color: #5B8CFF;
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.1), var(--cp-glow-primary);
  background: rgba(255, 255, 255, 0.05);
}

.cp-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.cp-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cp-input--error {
  border-color: #F5576C;
  box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.1);
}

.cp-input--success {
  border-color: #4ECDC4;
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

/* Input Group */
.cp-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--cp-space-sm);
}

.cp-input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #fff);
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cp-input-hint {
  font-size: 12px;
  opacity: 0.6;
}

.cp-input-error {
  font-size: 12px;
  color: #F5576C;
}

/* === BADGES === */
.cp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--cp-radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.cp-badge--primary {
  background: var(--cp-gradient-primary);
  color: white;
  border: 0;
  box-shadow: var(--cp-glow-primary);
}

.cp-badge--secondary {
  background: var(--cp-gradient-secondary);
  color: white;
  border: 0;
}

.cp-badge--success {
  background: var(--cp-gradient-success);
  color: white;
  border: 0;
}

.cp-badge--warning {
  background: var(--cp-gradient-warning);
  color: white;
  border: 0;
}

.cp-badge--danger {
  background: var(--cp-gradient-danger);
  color: white;
  border: 0;
}

.cp-badge--outline {
  background: transparent;
  border: 1px solid currentColor;
}

.cp-badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* === ALERTS === */
.cp-alert {
  padding: var(--cp-space-md) var(--cp-space-lg);
  border-radius: var(--cp-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  display: flex;
  gap: var(--cp-space-md);
  align-items: flex-start;
}

.cp-alert__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.cp-alert__content {
  flex: 1;
}

.cp-alert__title {
  font-weight: 600;
  margin: 0 0 4px 0;
}

.cp-alert__message {
  font-size: 14px;
  opacity: 0.8;
  margin: 0;
}

.cp-alert--primary {
  border-color: #5B8CFF;
  background: rgba(91, 140, 255, 0.1);
  color: #5B8CFF;
}

.cp-alert--success {
  border-color: #4ECDC4;
  background: rgba(78, 205, 196, 0.1);
  color: #4ECDC4;
}

.cp-alert--warning {
  border-color: #FFA07A;
  background: rgba(255, 160, 122, 0.1);
  color: #FFA07A;
}

.cp-alert--danger {
  border-color: #F5576C;
  background: rgba(245, 87, 108, 0.1);
  color: #F5576C;
}

/* === TOOLTIPS === */
.cp-tooltip {
  position: relative;
  display: inline-block;
}

.cp-tooltip__content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  border-radius: var(--cp-radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}

.cp-tooltip__content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

.cp-tooltip:hover .cp-tooltip__content {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

/* === MODAL === */
.cp-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--cp-space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cp-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.cp-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.cp-modal__content {
  position: relative;
  background: rgba(10, 13, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--cp-radius-xl);
  padding: var(--cp-space-2xl);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--cp-shadow-xl);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.cp-modal--open .cp-modal__content {
  transform: scale(1);
}

.cp-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--cp-space-lg);
}

.cp-modal__title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  background: var(--cp-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cp-modal__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--cp-radius-sm);
  transition: all 0.2s ease;
}

.cp-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* === TABS === */
.cp-tabs {
  display: flex;
  flex-direction: column;
}

.cp-tabs__list {
  display: flex;
  gap: var(--cp-space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0;
  margin: 0;
  list-style: none;
}

.cp-tabs__tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.cp-tabs__tab:hover {
  opacity: 0.9;
}

.cp-tabs__tab--active {
  opacity: 1;
  color: #5B8CFF;
}

.cp-tabs__tab--active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cp-gradient-primary);
}

.cp-tabs__panel {
  padding: var(--cp-space-lg) 0;
  display: none;
}

.cp-tabs__panel--active {
  display: block;
}

/* === PROGRESS BAR === */
.cp-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--cp-radius-full);
  overflow: hidden;
  position: relative;
}

.cp-progress__bar {
  height: 100%;
  background: var(--cp-gradient-primary);
  border-radius: var(--cp-radius-full);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.cp-progress__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.cp-progress--sm {
  height: 4px;
}

.cp-progress--lg {
  height: 12px;
}

/* === TOGGLE SWITCH === */
.cp-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.cp-toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cp-toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--cp-radius-full);
  transition: all 0.3s ease;
}

.cp-toggle__slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cp-toggle__input:checked + .cp-toggle__slider {
  background: var(--cp-gradient-primary);
}

.cp-toggle__input:checked + .cp-toggle__slider::before {
  transform: translateX(24px);
}

.cp-toggle__input:disabled + .cp-toggle__slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === AVATAR === */
.cp-avatar {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--cp-gradient-primary);
}

.cp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-avatar--sm {
  width: 32px;
  height: 32px;
}

.cp-avatar--lg {
  width: 64px;
  height: 64px;
}

.cp-avatar--xl {
  width: 96px;
  height: 96px;
}

.cp-avatar__status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(10, 13, 18, 1);
  background: #4ECDC4;
}

.cp-avatar__status--offline {
  background: #666;
}

.cp-avatar__status--busy {
  background: #F5576C;
}

/* === DIVIDER === */
.cp-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  margin: var(--cp-space-lg) 0;
  border: 0;
}

.cp-divider--vertical {
  width: 1px;
  height: auto;
  margin: 0 var(--cp-space-lg);
  align-self: stretch;
}

/* === SKELETON === */
.cp-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--cp-radius-md);
}

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

.cp-skeleton--text {
  height: 1em;
  margin-bottom: 0.5em;
}

.cp-skeleton--title {
  height: 2em;
  margin-bottom: 1em;
}

.cp-skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.cp-skeleton--button {
  height: 40px;
  width: 100px;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.cp-animate-fadeIn {
  animation: fadeIn 0.3s ease;
}

.cp-animate-slideUp {
  animation: slideUp 0.3s ease;
}

.cp-animate-slideDown {
  animation: slideDown 0.3s ease;
}

.cp-animate-scaleIn {
  animation: scaleIn 0.3s ease;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  :root {
    --cp-space-lg: 16px;
    --cp-space-xl: 24px;
    --cp-space-2xl: 32px;
  }

  .cp-btn--lg {
    padding: 14px 28px;
    font-size: 16px;
  }

  .cp-btn--xl {
    padding: 16px 32px;
    font-size: 17px;
  }

  .cp-modal__content {
    padding: var(--cp-space-lg);
  }

  .cp-card {
    padding: var(--cp-space-lg);
  }
}
