/* ═══════════════════════════════════════════════════════════════
   components.css — Manaaki CRM Reusable Components
   /static/css/components.css
═══════════════════════════════════════════════════════════════ */

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 300; font-family: var(--font);
  cursor: pointer; border: 1.5px solid transparent;
  transition: all var(--transition); text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5; fill: none; }

.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(53,98,103,.2);
}
.btn-primary:hover { background: #2a4f53; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(53,98,103,.25); }

.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* Liquid button */
.btn-liquid {
  position: relative; overflow: hidden;
  border-radius: 999px; padding: 10px 20px;
  background: var(--surface); border: 1.5px solid var(--accent);
  font-weight: 300; transition: all .3s ease; cursor: pointer;
}
.btn-liquid::before {
  content: ""; position: absolute; inset: 0;
  background: var(--primary); transform: translateX(-100%);
  transition: transform .4s ease; border-radius: inherit; z-index: 0;
}
.btn-liquid:hover::before { transform: translateX(0); }
.btn-liquid span { position: relative; z-index: 1; transition: color .3s; }
.btn-liquid:hover span { color: white; }

/* ═══ CARDS ═══ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card-glass {
  background: rgba(255,255,255,.7); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.3);
}
[data-theme="dark"] .card-glass {
  background: rgba(252,231,202,.7); border-color: rgba(225,197,143,.4);
}
.card-title {
  font-size: 11px; font-weight: 400; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3);
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle);
}

/* ═══ GRADIENT BORDER ═══ */
.gradient-border {
  position: relative; border-radius: var(--radius); overflow: hidden;
}
.gradient-border::before {
  content: ""; position: absolute; inset: 0;
  padding: 1.5px; border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* ═══ HOVER LIFT ═══ */
.hover-lift { transition: transform var(--transition), box-shadow var(--transition); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ═══ BADGES ═══ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 400;
}
.badge-primary { background: rgba(53,98,103,.1); color: var(--primary); }
.badge-success { background: var(--green-soft); color: var(--green); }
.badge-warning { background: var(--amber-soft); color: var(--amber); }
.badge-danger  { background: var(--red-soft); color: var(--red); }
.badge-info    { background: rgba(37,99,235,.1); color: var(--blue); }

/* ═══ TABS ═══ */
.tabs {
  display: flex; gap: 4px; background: var(--surface-2);
  padding: 4px; border-radius: 999px; border: 1px solid var(--border-subtle);
}
.tab {
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 300; color: var(--text-2);
  transition: all .25s ease;
}
.tab:hover { background: var(--accent); color: var(--primary); }
.tab.active {
  background: var(--primary); color: #fff;
  font-family: var(--font-italic); font-style: italic;
  box-shadow: 0 2px 8px rgba(53,98,103,.15);
}

/* ═══ SKELETON LOADERS ═══ */
.skeleton {
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--surface-2) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line:last-child { width: 60%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--radius); margin-bottom: 12px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ═══ COMMAND PALETTE ═══ */
.cmd-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,58,61,.4); backdrop-filter: blur(6px);
  z-index: 900; align-items: flex-start; justify-content: center;
  padding: 10vh 20px;
}
.cmd-overlay.open { display: flex; }
.cmd-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 560px;
  box-shadow: 0 24px 64px rgba(0,0,0,.15);
  animation: cmdUp .15s ease; overflow: hidden;
}
@keyframes cmdUp { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

.cmd-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}
.cmd-input-wrap svg { width: 18px; height: 18px; stroke: var(--text-3); stroke-width: 1.5; fill: none; flex-shrink: 0; }
.cmd-input {
  flex: 1; border: none; background: transparent;
  font-size: 15px; font-family: var(--font); font-weight: 300;
  color: var(--text); outline: none;
}
.cmd-input::placeholder { color: var(--text-3); }

.cmd-results { max-height: 340px; overflow-y: auto; padding: 6px 0; }
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer; transition: background .1s;
}
.cmd-item:hover, .cmd-item.kb-active { background: var(--accent); }
.cmd-item svg { width: 16px; height: 16px; stroke: var(--text-3); stroke-width: 1.5; fill: none; }
.cmd-item-label { font-size: 13.5px; color: var(--text); flex: 1; }
.cmd-item-hint  { font-size: 11px; color: var(--text-3); }

.cmd-footer {
  padding: 8px 18px; border-top: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 12px;
}
.cmd-footer kbd {
  padding: 1px 5px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--surface-2); font-size: 10px;
}

/* ═══ TOAST ═══ */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 999999999; pointer-events: none; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 300;

  display: flex;
  align-items: center;
  gap: 10px;

  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);

  pointer-events: auto;

  /* FIX: removed opacity:0 and animation — was conflicting with JS inline styles.
     showToast() now handles visibility via requestAnimationFrame. */
}
.toast-error { background: var(--red); }
.toast-success { background: var(--green); }
@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes toastUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ═══ MODAL BASE ═══ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,58,61,.45); backdrop-filter: blur(4px);
  z-index: 500; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 16px;
  width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
  animation: modalUp .2s ease; max-height: 90vh; overflow-y: auto;
}
@keyframes modalUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

/* ═══ TABLE BASE ═══ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { position: sticky; top: 0; z-index: 5; }
.data-table thead tr { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.data-table th {
  padding: 10px 16px; text-align: left;
  font-size: 10px; font-weight: 400; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3);
}
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: rgba(194,242,242,.15); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ═══ AVATAR ═══ */
.avatar {
  border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 400; color: #fff; overflow: hidden; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-gradient { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ═══ STATUS DOTS ═══ */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-dot-active  { background: var(--green); }
.status-dot-pending { background: var(--amber); }
.status-dot-inactive{ background: var(--text-3); }
.status-dot-danger  { background: var(--red); }

/* ═══ FORM FIELDS ═══ */
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 10px; font-weight: 400; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
}
.form-input, .form-select, .form-textarea {
  padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: var(--font); font-size: 13px;
  font-weight: 300; color: var(--text); background: var(--surface);
  outline: none; transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 70px; }

/* ═══ UTILITY ═══ */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ═══ LIQUID BACK BUTTON ═══ */
.back-btn {
  position: relative; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--accent); overflow: hidden;
  display: inline-flex; align-items: center; padding: 10px 16px;
  gap: 10px; cursor: pointer; text-decoration: none; color: var(--text);
  font-size: 13px; font-weight: 300; font-family: var(--font);
  transition: color .3s;
}
.back-btn .slider {
  position: absolute; left: 4px; top: 4px;
  height: calc(100% - 8px); width: 36px;
  background: var(--accent); border-radius: 12px;
  transition: width .4s ease; display: flex;
  align-items: center; justify-content: center;
}
.back-btn .slider svg { width: 14px; height: 14px; stroke: var(--primary); stroke-width: 1.5; fill: none; }
.back-btn:hover .slider { width: calc(100% - 8px); }
.back-btn span { position: relative; z-index: 1; margin-left: 28px; }

/* ═══ LIQUID FORWARD BUTTON ═══ */
.forward-btn {
  position: relative; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--accent); overflow: hidden;
  display: inline-flex; align-items: center; padding: 10px 16px;
  gap: 10px; cursor: pointer; text-decoration: none; color: var(--text);
  font-size: 13px; font-weight: 300; font-family: var(--font);
  transition: color .3s;
}
.forward-btn .slider {
  position: absolute; right: 4px; top: 4px;
  height: calc(100% - 8px); width: 36px;
  background: var(--accent); border-radius: 12px;
  transition: width .4s ease; display: flex;
  align-items: center; justify-content: center;
}
.forward-btn .slider svg { width: 14px; height: 14px; stroke: var(--primary); stroke-width: 1.5; fill: none; }
.forward-btn:hover .slider { width: calc(100% - 8px); }
.forward-btn span { position: relative; z-index: 1; margin-right: 28px; }

/* ═══ LIQUID TABS (enhanced) ═══ */
.liquid-tabs {
  display: inline-flex; gap: 0; background: var(--surface);
  padding: 4px; border-radius: 999px;
  border: 1.5px solid var(--accent);
  position: relative;
}
.liquid-tab {
  padding: 9px 22px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 300; color: var(--text-2);
  background: transparent; border: none; font-family: var(--font);
  position: relative; z-index: 1;
  transition: color .3s ease;
}
.liquid-tab:hover { color: var(--primary); }
.liquid-tab.active {
  background: var(--primary); color: #fff;
  font-family: var(--font-italic); font-style: italic;
  box-shadow: 0 2px 8px rgba(53,98,103,.2);
  transition: all .3s ease;
}
.border-left-primary {
  border-left: 3px solid var(--primary);
}

.sidebar-section-modern {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin: 16px 12px 8px;
  font-family: 'NetflixSans-Lt';
}

.sidebar-section-modern::after {
  content: '';
  display: block;
  height: 1px;
  background: var(--border-subtle);
  margin: 12px;
  opacity: 0.5;
}