/* WooWhats Custom Styles */

:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --navy-card: #1a2744;
  --blue-primary: #3b82f6;
  --blue-hover: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
  --gray-text: #94a3b8;

  /* Custom easing curves — Emil Kowalski */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
  background-color: var(--navy);
  color: #f1f5f9;
  font-family: 'Rubik', sans-serif;
  direction: rtl;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  background-color: var(--navy-light);
  border-left: 1px solid #334155;
  width: 260px;
  min-height: 100vh;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 50;
  transition: transform 280ms var(--ease-out);
}

.sidebar-hidden { transform: translateX(260px); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(260px); }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-content { margin-right: 0 !important; }
}

.main-content { margin-right: 260px; }

/* ── Nav items ───────────────────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--gray-text);
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out);
  font-size: 0.9rem;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
}

.nav-item:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: #f1f5f9;
}

.nav-item.nav-active {
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--blue-primary);
  font-weight: 600;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card-dark { background-color: var(--navy-light); }
.card-blue { background: linear-gradient(135deg, #1e3a5f, #1e293b); }

.kpi-card {
  background-color: var(--navy-light);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 20px;
  transition: border-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.kpi-card:hover { border-color: #475569; }

/* ── Buttons — tactile feedback on :active ───────────────────────────────── */
.btn-primary {
  background-color: var(--blue-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn-primary:hover { background-color: var(--blue-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-sm {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Rubik', sans-serif;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out), opacity 160ms;
}

.btn-sm:active { transform: scale(0.97); }

.btn-xs {
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'Rubik', sans-serif;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn-xs:active { transform: scale(0.97); }

.btn-blue { background-color: var(--blue-primary); color: white; }
.btn-blue:hover { background-color: var(--blue-hover); }

.btn-gray { background-color: #334155; color: #cbd5e1; }
.btn-gray:hover { background-color: #475569; }

.btn-red { background-color: #7f1d1d; color: #fca5a5; }
.btn-red:hover { background-color: #991b1b; }

.btn-outline {
  background-color: transparent;
  border: 1px solid #475569;
  color: #94a3b8;
}
.btn-outline:hover { border-color: var(--blue-primary); color: var(--blue-primary); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background-color: #14532d; color: #4ade80; }
.badge-gray { background-color: #1e293b; color: #94a3b8; border: 1px solid #334155; }
.badge-red { background-color: #7f1d1d; color: #fca5a5; }
.badge-blue { background-color: #1e3a5f; color: #60a5fa; }

/* ── Form inputs ─────────────────────────────────────────────────────────── */
.form-input {
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 10px 14px;
  width: 100%;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9rem;
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder { color: #475569; }

/* ── Modal — glass morphism + entry animation ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background-color: var(--navy-light);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 48px rgba(0, 0, 0, 0.5);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(1);
  opacity: 1;
  transition: transform 240ms var(--ease-out), opacity 200ms var(--ease-out);

  @starting-style {
    transform: scale(0.96);
    opacity: 0;
  }
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  border-radius: 24px;
  transition: background-color 200ms var(--ease-out);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  right: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 200ms var(--ease-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider { background-color: var(--blue-primary); }
input:checked + .toggle-slider:before { transform: translateX(-20px); }
input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* ── Toast — slides in from bottom ──────────────────────────────────────── */
.toast-base {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 999;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  transition: transform 320ms var(--ease-out), opacity 280ms var(--ease-out);

  @starting-style {
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
  }
}

.toast-success { background-color: #14532d; color: #4ade80; border: 1px solid #16a34a; }
.toast-error { background-color: #7f1d1d; color: #fca5a5; border: 1px solid #b91c1c; }

/* ── Plan cards — with stagger entry ────────────────────────────────────── */
.plan-card {
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 24px;
  transition: border-color 200ms var(--ease-out), transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.plan-card:hover {
  border-color: #475569;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.plan-card.plan-active {
  border-color: var(--blue-primary);
  background: rgba(59, 130, 246, 0.05);
}

/* ── Grid stagger entry ──────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger-grid > * {
  animation: fadeUp 300ms var(--ease-out) both;
}

.stagger-grid > *:nth-child(1) { animation-delay: 0ms; }
.stagger-grid > *:nth-child(2) { animation-delay: 50ms; }
.stagger-grid > *:nth-child(3) { animation-delay: 100ms; }
.stagger-grid > *:nth-child(4) { animation-delay: 150ms; }
.stagger-grid > *:nth-child(5) { animation-delay: 200ms; }
.stagger-grid > *:nth-child(6) { animation-delay: 250ms; }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #263548 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

/* ── Guide Modal ─────────────────────────────────────────────────────────── */
.guide-browser {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}
.guide-bar {
  background: #334155;
  color: #94a3b8;
  padding: 6px 12px;
  font-size: 11px;
}
.guide-path {
  padding: 8px 12px;
  color: #60a5fa;
}
.guide-fields { padding: 8px 12px; }
.guide-field-mock {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
}
.guide-field-label { color: #64748b; flex-shrink: 0; }
.guide-field-value { color: #93c5fd; font-family: monospace; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.guide-copy-btn {
  background: #334155;
  color: #94a3b8;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.guide-copy-btn:hover { background: #475569; color: #f1f5f9; }
.guide-chat { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.guide-msg { padding: 4px 8px; border-radius: 6px; font-size: 11px; color: #cbd5e1; max-width: 90%; }
.guide-msg.bot { background: #1e3a5f; align-self: flex-end; }
.guide-code {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px;
  font-family: monospace;
  font-size: 10px;
  color: #7dd3fc;
  white-space: pre;
  overflow-x: auto;
  margin: 0;
}
.guide-mock-wrapper { margin-top: 6px; }

/* ── Owner Notifications Matrix ─────────────────────────────────────────── */
.notif-matrix-table { width: 100%; border-collapse: collapse; }
.notif-matrix-table th {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  border-bottom: 1px solid #334155;
}
.notif-matrix-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
  text-align: center;
  vertical-align: middle;
}
.notif-matrix-table td:first-child { text-align: right; }
.notif-matrix-table tr:last-child td { border-bottom: none; }
.notif-matrix-table tr:hover td { background: rgba(255,255,255,0.02); }

/* toggle switch */
.notif-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.notif-toggle input { opacity: 0; width: 0; height: 0; }
.notif-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #334155;
  border-radius: 20px;
  transition: 200ms;
}
.notif-toggle-slider:before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  right: 3px;
  bottom: 3px;
  background: #64748b;
  border-radius: 50%;
  transition: 200ms;
}
.notif-toggle input:checked + .notif-toggle-slider { background: rgba(34,197,94,0.3); }
.notif-toggle input:checked + .notif-toggle-slider:before {
  background: #22c55e;
  right: auto;
  left: 3px;
}

/* Coming Soon badge */
.badge-coming-soon {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.3);
}
.badge-on-request {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.3);
}
.badge-active {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
}

/* ── Usage bar ───────────────────────────────────────────────────────────── */
.usage-bar-bg {
  background-color: #334155;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.usage-bar-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  height: 100%;
  border-radius: 999px;
  transition: width 600ms var(--ease-out);
}

/* ── Tab ─────────────────────────────────────────────────────────────────── */
.tab-btn {
  padding: 10px 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--gray-text);
  font-weight: 500;
  transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'Rubik', sans-serif;
  font-size: 0.95rem;
}

.tab-btn.tab-active {
  border-bottom-color: var(--blue-primary);
  color: var(--blue-primary);
}

/* ── input-field — alias for form-input ─────────────────────────────────── */
.input-field {
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9rem;
  transition: border-color 180ms var(--ease-out);
}
.input-field:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Force dark background on all native selects and inputs ────────────────── */
select, input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="search"], textarea {
  color-scheme: dark;
}

select option {
  background-color: #1e293b;
  color: #f1f5f9;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hover\:bg-gray-750:hover { background-color: rgba(30, 41, 59, 0.5); }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
