@tailwind base;
@tailwind components;
@tailwind utilities;

/* DevDome Tools component classes: mirrors DEVDOME PLUGIN DESIGN.md §6 so the
   Bot Protection admin renders 1:1 with the rest of the suite. Everything is
   scoped under .dd-app so it beats WP admin chrome + Tailwind preflight. */

@layer components {
  /* Section */
  .dd-app .dd-sec-head { @apply flex items-center gap-2 border-b border-gray-100 pb-2 mb-6; }
  .dd-app .dd-h2       { @apply text-lg font-semibold text-gray-800 m-0 p-0; }
  .dd-app .dd-ico      { @apply text-indigo-600 inline-flex items-center justify-center; font-size:20px; width:20px; height:20px; line-height:20px; }
  .dd-app .dd-card     { @apply bg-white p-6 sm:p-8 rounded-xl border border-gray-200 shadow-sm; }

  /* SettingRow (table) */
  .dd-app .dd-table    { @apply w-full border-collapse; }
  .dd-app .dd-table th, .dd-app .dd-table td { @apply align-top border-b border-gray-50; }
  .dd-app .dd-table tr:last-child > th, .dd-app .dd-table tr:last-child > td { @apply border-b-0; }
  .dd-app .dd-th       { @apply text-left w-[210px] pr-6 pt-3 pb-5 text-sm font-bold text-gray-600; }
  .dd-app .dd-td       { @apply pt-3 pb-5 text-sm text-gray-700; }

  /* Checkbox / radio / options */
  .dd-app .dd-opt   { @apply inline-flex items-center gap-2 cursor-pointer text-sm font-semibold text-gray-700 select-none; }
  .dd-app .dd-radio { @apply w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer; }
  .dd-app .dd-check { @apply h-4 w-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500 cursor-pointer; }
  .dd-app .dd-opts  { @apply flex flex-wrap items-center gap-x-6 gap-y-2; }

  /* Inputs */
  .dd-app .dd-input    { @apply px-3 py-2 bg-white border border-gray-300 rounded-lg text-sm text-gray-700 shadow-sm focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 outline-none transition-colors; }
  .dd-app .dd-textarea { @apply w-full px-3 py-2 bg-white border border-gray-300 rounded-lg text-sm text-gray-700 shadow-sm font-mono leading-relaxed focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 outline-none; }

  /* Custom dropdown (use INSTEAD of native <select>) */
  .dd-app .dd-dd          { @apply relative inline-block; }
  .dd-app .dd-dd-trigger  { @apply flex items-center justify-between gap-2 w-full px-3 py-1.5 h-[34px] bg-white border border-gray-400 rounded-lg text-[13px] font-semibold text-gray-700 cursor-pointer shadow select-none transition-all; }
  .dd-app .dd-dd.is-open .dd-dd-trigger { @apply ring-2 ring-indigo-500/20 border-indigo-500; }
  .dd-app .dd-dd-chev     { @apply w-4 h-4 text-gray-500 shrink-0 transition-transform duration-200; }
  .dd-app .dd-dd.is-open .dd-dd-chev { @apply rotate-180; }
  .dd-app .dd-dd-panel    { @apply hidden absolute top-full left-0 mt-1 min-w-full w-max bg-white border border-gray-300 rounded-lg shadow-xl z-[200] max-h-60 overflow-y-auto py-1; }
  .dd-app .dd-dd.is-open .dd-dd-panel { @apply block; }
  .dd-app .dd-dd.is-disabled { @apply opacity-60 pointer-events-none; }
  .dd-app .dd-dd-opt      { @apply px-4 py-2 text-[13px] text-gray-700 cursor-pointer whitespace-nowrap transition-colors hover:bg-indigo-50; }
  .dd-app .dd-dd-opt.is-selected { @apply bg-indigo-50 font-medium text-indigo-700; }

  /* Buttons */
  .dd-app .dd-btn         { @apply inline-flex items-center justify-center px-5 py-2.5 rounded-lg text-sm font-semibold border border-gray-300 bg-white text-gray-700 shadow-sm cursor-pointer transition-colors hover:bg-gray-50 hover:text-gray-900; }
  .dd-app .dd-btn-primary { @apply inline-flex items-center justify-center px-6 py-2.5 rounded-lg text-sm font-semibold text-white border-0 cursor-pointer bg-indigo-600 hover:bg-indigo-700 transition-colors; box-shadow:0 10px 15px -3px rgba(99,102,241,.3),0 4px 6px -4px rgba(99,102,241,.3); }
  .dd-app .dd-btn-danger  { @apply inline-flex items-center justify-center px-6 py-2.5 rounded-lg text-sm font-semibold text-white border-0 cursor-pointer bg-red-600 hover:bg-red-700 transition-colors; }
  .dd-app .dd-btn-sm      { @apply px-3 py-1.5 text-xs; }

  /* Hints + tooltip */
  .dd-app .description, .dd-app .dd-hint { @apply text-xs text-gray-500 mt-1.5 not-italic; }
  .dd-app .dd-tip { @apply relative inline-flex items-center align-middle; }
  .dd-app .dd-tip .dashicons { @apply text-indigo-400 cursor-help; font-size:15px; width:15px; height:15px; line-height:15px; }
  .dd-app .dd-tip:hover .dashicons { @apply text-indigo-600; }
  .dd-app .dd-tip-box { @apply pointer-events-none invisible absolute bottom-full left-1/2 z-[9999] mb-2 w-max max-w-[240px] -translate-x-1/2 rounded-lg border border-indigo-100 bg-indigo-50 p-2.5 text-center text-xs font-normal not-italic leading-relaxed text-indigo-800 opacity-0 shadow-xl transition-opacity; }
  .dd-app .dd-tip:hover .dd-tip-box { @apply visible opacity-100; }

  /* Sticky footer (content-width rounded card) */
  .dd-app .dd-footer        { @apply sticky bottom-0 z-[100] -mb-6 mt-8 bg-white rounded-xl border border-gray-200 shadow-sm; }
  .dd-app .dd-footer-inner  { @apply flex items-center gap-4 px-5 py-3; }
  .dd-app .dd-footer-actions{ @apply flex items-center gap-2.5 flex-wrap shrink-0; }
  .dd-app .dd-footer-stats  { @apply flex items-center justify-center gap-x-6 gap-y-1 flex-wrap flex-1 min-w-0; }
  .dd-app .dd-footer-right  { @apply shrink-0; }
  .dd-app .dd-fstat         { @apply flex items-baseline gap-1.5 whitespace-nowrap; }
  .dd-app .dd-fstat-num     { @apply text-lg font-bold text-indigo-600 leading-none; }
  .dd-app .dd-fstat-lbl     { @apply text-xs text-gray-500; }

  /* Stat cards (non-footer) */
  .dd-app .dd-stats    { @apply grid gap-4; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); }
  .dd-app .dd-stat     { @apply bg-white border border-gray-200 rounded-xl shadow-sm p-5; }
  .dd-app .dd-stat-num { @apply text-3xl font-bold text-indigo-600 leading-none; }
  .dd-app .dd-stat-lbl { @apply text-xs text-gray-500 mt-1.5; }

  /* ---- Bot Protection-specific components ---- */

  /* Segmented control (Protection Level, Watching/Live, per-rule Allow/Log/Challenge/Block) */
  .dd-app .dd-seg       { @apply inline-flex items-center p-1 rounded-lg bg-gray-100 border border-gray-200 gap-1; }
  .dd-app .dd-seg-opt   { @apply inline-flex items-center justify-center px-4 py-1.5 rounded-md text-[13px] font-semibold text-gray-600 cursor-pointer select-none transition-colors hover:text-gray-900; }
  .dd-app .dd-seg-opt.is-active { @apply bg-white text-indigo-700 shadow-sm; }
  .dd-app .dd-seg.is-danger .dd-seg-opt.is-active { @apply text-red-700; }
  .dd-app .dd-seg.is-go .dd-seg-opt.is-active { @apply text-green-700; }

  /* Site-Type preset tiles */
  .dd-app .dd-preset-grid { @apply grid gap-3; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
  .dd-app .dd-preset     { @apply flex flex-col gap-1 p-4 rounded-xl border border-gray-200 bg-white cursor-pointer transition-colors hover:border-indigo-300; }
  .dd-app .dd-preset.is-active { @apply border-indigo-500 bg-indigo-50 ring-2 ring-indigo-500/20; }
  .dd-app .dd-preset-ico { @apply text-indigo-600; font-size:22px; width:22px; height:22px; line-height:22px; }
  .dd-app .dd-preset-name{ @apply text-sm font-bold text-gray-800; }
  .dd-app .dd-preset-desc{ @apply text-xs text-gray-500 leading-snug; }

  /* Protection-Score donut */
  .dd-app .dd-donut      { @apply relative inline-flex items-center justify-center; width:160px; height:160px; }
  .dd-app .dd-donut-num  { @apply absolute text-4xl font-bold text-gray-800 leading-none; }
  .dd-app .dd-donut-lbl  { @apply absolute text-xs font-semibold text-gray-500; bottom:38px; }

  /* "3 things to improve" checklist */
  .dd-app .dd-checklist  { @apply flex flex-col gap-2; }
  .dd-app .dd-check-item { @apply flex items-center gap-2.5 px-3 py-2 rounded-lg border border-gray-200 bg-white text-sm text-gray-700; }
  .dd-app .dd-check-item .dashicons { @apply shrink-0; font-size:18px; width:18px; height:18px; line-height:18px; }
  .dd-app .dd-check-item.is-done { @apply text-gray-400; }
  .dd-app .dd-check-item.is-done .dashicons { @apply text-green-500; }
  .dd-app .dd-check-item.is-todo .dashicons { @apply text-amber-500; }

  /* Safe-Mode pill + watch-mode banner */
  .dd-app .dd-pill       { @apply inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold border; }
  .dd-app .dd-pill-safe  { @apply text-amber-700 bg-amber-50 border-amber-200; }
  .dd-app .dd-pill-ok    { @apply text-green-700 bg-green-50 border-green-200; }
  .dd-app .dd-banner     { @apply flex items-center gap-3 p-4 rounded-xl border text-sm; }
  .dd-app .dd-banner-watch { @apply border-indigo-200 bg-indigo-50 text-indigo-800; }

  /* Sparkline wrapper */
  .dd-app .dd-spark      { @apply mt-3 w-full; height:40px; }

  /* ---- Tabs ---- */
  .dd-tabs        { @apply flex items-center gap-1 border-b border-gray-200 bg-white px-6; }
  .dd-tab         { @apply inline-flex items-center gap-1.5 px-4 py-3 text-sm font-semibold text-gray-500 border-b-2 border-transparent no-underline transition-colors hover:text-gray-800; }
  .dd-tab:hover   { @apply text-gray-800; }
  .dd-tab.is-active { @apply text-indigo-700 border-indigo-600; }
  .dd-tab .dashicons { font-size:16px; width:16px; height:16px; line-height:16px; }

  /* ---- Event table ---- */
  .dd-app .dd-evt        { @apply w-full border-collapse text-sm; }
  .dd-app .dd-evt th     { @apply text-left text-xs font-bold uppercase tracking-wide text-gray-500 px-3 py-2 border-b border-gray-200; }
  .dd-app .dd-evt td     { @apply px-3 py-2 border-b border-gray-50 text-gray-700 align-top; }
  .dd-app .dd-evt tr:hover td { @apply bg-gray-50; }
  .dd-app .dd-evt .mono  { @apply font-mono text-xs text-gray-600; }
  .dd-app .dd-evt-ua     { @apply text-xs text-gray-500 truncate; max-width:340px; }

  /* Category + action badges */
  .dd-app .dd-cat        { @apply inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold; }
  .dd-app .dd-cat.is-scanner    { @apply bg-red-50 text-red-700; }
  .dd-app .dd-cat.is-malicious_ip { @apply bg-red-50 text-red-700; }
  .dd-app .dd-cat.is-datacenter { @apply bg-amber-50 text-amber-700; }
  .dd-app .dd-cat.is-suspicious { @apply bg-amber-50 text-amber-700; }
  .dd-app .dd-cat.is-rate_limit { @apply bg-orange-50 text-orange-700; }
  .dd-app .dd-cat.is-velocity   { @apply bg-yellow-50 text-yellow-700; }
  .dd-app .dd-cat.is-ai_blocked { @apply bg-purple-50 text-purple-700; }
  .dd-app .dd-cat.is-honeypot   { @apply bg-rose-50 text-rose-700; }
  .dd-app .dd-cat.is-verified_bot { @apply bg-green-50 text-green-700; }
  .dd-app .dd-cat.is-human      { @apply bg-gray-100 text-gray-600; }
  .dd-app .dd-act        { @apply inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold; }
  .dd-app .dd-act.is-block { @apply bg-red-600 text-white; }
  .dd-app .dd-act.is-would_block { @apply bg-amber-100 text-amber-800; }
  .dd-app .dd-act.is-log   { @apply bg-gray-100 text-gray-600; }
  .dd-app .dd-act.is-challenge { @apply bg-purple-100 text-purple-700; }
  .dd-app .dd-act.is-allow { @apply bg-green-50 text-green-700; }

  /* Bots-vs-humans daily bars */
  .dd-app .dd-bars       { @apply flex items-end gap-3; height:120px; }
  .dd-app .dd-bar-col    { @apply flex flex-col items-center gap-1 flex-1; }
  .dd-app .dd-bar-stack  { @apply flex flex-col justify-end w-full gap-0.5; height:96px; }
  .dd-app .dd-bar-h      { @apply w-full rounded-sm bg-indigo-500; min-height:2px; }
  .dd-app .dd-bar-b      { @apply w-full rounded-sm bg-amber-400; min-height:2px; }
  .dd-app .dd-bar-lbl    { @apply text-[10px] text-gray-400; }

  /* Empty state */
  .dd-app .dd-empty      { @apply text-center text-sm text-gray-400 py-10; }
}

/* ---------------------------------------------------------------------------
 * Backup & Migration scoped primitives (REFERENCE ONLY).
 *
 * There is no node/Tailwind toolchain in this environment, so these are NOT
 * compiled into assets/devdome-tools-tw.css. The LIVE source of these classes
 * is the scoped inline <style> block printed by
 * includes/Admin/dbm-admin.php -> devdome_backup_print_scoped_styles().
 * Kept here so a future build environment can fold them into the compiled CSS.
 *
 *   .dbm-banner / .dbm-banner-warn|info|danger|ok : status banners
 *   .dbm-badge / .dbm-badge-verified|ready|incomplete|unavailable|corrupt
 *   .dbm-gauge / .dbm-gauge-fill(.is-low)         : disk-usage gauge
 *   .dbm-modal / .dbm-modal-backdrop / .dbm-modal-card / .dbm-modal-actions
 *   .dbm-check / .dbm-advanced                    : modal consent controls
 *   .dbm-progress / .dbm-progress-bar             : restoration progress bar
 *   .dbm-rows / .dbm-row / .dbm-row-head|meta|actions|detail
 *   .dbm-pro                                      : dormant Pro badge
 *   .dbm-token                                    : readonly emergency-link input
 * ------------------------------------------------------------------------- */
