@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap");

:root {
  --amt-ink: #17212b;
  --amt-muted: #5f6b76;
  --amt-subtle: #eef3f2;
  --amt-surface: #ffffff;
  --amt-border: #d9e1df;
  --amt-primary: #0b5f5a;
  --amt-primary-strong: #084843;
  --amt-accent: #a66f21;
  --amt-danger: #a82820;
  --amt-success: #1f7a4d;
  --amt-warning-bg: #fff6dc;
  --amt-danger-bg: #fff0ee;
  --amt-success-bg: #eaf6ef;
  --amt-radius: 8px;
  --amt-shadow: 0 8px 30px rgba(23, 33, 43, 0.08);
}

html {
  color-scheme: light;
}

body {
  font-family: "Inter", "Noto Naskh Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  background: #f7faf9 !important;
  color: var(--amt-ink);
  letter-spacing: 0;
}

html[dir="rtl"] body,
body[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

a {
  color: var(--amt-primary);
}

a:hover {
  color: var(--amt-primary-strong);
}

button,
.action-btn,
.plan-btn,
.subscribe-btn,
.sidepanel-signin {
  border-radius: 6px !important;
  font-weight: 600;
  min-height: 38px;
}

button,
.action-btn.primary,
.plan-btn,
.subscribe-btn {
  background: var(--amt-primary) !important;
  border-color: var(--amt-primary) !important;
  color: #fff !important;
}

button:hover,
.action-btn.primary:hover,
.plan-btn:hover,
.subscribe-btn:hover {
  background: var(--amt-primary-strong) !important;
  border-color: var(--amt-primary-strong) !important;
}

button.secondary,
.action-btn,
.plan-btn.secondary {
  background: #fff !important;
  color: var(--amt-primary) !important;
  border: 1px solid var(--amt-primary) !important;
}

button.secondary:hover,
.action-btn:hover,
.plan-btn.secondary:hover {
  background: #edf7f5 !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(11, 95, 90, 0.25);
  outline-offset: 2px;
}

input,
textarea,
select {
  border-color: var(--amt-border) !important;
  border-radius: 6px !important;
  color: var(--amt-ink);
}

textarea::placeholder,
input::placeholder {
  color: #7b8792;
}

.container {
  background: transparent !important;
}

.amt-brand {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.amt-brand a {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 10px;
  text-decoration: none;
}

.amt-brand-logo {
  display: block;
  height: 34px;
  width: auto;
}

.amt-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.amt-brand-name {
  color: var(--amt-ink);
  font-family: "Inter", "Noto Naskh Arabic", sans-serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.amt-brand-tagline {
  color: var(--amt-muted);
  font-family: "Inter", "Noto Naskh Arabic", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.app-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--amt-border);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header .amt-brand {
  flex: 0 0 auto;
}

.app-nav {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.app-nav a,
.drawer-panel a {
  color: var(--amt-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.app-nav a:hover,
.drawer-panel a:hover {
  color: var(--amt-primary);
}

.app-nav .nav-primary,
.drawer-panel .nav-primary {
  color: var(--amt-primary);
}

.app-user {
  color: var(--amt-muted);
  font-size: 13px;
  line-height: 1.45;
}

.app-user strong {
  color: var(--amt-ink);
}

.tab {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  color: var(--amt-muted) !important;
  min-height: 0;
}

.tab.active {
  border-bottom-color: var(--amt-primary) !important;
  color: var(--amt-primary) !important;
}

.menu-toggle {
  align-items: center;
  background: #fff !important;
  border: 1px solid var(--amt-border) !important;
  color: var(--amt-ink) !important;
  display: none;
  font-size: 24px;
  height: 40px;
  justify-content: center;
  line-height: 1;
  min-height: 40px;
  padding: 0 !important;
  width: 40px;
}

.drawer-backdrop {
  background: rgba(23, 33, 43, 0.35);
  display: none;
  inset: 0;
  position: fixed;
  z-index: 40;
}

.drawer-backdrop.open {
  display: block;
}

.drawer-panel {
  background: #fff;
  border-left: 1px solid var(--amt-border);
  box-shadow: var(--amt-shadow);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  margin-left: auto;
  max-width: 320px;
  padding: 20px;
  width: min(86vw, 320px);
}

html[dir="rtl"] .drawer-panel {
  border-left: 0;
  border-right: 1px solid var(--amt-border);
  margin-left: 0;
  margin-right: auto;
}

.drawer-close {
  align-self: flex-end;
  background: #fff !important;
  border: 1px solid var(--amt-border) !important;
  color: var(--amt-ink) !important;
  min-height: 36px;
  padding: 6px 12px !important;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-layout {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 24px 56px;
}

.chat-main {
  min-width: 0;
}

.chat-hero {
  margin-bottom: 18px;
}

.chat-hero h1 {
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 8px;
  text-align: left;
}

html[dir="rtl"] .chat-hero h1 {
  text-align: right;
}

.chat-hero p {
  color: var(--amt-muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  max-width: 720px;
}

.chat-form {
  background: #fff;
  border: 1px solid var(--amt-border);
  border-radius: var(--amt-radius);
  box-shadow: var(--amt-shadow);
  margin: 0 !important;
  max-width: none !important;
  padding: 20px;
}

.question-label {
  color: var(--amt-ink);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.chat-form textarea {
  min-height: 148px;
  resize: vertical;
}

.chat-submit-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
}

.char-hint {
  color: var(--amt-muted);
  font-size: 12px;
}

.advanced-filters {
  border-top: 1px solid var(--amt-border);
  margin-top: 14px;
  padding-top: 12px;
}

.advanced-filters summary {
  color: var(--amt-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.q-meta {
  margin-top: 12px;
}

.q-meta label {
  color: var(--amt-muted) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.chat-instructions {
  color: var(--amt-muted);
  font-size: 12px;
  line-height: 1.5;
  list-style: disc;
  margin: 14px 0 0;
  padding-left: 18px;
}

.chat-instructions li {
  margin-bottom: 4px;
}

.chat-instructions li:first-child {
  list-style: none;
  margin-left: -18px;
}

.response {
  background: #fff !important;
  border: 1px solid var(--amt-border);
  border-left: 4px solid var(--amt-primary);
  border-radius: var(--amt-radius) !important;
  box-shadow: var(--amt-shadow);
  color: var(--amt-ink);
  line-height: 1.6;
}

html[dir="rtl"] .response {
  border-left: 1px solid var(--amt-border);
  border-right: 4px solid var(--amt-primary);
}

.disclaimer,
.trial-banner,
.reason-banner,
.banner {
  border-radius: var(--amt-radius) !important;
}

.disclaimer {
  background: var(--amt-warning-bg) !important;
  color: #6c4b04 !important;
}

.error {
  color: var(--amt-danger) !important;
}

.status {
  color: var(--amt-primary) !important;
}

.dots span {
  background: var(--amt-primary) !important;
}

.chat-main .thinking.visible {
  align-items: center;
  display: flex;
  flex-direction: column;
}

.amt-wait-loader {
  --amt-blue: #2f3f98;
  --amt-logo-size: clamp(26px, 6vw, 41px);
  /* One full cycle = roll across the screen + a pause before the next roll. */
  --amt-roll: 7.5s;        /* time to roll left → right (50% slower than before) */
  --amt-gap: 6s;           /* pause between rolls */
  --amt-duration: 13.5s;   /* must equal --amt-roll + --amt-gap */

  color: var(--amt-blue);
  font: 600 0.95rem/1.4 "Inter", "Noto Naskh Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0 auto;
  width: 100%;
}

/* Plain background — full-bleed track so the logo rolls across the whole
   browser width, breaking out of the container's horizontal padding. */
.amt-wait-loader__runway {
  height: calc(var(--amt-logo-size) + 34px);
  margin-left: calc(50% - 50vw);
  overflow: hidden;
  position: relative;
  width: 100vw;
}

.amt-wait-loader__logo {
  /* 6s delay = the first roll only starts after 6 seconds, not immediately. */
  animation: amt-logo-slide var(--amt-duration) linear var(--amt-gap) infinite;
  aspect-ratio: 1;
  display: grid;
  left: calc(var(--amt-logo-size) * -1.35);
  place-items: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--amt-logo-size);
  will-change: left, opacity;
  z-index: 2;
}

.amt-wait-loader__logo img {
  animation: amt-logo-roll var(--amt-duration) linear var(--amt-gap) infinite;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(18, 27, 92, 0.24));
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  width: 100%;
  will-change: transform;
}

.amt-wait-loader__text {
  letter-spacing: 0;
  margin: 0.65rem 0 0;
  text-align: center;
}

.amt-wait-loader__dots::after {
  animation: amt-dots 1.2s steps(4, end) infinite;
  content: "...";
  display: inline-block;
  overflow: hidden;
  text-align: left;
  width: 0;
}

/*
 * Roll phase = 0% → 55.56% (7.5s of a 13.5s cycle), then the logo is parked
 * off-screen for the remaining 44.44% (6s gap) before the next roll.
 */
@keyframes amt-logo-slide {
  0% {
    left: calc(var(--amt-logo-size) * -1.35);
    opacity: 0;
  }

  2.5% {
    opacity: 1;
  }

  53% {
    opacity: 1;
  }

  55.56% {
    left: 100%;
    opacity: 0;
  }

  55.57%,
  100% {
    left: calc(var(--amt-logo-size) * -1.35);
    opacity: 0;
  }
}

/*
 * Rolls 3 full turns across the runway, but with a little bump at each end:
 * a backward lurch + hop as it sets off, and an overshoot + hop just before it
 * leaves the screen. The middle (6% → 50%) stays smooth.
 */
@keyframes amt-logo-roll {
  0% {
    transform: translateY(0) rotate(0turn);
  }

  2% {
    transform: translateY(-3px) rotate(-0.05turn);
  }

  6% {
    transform: translateY(0) rotate(0.1turn);
  }

  50% {
    transform: translateY(0) rotate(2.7turn);
  }

  53% {
    transform: translateY(-3px) rotate(3.06turn);
  }

  55.56%,
  100% {
    transform: translateY(0) rotate(3turn);
  }
}

@keyframes amt-dots {
  0% {
    width: 0;
  }

  100% {
    width: 1.25em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amt-wait-loader__logo,
  .amt-wait-loader__logo img,
  .amt-wait-loader__dots::after {
    animation: none;
  }

  .amt-wait-loader__logo {
    left: 50%;
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.quota-chip.blocked {
  color: var(--amt-danger) !important;
}

.quota-chip.warn {
  color: var(--amt-accent) !important;
}

.pricing-wrap,
.profile-wrap {
  max-width: 1060px !important;
}

.pricing-hero {
  text-align: left !important;
}

html[dir="rtl"] .pricing-hero {
  text-align: right !important;
}

.plans-grid {
  align-items: stretch;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-card,
.profile-card,
.consent-box,
.topup-card,
.card,
.stat {
  border: 1px solid #cbd6d2 !important;
  border-radius: var(--amt-radius) !important;
  /* Shared card shading: a tight contact shadow + a soft ambient one so cards
     read clearly against the pale page background (matches the WHT page). */
  box-shadow: 0 1px 2px rgba(23, 33, 43, 0.08),
              0 10px 24px rgba(23, 33, 43, 0.12) !important;
}

.plan-card.featured {
  border-color: var(--amt-primary) !important;
}

.plan-badge {
  background: var(--amt-primary) !important;
  border-radius: 999px !important;
}

.plan-badge.secondary {
  background: #52606d !important;
}

.plan-price,
.topup-price {
  color: var(--amt-primary) !important;
}

.comparison-table {
  border: 1px solid var(--amt-border);
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 28px;
  width: 100%;
}

.comparison-table th,
.comparison-table td {
  border-bottom: 1px solid var(--amt-border);
  padding: 10px;
  text-align: left;
}

html[dir="rtl"] .comparison-table th,
html[dir="rtl"] .comparison-table td {
  text-align: right;
}

.comparison-table th {
  background: #f4f8f7;
  color: var(--amt-ink);
}

.pricing-info-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 24px 0;
}

.pricing-info {
  background: #fff;
  border: 1px solid var(--amt-border);
  border-radius: var(--amt-radius);
  padding: 14px;
}

.pricing-info h2 {
  font-size: 15px;
  margin: 0 0 6px;
}

.pricing-info p {
  color: var(--amt-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.plan-btn.current {
  background: #eef3f2 !important;
  border-color: var(--amt-border) !important;
  color: var(--amt-muted) !important;
}

.admin-shell {
  display: grid;
  gap: 20px;
  grid-template-columns: 220px minmax(0, 1fr);
}

.admin-nav {
  align-self: start;
  background: #fff;
  border: 1px solid var(--amt-border);
  border-radius: var(--amt-radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  position: sticky;
  top: 16px;
}

.admin-nav a {
  border-radius: 6px;
  color: var(--amt-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none;
}

.admin-nav a:hover {
  background: #edf7f5;
  color: var(--amt-primary);
}

.stat .value {
  color: var(--amt-primary) !important;
}

.page-footer {
  color: var(--amt-muted) !important;
}

@media (max-width: 860px) {
  .app-header {
    min-height: 58px;
    padding: 9px 14px;
  }

  .app-header .amt-brand-tagline {
    display: none;
  }

  .app-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .chat-layout {
    display: flex;
    flex-direction: column;
    padding: 18px 12px 40px;
  }

  .chat-hero h1 {
    font-size: 24px;
  }

  .chat-form {
    padding: 16px;
  }

  .admin-shell {
    display: block;
  }

  .admin-nav {
    flex-direction: row;
    margin-bottom: 16px;
    overflow-x: auto;
    position: static;
  }
}
