/* ============================================
   APP — Shared Components
   ============================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--ff-heading); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  padding: var(--sp-3) var(--sp-6); border-radius: var(--radius-lg);
  transition: all var(--dur-normal) var(--ease-out); white-space: nowrap; cursor: pointer;
}
.btn--primary { background: var(--clr-accent); color: #1a1a2e; }
.btn--primary:hover { background: var(--clr-accent-light); box-shadow: 0 4px 16px rgba(232,168,56,0.3); transform: translateY(-1px); }
.btn--secondary { background: transparent; color: var(--clr-text); border: 1.5px solid var(--clr-border); }
.btn--secondary:hover { border-color: var(--clr-text); background: var(--clr-surface-hover); }
.btn--danger { background: var(--clr-error); color: #fff; }
.btn--danger:hover { opacity: 0.9; }
.btn--ghost { background: transparent; color: var(--clr-text-light); }
.btn--ghost:hover { background: var(--clr-surface-hover); color: var(--clr-text); }
.btn--sm { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-4); }
.btn--lg { font-size: var(--fs-base); padding: var(--sp-4) var(--sp-8); }
.btn--block { width: 100%; }
.btn--icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn svg { width: 16px; height: 16px; }

/* ── Input Fields ── */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
  display: block; font-family: var(--ff-heading); font-size: var(--fs-sm);
  font-weight: var(--fw-medium); color: var(--clr-text); margin-bottom: var(--sp-2);
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: var(--sp-3) var(--sp-4);
  background: var(--clr-surface); border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-lg); font-size: var(--fs-sm); color: var(--clr-text);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--clr-accent); }
.form-input::placeholder { color: var(--clr-text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239a9aad' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}
.form-error { font-size: var(--fs-xs); color: var(--clr-error); margin-top: var(--sp-1); }

/* ── Cards ── */
.card {
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl); padding: var(--sp-6);
  transition: all var(--dur-normal) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }
.card--flat:hover { box-shadow: none; }
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.card__title { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

/* ── Avatar ── */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-sm); color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, var(--clr-sage), var(--clr-sage-light));
}
.avatar--sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar--xl { width: 80px; height: 80px; font-size: var(--fs-xl); }
.avatar--amber { background: linear-gradient(135deg, var(--clr-accent), var(--clr-accent-light)); }
.avatar--coral { background: linear-gradient(135deg, var(--clr-coral), var(--clr-coral-light)); }
.avatar--sage { background: linear-gradient(135deg, var(--clr-sage), var(--clr-sage-light)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ── Badge / Tag ── */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--clr-cream-dark); color: var(--clr-text-light);
}
.badge--accent { background: rgba(232,168,56,0.15); color: var(--clr-accent-dark); }
.badge--sage { background: rgba(107,144,128,0.15); color: var(--clr-sage-dark); }
.badge--coral { background: rgba(224,122,95,0.15); color: var(--clr-coral-dark); }
.badge--success { background: rgba(76,175,125,0.15); color: #2d8a5a; }
.badge--error { background: rgba(224,82,82,0.15); color: var(--clr-error); }

/* ── Online Indicator ── */
.online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--clr-success); border: 2px solid var(--clr-surface);
  position: absolute; bottom: 0; right: 0;
}

/* ── Tabs ── */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--clr-border); margin-bottom: var(--sp-6); }
.tab {
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--clr-text-muted); border-bottom: 2px solid transparent;
  transition: all var(--dur-fast) var(--ease-out); cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--clr-text); }
.tab.is-active { color: var(--clr-accent-dark); border-bottom-color: var(--clr-accent); }

/* ── Search Bar ── */
.search-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--clr-surface);
  border: 1.5px solid var(--clr-border); border-radius: var(--radius-lg);
  transition: border-color var(--dur-fast);
}
.search-bar:focus-within { border-color: var(--clr-accent); }
.search-bar svg { width: 18px; height: 18px; color: var(--clr-text-muted); flex-shrink: 0; }
.search-bar input { flex: 1; font-size: var(--fs-sm); color: var(--clr-text); }
.search-bar input::placeholder { color: var(--clr-text-muted); }

/* ── Toast ── */
.toast-container {
  position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 9999;
  display: flex; flex-direction: column; gap: var(--sp-3); pointer-events: none;
}
.toast {
  padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-lg);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: #fff;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toastIn var(--dur-normal) var(--ease-out);
  display: flex; align-items: center; gap: var(--sp-3); max-width: 380px;
}
.toast--success { background: var(--clr-success); }
.toast--error { background: var(--clr-error); }
.toast--info { background: var(--clr-primary-light); }
.toast--warning { background: var(--clr-warning); color: #1a1a2e; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,10,18,0.5);
  backdrop-filter: blur(4px); z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--clr-surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn var(--dur-normal) var(--ease-out);
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--clr-border);
}
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.modal__close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); transition: background var(--dur-fast); }
.modal__close:hover { background: var(--clr-surface-hover); }
.modal__close svg { width: 18px; height: 18px; }
.modal__body { padding: var(--sp-6); }
.modal__footer { display: flex; gap: var(--sp-3); justify-content: flex-end; padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--clr-border); }
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Progress Bar ── */
.progress-bar { height: 8px; background: var(--clr-cream-dark); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar__fill { height: 100%; border-radius: var(--radius-full); transition: width var(--dur-slow) var(--ease-out);
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-accent-light)); }

/* ── Grid utils ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
@media (max-width: 991px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Flex utils ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
