/* ============================================
   quangit.online — Component Styles
   ============================================ */

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

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--glass-shadow), var(--shadow-glow);
  transform: translateY(-2px);
}

.card--flat {
  box-shadow: none;
  border-color: var(--border-subtle);
}

.card--flat:hover {
  box-shadow: var(--shadow-md);
  transform: none;
}

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

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  height: 40px;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.1);
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: 0 2px 12px rgba(108, 99, 255, 0.3);
}

.btn--primary:hover {
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45);
}

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

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn--danger {
  background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
  color: white;
}

.btn--success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: white;
}

.btn--sm { height: 32px; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.btn--lg { height: 48px; padding: var(--space-3) var(--space-8); font-size: var(--text-md); }
.btn--icon { width: 40px; padding: 0; }
.btn--icon.btn--sm { width: 32px; height: 32px; }

.btn--loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn__spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Inputs --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
}

.input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
  background: var(--bg-hover);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input--error {
  border-color: var(--danger-500);
}

.input--error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.textarea {
  min-height: 100px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.input-error-text {
  font-size: var(--text-xs);
  color: var(--danger-500);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  line-height: 1.4;
}

.badge--primary { background: rgba(108,99,255,0.15); color: var(--primary-300); }
.badge--success { background: rgba(34,197,94,0.15); color: var(--success-500); }
.badge--warning { background: rgba(245,158,11,0.15); color: var(--warning-500); }
.badge--danger  { background: rgba(239,68,68,0.15); color: var(--danger-500); }
.badge--info    { background: rgba(59,130,246,0.15); color: var(--info-500); }

/* --- Avatar --- */
.avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border-default);
  flex-shrink: 0;
}

.avatar--sm { width: 32px; height: 32px; }
.avatar--lg { width: 56px; height: 56px; }
.avatar--xl { width: 80px; height: 80px; }
.avatar--2xl { width: 120px; height: 120px; border-width: 3px; }

.avatar--gradient {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500)) border-box;
  border: 3px solid transparent;
  background-clip: padding-box;
  position: relative;
}

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

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* --- Stat Card --- */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: 1.2;
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-card__change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.stat-card__change--up { color: var(--success-500); }
.stat-card__change--down { color: var(--danger-500); }

/* --- Dropdown --- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition-fast);
}

.dropdown--open .dropdown__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

.tab--active {
  color: var(--primary-400);
  border-bottom-color: var(--primary-500);
}

/* --- Switch/Toggle --- */
.switch {
  position: relative;
  width: 44px; height: 24px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: 1px solid var(--border-default);
}

.switch--active {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.switch__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.switch--active .switch__thumb {
  transform: translateX(20px);
}

/* --- Progress Bar --- */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary-500), var(--secondary-500));
  transition: width var(--transition-slow);
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: var(--z-tooltip);
}

.tooltip:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
