/* ===== SHARED COMPONENTS ===== */
/* Reusable across HUB and all modules. */

/* ----- Buttons ----- */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-gradient-btn);
  color: var(--bg-elevated);
}
.btn-primary:hover {
  box-shadow: var(--shadow-btn-primary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-4);
  border: 1px solid var(--surface-5);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  background: var(--surface-5);
}

.btn-danger {
  background: rgba(239,68,68,.15);
  color: #f87171;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239,68,68,.3);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-warning {
  background: rgba(245,158,11,.15);
  color: #f59e0b;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245,158,11,.3);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-warning:hover { background: rgba(245,158,11,.25); }

.btn-success {
  background: rgba(34,197,94,.12);
  color: #4ade80;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34,197,94,.3);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-success:hover { background: rgba(34,197,94,.22); }

/* ----- Search input ----- */
.search-input {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-body);
  outline: none;
  width: 220px;
  font-family: inherit;
  transition: border-color var(--transition-base);
}
.search-input:focus {
  border-color: rgba(245, 158, 11, 0.4);
}
.search-input::placeholder {
  color: var(--text-faint);
}

/* ----- Filter chips ----- */
.filter-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}
.filter-chip:hover,
.filter-chip.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent);
}

/* ----- Stat cards ----- */
.stat-card {
  padding: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.stat-card .stat-change {
  font-size: 0.7rem;
  margin-top: 4px;
}
.stat-card .stat-change.up { color: var(--status-success); }
.stat-card .stat-change.down { color: var(--status-danger); }

/* ----- Data table ----- */
.data-table-wrapper {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.02);
}
.data-table tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}
.data-table tbody tr:hover {
  background: var(--surface-1);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

.amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.order-num {
  color: var(--accent);
  font-weight: 500;
}

/* ----- Status badges ----- */
.status-badge {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
.status-confirmed { background: rgba(16, 185, 129, 0.15); color: var(--status-success); }
.status-pending   { background: rgba(245, 158, 11, 0.15); color: var(--status-warning); }
.status-shipped   { background: rgba(59, 130, 246, 0.15); color: var(--status-info); }
.status-draft     { background: rgba(113, 113, 122, 0.2); color: var(--status-neutral); }

/* ----- Pagination ----- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .search-input { width: 100%; }
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn .15s ease;
}
#confirm-modal { z-index: 1100; }
.modal-backdrop[hidden] { display: none; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(560px, 92vw);
  max-height: 80vh;
  background: #1e1e24;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-default);
}
.confirm-modal-box {
  width: min(420px, 92vw);
  max-height: unset;
}
.confirm-modal-box #confirm-message {
  color: var(--text-primary);
  font-size: .95rem;
  margin: 0;
}

/* Confirm modal — matches clients module */
.confirm-modal {
  width: min(400px, 90vw);
  max-height: none;
}
.confirm-body {
  padding: 28px 24px 20px;
}
.confirm-body p {
  font-size: .95rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-default);
}

/* ===== FORM FIELDS (shared) ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group:last-child { margin-bottom: 0; }
.form-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.required-star { color: var(--accent); }
.form-input {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .88rem;
  padding: 9px 12px;
  transition: border-color .15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-faint); }
textarea.form-input { resize: vertical; }
select.form-input {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ----- File Picker ----- */
.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.btn-file {
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
}
.btn-file:hover {
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}
.file-picker-name {
  color: var(--text-muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.file-picker-name.has-file {
  color: var(--text-primary);
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  align-items: flex-end;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: .875rem;
  font-weight: 500;
  max-width: 360px;
  pointer-events: all;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toastIn .22s ease forwards;
  position: relative;
  overflow: hidden;
}
.toast--out { animation: toastOut .2s ease forwards; }
.toast--success { background: rgba(22,163,74,.15); border: 1px solid rgba(74,222,128,.3); color: #4ade80; }
.toast--error   { background: rgba(220,38,38,.15);  border: 1px solid rgba(248,113,113,.3); color: #f87171; }
.toast-icon { flex-shrink: 0; display: flex; }
.toast-msg  { flex: 1; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: .55; font-size: .75rem;
  padding: 0 0 0 6px; flex-shrink: 0; transition: opacity .12s;
  font-family: inherit;
}
.toast-close:hover { opacity: 1; }
.toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px; width: 100%;
  background: currentColor; opacity: .35;
  animation: toastProgress var(--toast-duration, 5000ms) linear forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px) scale(.97); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0)    scale(1); }
  to   { opacity: 0; transform: translateX(16px) scale(.97); }
}
@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}
