/* ============================================================
   Aproject — Component primitives
   Styling for the reusable React components in this folder.
   All values reference tokens; class names are `ds-` prefixed
   so they never collide with UI-kit layout classes.
   ============================================================ */

.ds-icon { display: block; flex-shrink: 0; }

/* ---------------- Button ---------------- */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: var(--text-base); font-weight: 550;
  white-space: nowrap; cursor: pointer; user-select: none;
  transition: background var(--dur-fast), border-color var(--dur-fast),
              color var(--dur-fast), transform .04s;
}
.ds-btn:active { transform: translateY(.5px); }
.ds-btn:disabled { opacity: .5; cursor: default; transform: none; }
.ds-btn .ds-icon { margin: 0 -1px; }

.ds-btn.is-sm { height: 32px; padding: 0 12px; font-size: var(--text-sm); border-radius: var(--radius-sm); gap: 6px; }
.ds-btn.is-lg { height: 44px; padding: 0 20px; font-size: var(--text-md); border-radius: var(--radius-xl); }
.ds-btn.is-block { display: flex; width: 100%; }
.ds-btn.is-icononly { padding: 0; width: 38px; }
.ds-btn.is-sm.is-icononly { width: 32px; }
.ds-btn.is-lg.is-icononly { width: 44px; }

.ds-btn.is-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-sm); }
.ds-btn.is-primary:hover:not(:disabled) { background: var(--primary-hover); }

.ds-btn.is-secondary { background: var(--card); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
.ds-btn.is-secondary:hover:not(:disabled) { background: var(--secondary); border-color: var(--border-strong); }

.ds-btn.is-ghost { background: transparent; color: var(--secondary-foreground); }
.ds-btn.is-ghost:hover:not(:disabled) { background: var(--secondary); color: var(--foreground); }

.ds-btn.is-danger { background: transparent; color: var(--destructive); border-color: var(--border); }
.ds-btn.is-danger:hover:not(:disabled) { background: var(--danger-tint); border-color: transparent; }

/* ---------------- IconButton ---------------- */
.ds-iconbtn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: none; background: transparent; color: var(--muted-foreground);
  border-radius: var(--radius-md); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.ds-iconbtn:hover { background: var(--secondary); color: var(--foreground); }
.ds-iconbtn.is-sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.ds-iconbtn.is-lg { width: 36px; height: 36px; }

/* ---------------- Badge ---------------- */
.ds-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: .02em; line-height: 1;
  padding: 3px 8px; border-radius: var(--radius-pill); white-space: nowrap;
}
.ds-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ds-badge.is-neutral { background: var(--secondary); color: var(--muted-foreground); }
.ds-badge.is-accent  { background: var(--sidebar-accent-tint); color: var(--primary); }
.ds-badge.is-success { background: var(--success-tint); color: var(--success); }
.ds-badge.is-warning { background: var(--warning-tint); color: var(--warning); }
.ds-badge.is-danger  { background: var(--danger-tint);  color: var(--destructive); }
.ds-badge.is-info    { background: var(--info-tint);    color: var(--info); }

/* ---------------- StatusBadge ---------------- */
.ds-status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
}
.ds-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ds-status.st-active { background: var(--success-tint); color: var(--success); }
.ds-status.st-design { background: var(--info-tint);    color: var(--info); }
.ds-status.st-hold   { background: var(--warning-tint); color: #a8740f; }
.ds-status.st-done   { background: var(--secondary);    color: var(--muted-foreground); }
.dark .ds-status.st-active { color: #74c79a; }
.dark .ds-status.st-design { color: #9bb0ff; }
.dark .ds-status.st-hold   { color: #e0b45a; }

/* ---------------- Avatar ---------------- */
.ds-avatar {
  display: grid; place-items: center; flex-shrink: 0;
  border-radius: 50%; color: #fff; font-weight: 600; line-height: 1;
}
.ds-avatar.is-square { border-radius: 28%; }

/* ---------------- ProductChip ---------------- */
.ds-prodchip { display: grid; place-items: center; color: #fff; flex-shrink: 0; }

/* ---------------- Card ---------------- */
.ds-card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  text-align: left;
}
.ds-card.is-padded { padding: var(--space-6); }
.ds-card.is-interactive {
  cursor: pointer; display: block; width: 100%;
  transition: border-color var(--dur-base), box-shadow var(--dur-base), transform var(--dur-base);
}
.ds-card.is-interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

/* ---------------- ProgressBar ---------------- */
.ds-progress { display: block; width: 100%; border-radius: var(--radius-pill); background: var(--secondary); overflow: hidden; }
.ds-progress-fill { display: block; height: 100%; border-radius: var(--radius-pill); transition: width var(--dur-slow) var(--ease-out); }

/* ---------------- Tabs ---------------- */
.ds-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.ds-tab {
  height: 40px; padding: 0 15px; margin-bottom: -1px;
  border: none; background: none; cursor: pointer;
  color: var(--muted-foreground); font-family: var(--font-sans); font-size: var(--text-base); font-weight: 550;
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color var(--dur-fast);
}
.ds-tab:hover { color: var(--foreground); }
.ds-tab.is-on { color: var(--foreground); border-bottom-color: var(--primary); }
.ds-tab-count {
  font-size: var(--text-2xs); font-weight: 600;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--secondary); color: var(--muted-foreground);
  display: inline-grid; place-items: center;
}
.ds-tab.is-on .ds-tab-count { background: var(--sidebar-accent-tint); color: var(--primary); }

/* ---------------- Input / field ---------------- */
.ds-field {
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-md); cursor: text;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.ds-field.is-sm { height: 34px; padding: 0 11px; }
.ds-field:focus-within { border-color: var(--ring); box-shadow: var(--shadow-focus); }
.ds-field-icon { color: var(--muted-foreground); flex-shrink: 0; }
.ds-field:focus-within .ds-field-icon { color: var(--foreground); }
.ds-field-input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--foreground); resize: none;
}
.ds-field-input::placeholder { color: var(--muted-foreground); }
.ds-field textarea.ds-field-input { padding: 9px 0; min-height: 22px; line-height: 1.5; }
.ds-field:has(textarea) { height: auto; align-items: flex-start; }

/* ---------------- Switch ---------------- */
.ds-switch {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; cursor: pointer; padding: 0;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 550; color: var(--muted-foreground);
}
.ds-switch.is-on { color: var(--primary); }
.ds-switch.is-disabled { opacity: .5; cursor: default; }
.ds-switch-track {
  width: 30px; height: 17px; border-radius: var(--radius-pill);
  background: var(--border-strong); position: relative; transition: background var(--dur-base); flex-shrink: 0;
}
.ds-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform var(--dur-base);
}
.ds-switch.is-on .ds-switch-track { background: var(--primary); }
.ds-switch.is-on .ds-switch-knob { transform: translateX(13px); }

/* ---------------- Chip ---------------- */
.ds-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; color: var(--secondary-foreground);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ds-chip:hover { background: var(--secondary); }
.ds-chip.is-on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.ds-chip-count { font-family: var(--font-mono); font-size: var(--text-2xs); opacity: .7; }

/* ---------------- Kbd ---------------- */
.ds-kbd {
  display: inline-flex; align-items: center; gap: 1px;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  padding: 1px 5px; border-radius: var(--radius-xs);
  background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border);
}

/* ---------------- Tooltip ---------------- */
.ds-tip-wrap { position: relative; display: inline-flex; }
.ds-tip {
  position: absolute; z-index: 60;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border);
  padding: 5px 9px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 500; white-space: nowrap;
  pointer-events: none; opacity: 0; box-shadow: var(--shadow-menu);
  transition: opacity var(--dur-fast);
}
.ds-tip-wrap:hover .ds-tip { opacity: 1; }
.ds-tip.is-top    { bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
.ds-tip.is-bottom { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
.ds-tip.is-right  { left: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
.ds-tip.is-left   { right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
