/* ===================================
   Arc Design System - Component Library
   Reusable component classes
   =================================== */

/* ===================================
   NAVIGATION
   =================================== */
.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

.nav-item.active {
  background: rgba(102, 126, 234, 0.15);
  color: var(--brand-purple);
}

.nav-item .icon {
  font-size: 20px;
}

/* ===================================
   BADGES
   =================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-primary {
  background: rgba(102, 126, 234, 0.2);
  color: var(--brand-purple);
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-yellow);
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

/* ===================================
   PROGRESS BARS
   =================================== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Circular Progress */
.progress-ring {
  transform: rotate(-90deg);
}

.progress-circle {
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   TOASTS / NOTIFICATIONS
   =================================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
}

.toast.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.toast.info {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.toast.warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

/* ===================================
   MODALS / DIALOGS
   =================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 20px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

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

.modal-body {
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ===================================
   TABS
   =================================== */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-primary);
}

.tab {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

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

.tab.active {
  background: var(--bg-tertiary);
  color: var(--brand-purple);
  box-shadow: var(--shadow-sm);
}

/* ===================================
   DROPDOWNS
   =================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.dropdown-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 8px 0;
}

/* ===================================
   AVATARS
   =================================== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: white;
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
}

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

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 32px;
}

/* ===================================
   STAT CARDS
   =================================== */
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--border-secondary);
  transform: translateY(-2px);
}

.stat-label {
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-change {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.positive {
  color: var(--accent-green);
}

.stat-change.negative {
  color: var(--accent-red);
}

/* ===================================
   FORM ELEMENTS
   =================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-helper {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.form-error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent-red);
}

/* Checkbox */
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-secondary);
  border-radius: 6px;
  background: var(--bg-tertiary);
  cursor: pointer;
  appearance: none;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox input[type="checkbox"]:checked {
  background: var(--brand-gradient);
  border-color: var(--brand-purple);
}

.checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* Toggle Switch */
.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: 14px;
  border: 2px solid var(--border-secondary);
  transition: all 0.3s ease;
}

.toggle input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle input[type="checkbox"]:checked ~ .toggle-switch {
  background: rgba(102, 126, 234, 0.2);
  border-color: var(--brand-purple);
}

.toggle input[type="checkbox"]:checked ~ .toggle-switch .toggle-slider {
  left: 22px;
  background: var(--brand-purple);
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 16px;
}

.gap-4 {
  gap: 32px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-4 {
  margin-top: 32px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-4 {
  margin-bottom: 32px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}
