/* ============================================================
   🧺 RafiCihuy969 — Component Styles
   ============================================================ */

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

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

.btn:hover::before {
  opacity: 1;
}

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

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
}

.btn-success {
  background: var(--gradient-success);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.25);
}

.btn-danger {
  background: transparent;
  color: var(--accent-danger);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 82, 82, 0.1);
  border-color: var(--accent-danger);
}

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

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

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}

.btn-block {
  display: flex;
  width: 100%;
}

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

/* ======================== CARDS ======================== */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-medium);
}

.card-glow {
  position: relative;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--gradient-primary);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
  filter: blur(8px);
}

.card-glow:hover::before {
  opacity: 0.3;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  position: relative;
}

/* ======================== STATS CARD ======================== */
.stats-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stats-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  opacity: 0.8;
}

.stats-card.stat-orders::after { background: var(--gradient-primary); }
.stats-card.stat-process::after { background: var(--gradient-warning); }
.stats-card.stat-done::after { background: var(--gradient-success); }
.stats-card.stat-revenue::after { background: linear-gradient(135deg, #7b61ff, #ff61dc); }

.stats-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}

.stats-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-orders .stats-icon { background: rgba(0, 212, 255, 0.12); }
.stat-process .stats-icon { background: rgba(255, 171, 0, 0.12); }
.stat-done .stats-icon { background: rgba(0, 230, 118, 0.12); }
.stat-revenue .stats-icon { background: rgba(123, 97, 255, 0.12); }

.stats-content {
  flex: 1;
  min-width: 0;
}

.stats-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
  animation: countUp 0.6s ease-out;
  font-variant-numeric: tabular-nums;
}

.stats-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ======================== INPUT FIELDS ======================== */
.form-group {
  margin-bottom: var(--space-5);
  position: relative;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-base);
  backdrop-filter: blur(8px);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), 0 0 15px rgba(0, 212, 255, 0.1);
  background: rgba(23, 29, 74, 0.6);
}

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

.form-input-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  padding-right: var(--space-10);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-base);
  backdrop-filter: blur(8px);
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0aec0' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
}

.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

textarea.form-input {
  min-height: 80px;
  resize: vertical;
}

.input-group {
  display: flex;
  gap: var(--space-3);
}

.input-group .form-input {
  flex: 1;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--accent-danger);
  margin-top: var(--space-1);
}

/* ======================== STATUS BADGE ======================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.badge-antrian {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(0, 212, 255, 0.25);
}

.badge-proses {
  background: rgba(255, 171, 0, 0.12);
  color: var(--accent-warning);
  border: 1px solid rgba(255, 171, 0, 0.25);
  animation: pulseGlow 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 171, 0, 0.15);
}

.badge-selesai {
  background: rgba(0, 230, 118, 0.12);
  color: var(--accent-success);
  border: 1px solid rgba(0, 230, 118, 0.25);
}

.badge-diambil {
  background: rgba(123, 97, 255, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(123, 97, 255, 0.25);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-antrian::before { background: var(--accent-primary); }
.badge-proses::before { background: var(--accent-warning); animation: pulse 1.5s ease-in-out infinite; }
.badge-selesai::before { background: var(--accent-success); }
.badge-diambil::before { background: var(--accent-secondary); }

/* ======================== STATUS TIMELINE ======================== */
.status-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) 0;
  position: relative;
}

.status-timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 24px;
  right: 24px;
  height: 3px;
  background: var(--bg-tertiary);
  transform: translateY(-8px);
  border-radius: var(--radius-full);
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  z-index: 1;
  flex: 1;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  border: 3px solid var(--bg-primary);
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  position: relative;
}

.timeline-step.completed .timeline-dot {
  background: var(--accent-success);
  color: white;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.4);
}

.timeline-step.active .timeline-dot {
  background: var(--accent-warning);
  color: white;
  box-shadow: 0 0 15px rgba(255, 171, 0, 0.5);
  animation: pulseGlow 2s ease-in-out infinite;
}

.timeline-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: center;
}

.timeline-step.completed .timeline-label {
  color: var(--accent-success);
}

.timeline-step.active .timeline-label {
  color: var(--accent-warning);
  font-weight: 600;
}

/* Progress line between steps */
.timeline-step.completed + .timeline-step::after {
  content: '';
  position: absolute;
  top: 16px;
  right: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 3px;
  background: var(--gradient-success);
  transform: translateY(-8px);
  z-index: -1;
}

/* ======================== DATA TABLE ======================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  padding: var(--space-4) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 22, 56, 0.3);
  white-space: nowrap;
}

.data-table thead th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
}

.data-table thead th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
}

.data-table tbody td {
  padding: var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(0, 212, 255, 0.03);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.table-actions {
  display: flex;
  gap: var(--space-2);
}

/* ======================== MODAL ======================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 200ms ease-out;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 300ms ease-out;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--text-xl);
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ======================== TOAST ======================== */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: toastSlideIn 400ms ease-out;
  pointer-events: all;
  backdrop-filter: blur(20px);
}

.toast.removing {
  animation: toastSlideOut 300ms ease-in forwards;
}

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-1);
  font-size: var(--text-base);
  transition: color var(--transition-fast);
}

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

.toast.toast-success { border-left: 3px solid var(--accent-success); }
.toast.toast-error { border-left: 3px solid var(--accent-danger); }
.toast.toast-warning { border-left: 3px solid var(--accent-warning); }
.toast.toast-info { border-left: 3px solid var(--accent-info); }

/* ======================== SIDEBAR NAV ======================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-brand span {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
}

.nav-section {
  margin-bottom: var(--space-6);
}

.nav-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-bottom: var(--space-1);
  position: relative;
}

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

.nav-item.active {
  background: rgba(0, 212, 255, 0.08);
  color: var(--accent-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.nav-item-icon {
  font-size: var(--text-lg);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ======================== SEARCH BAR ======================== */
.search-bar {
  position: relative;
}

.search-bar .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  pointer-events: none;
}

.search-bar .form-input {
  padding-left: var(--space-10);
}

/* ======================== TAB BAR ======================== */
.tab-bar {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
}

.tab-item {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
}

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

.tab-item.active {
  background: var(--bg-glass);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ======================== CONFIRM DIALOG ======================== */
.confirm-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  text-align: center;
  padding: var(--space-4) 0;
}

.confirm-text strong {
  color: var(--text-primary);
}

/* ======================== MOBILE TOGGLE ======================== */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  font-size: var(--text-xl);
  z-index: calc(var(--z-sidebar) + 1);
  box-shadow: var(--shadow-glow-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-sidebar) - 1);
}

@media (max-width: 768px) {
  .mobile-sidebar-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-overlay.open {
    display: block;
  }
}
