/* ==========================================================================
   EasyEG — Reusable UI Components (components.css)
   Buttons, Cards, Badges, Breadcrumbs, Skeletons, Toasts & Forms
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--brand-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
}

.btn-outline {
  border: 1.5px solid var(--brand-primary);
  color: var(--brand-primary);
  background: transparent;
}

.btn-outline:hover {
  background: var(--brand-soft);
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand-primary);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.84rem;
  min-height: 36px;
}

.btn-lg {
  padding: 13px 20px;
  font-size: 1rem;
  min-height: 48px;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-brand { background: var(--brand-soft); color: var(--brand-primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* Hero Banner */
.hero-banner {
  background: var(--brand-gradient);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-md);
}

.hero-banner h1 {
  color: #ffffff;
  font-size: clamp(1.45rem, 3.5vw, 2.2rem);
  margin-bottom: 10px;
}

.hero-banner p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 62ch;
  margin-bottom: 18px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumbs a:hover {
  color: var(--brand-primary);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 14px);
  left: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

@media (min-width: 900px) {
  .toast-container {
    bottom: 20px;
  }
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  border-right: 4px solid var(--brand-primary);
  animation: toast-in 0.25s ease;
}

.toast--success { border-right-color: #22c55e; }
.toast--danger, .toast--error { border-right-color: #ef4444; }
.toast--warning { border-right-color: #f59e0b; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === EasyEG V8 — Universal RTL Smart Scroll Arrows & Drawer Categories === */
.h-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}
.h-scroll-wrap > .cat-strip {
  flex: 1;
  min-width: 0;
  margin-bottom: 0 !important;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.h-scroll-wrap > .cat-strip::-webkit-scrollbar {
  display: none;
}
.tabs-arrow-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: #0f172a;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s, opacity 0.2s, border-color 0.2s;
}
html[data-theme="dark"] .tabs-arrow-btn { color: #f8fafc; }
.tabs-arrow-btn.is-disabled {
  color: #94a3b8;
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}
html[data-theme="dark"] .tabs-arrow-btn.is-disabled { color: #64748b; }
.tabs-arrow-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drawer-cats-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}
.drawer-cats-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-inline: 8px;
}
.drawer-cats-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer-cat-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  transition: background 0.15s;
}
.drawer-cat-link:hover {
  background: var(--brand-soft);
  color: var(--brand-primary);
}

/* === EasyEG V8.2 — AI Support Chat Widget === */
.ai-fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 14px);
  left: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 170;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.ai-fab:hover { transform: scale(1.06); }
.ai-fab.is-hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
@media (min-width: 900px) {
  .ai-fab { bottom: 22px; left: 22px; }
}

.ai-chat-drawer {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 10px);
  left: 12px;
  right: 12px;
  max-width: 380px;
  height: min(500px, 70vh);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 195;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.ai-chat-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
@media (min-width: 900px) {
  .ai-chat-drawer { bottom: 22px; left: 22px; right: auto; width: 370px; }
}
.ai-chat-head {
  background: var(--brand-gradient);
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-chat-close {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
  cursor: pointer;
}
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-page);
}
.ai-msg { display: flex; flex-direction: column; max-width: 88%; }
.ai-msg--user { align-self: flex-start; }
.ai-msg--bot { align-self: flex-end; }
.ai-msg__bubble {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.6;
  word-break: break-word;
}
.ai-msg--user .ai-msg__bubble {
  background: var(--brand-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.ai-msg--bot .ai-msg__bubble {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}
.ai-handoff-box {
  margin-top: 6px;
  background: var(--bg-surface);
  border: 1.5px solid #16a34a;
  border-radius: var(--radius-md);
  padding: 10px;
  color: var(--text-main);
}
.ai-quick-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  scrollbar-width: none;
}
.ai-quick-chips::-webkit-scrollbar { display: none; }
.ai-chip {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ai-chip--human {
  border-color: #16a34a;
  color: #15803d;
}
html[data-theme="dark"] .ai-chip--human { color: #4ade80; }
.ai-chat-foot {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}
.ai-chat-foot .form-control {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.88rem;
}
