@import "tailwindcss";
@import "tw-animate-css";
@import "./../components/ui/toast.css";
@import "./../components/video/irs-video.css";
@import "./../components/video/irs-video-fullscreen.css";

@custom-variant dark (&:is(.dark *));

/* Rangook design tokens (docs/dev/DESIGN.md §4–§7, §16.1). */
@theme {
  /* surfaces & text */
  --color-paper: #F5EFE4;  --color-paper-2: #EDE4D3;  --color-canvas: #FFFBF4;
  /* the empty area around the 440px app column on wide screens */
  --color-desk: #FFFFFF;
  --color-ink: #2A221D;    --color-ink-soft: #6E6157; --color-line: #E3D7C3;
  /* pigments */
  --color-sienna: #B44A32; --color-sienna-dark: #8E3826; --color-sienna-soft: #F3DCD3;
  --color-ochre: #D69E3A;  --color-ochre-ink: #8A5D12;   --color-ochre-soft: #F6E7C8;
  --color-sage: #587A5C;   --color-sage-ink: #3F5C43;    --color-sage-soft: #DDE7DA;
  --color-ultra: #2E4596;  --color-ultra-soft: #DCE1F2;
  --color-rose: #B5475F;   --color-rose-soft: #F2D8DE;
  --color-silver: #BDB7AE; --color-bronze: #C98B5A;

  /* type scale */
  --text-micro: 11px;   --text-micro--line-height: 16px;
  --text-caption: 12px; --text-caption--line-height: 18px;
  --text-body-sm: 13px; --text-body-sm--line-height: 22px;
  --text-body: 14px;    --text-body--line-height: 24px;
  --text-title-3: 16px; --text-title-3--line-height: 26px;
  --text-title-2: 18px; --text-title-2--line-height: 28px;
  --text-title-1: 22px; --text-title-1--line-height: 34px;
  --text-display: 28px; --text-display--line-height: 38px;
  --text-hero: 44px;    --text-hero--line-height: 52px;

  /* shape, elevation & motion (radius-lg/xl/2xl/3xl stay Tailwind's 8/12/16/24) */
  --radius-card: 24px; --radius-hero: 28px;
  --shadow-card: 0 8px 22px -18px rgba(74, 52, 30, .5);
  --shadow-raised: 0 14px 30px -18px rgba(70, 45, 25, .55);
  --shadow-overlay: 0 30px 60px -20px rgba(0, 0, 0, .6);
  --ease-out: cubic-bezier(.2, .8, .3, 1);
}

/* Fonts are bundled in public/fonts (no CDN; DESIGN.md §16.2). */
@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Wordmark only (DESIGN.md §3). */
@font-face {
  font-family: "Rangook Nastaliq";
  src: url("/fonts/NotoNastaliqUrdu.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-vazirmatn: "Vazirmatn";
  --font-nastaliq: "Rangook Nastaliq";
}

@theme inline {
  --font-sans: var(--font-vazirmatn), system-ui, sans-serif;
  --font-brand: var(--font-nastaliq), var(--font-vazirmatn), serif;

  /* shadcn names → Rangook tokens */
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
}

/* shadcn bridge (DESIGN.md §16.1). */
:root {
  --background: var(--color-paper);  --foreground: var(--color-ink);
  --card: var(--color-canvas);       --card-foreground: var(--color-ink);
  --popover: var(--color-canvas);    --popover-foreground: var(--color-ink);
  --primary: var(--color-sienna);    --primary-foreground: #fff;
  --secondary: var(--color-paper-2); --secondary-foreground: var(--color-ink);
  --muted: var(--color-paper-2);     --muted-foreground: var(--color-ink-soft);
  --accent: var(--color-ochre-soft); --accent-foreground: var(--color-ochre-ink);
  --destructive: var(--color-rose);
  --border: var(--color-line); --input: var(--color-line); --ring: var(--color-ultra);
  --radius: 1rem;

  --chart-1: var(--color-sienna);
  --chart-2: var(--color-ochre);
  --chart-3: var(--color-sage);
  --chart-4: var(--color-ultra);
  --chart-5: var(--color-rose);

  --sidebar: var(--color-canvas);
  --sidebar-foreground: var(--color-ink);
  --sidebar-primary: var(--color-sienna);
  --sidebar-primary-foreground: #fff;
  --sidebar-accent: var(--color-paper-2);
  --sidebar-accent-foreground: var(--color-ink);
  --sidebar-border: var(--color-line);
  --sidebar-ring: var(--color-ultra);
}

html {
  direction: rtl;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  body {
    @apply bg-background text-foreground;
  }

  body {
    font-family: var(--font-sans);
  }

  /* DESIGN.md §15: visible focus, 2.5px ultra outline. */
  :focus-visible {
    outline: 2.5px solid var(--color-ultra);
    outline-offset: 2px;
  }

  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

/* Utils */
@layer utilities {
  .bg-secondary-20 {
    background-color: var(--color-ultra-soft);
  }

  .border-secondary-30 {
    border-color: var(--color-line);
  }
  @keyframes livepulse {

    0%,
    100% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.12);
    }
  }

  .animate-livepulse {
    animation: livepulse 1.2s ease-in-out infinite;
  }
}

/* Fonts */

.font-regular {
  font-family: var(--font-sans);
  font-weight: 400;
}

/* React Tel Input */
.react-tel-input,
.react-tel-input * {
  direction: ltr !important;
  text-align: left !important;
}

.react-tel-input .form-control {
  direction: ltr !important;
  text-align: left !important;
}

/* Scrollbar */
.my-soft-scrollbar::-webkit-scrollbar {
  height: 8px;
  background: transparent;
}

.my-soft-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(110, 97, 87, 0.25);
  /* Light soft blue with low opacity */
  border-radius: 9999px;
  transition: background-color 0.3s ease;
}

.my-soft-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(110, 97, 87, 0.5);
  /* Slightly darker on hover */
}

/* For Firefox */
.my-soft-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 97, 87, 0.25) transparent;
}

.my-soft-scrollbar:hover {
  scrollbar-color: rgba(110, 97, 87, 0.5) transparent;
}

/* WebKit browsers (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
  width: 0px;
  /* removes visual space */
  height: 0px;
  /* horizontal scrollbar */
  background: transparent;
  /* no track */
}

::-webkit-scrollbar-thumb {
  background: transparent;
  /* no thumb */
}

/* Firefox */
* {
  scrollbar-width: none;
  /* removes scrollbar but keeps scroll ability */
}

@keyframes pulse-custom {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

.animate-pulse-custom {
  animation: pulse-custom 1.3s ease-in-out infinite;
}

/* Video Player */
.video-js,
.video-js * {
  direction: ltr !important;
}

.video-js .vjs-progress-control {
  direction: ltr !important;
}

.video-js .vjs-error-display {
  direction: rtl;
  font-family: var(--font-sans);
}

.video-js .vjs-modal-dialog-content {
  text-align: center;
}

.video-js .rangook-quality,
.video-js .rangook-quality *,
.video-js .rangook-watermark {
  font-family: var(--font-sans);
}

.video-js .rangook-quality,
.video-js .rangook-quality * {
  direction: rtl !important;
}

/* DESIGN.md §10: prefers-reduced-motion collapses every animation. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* The code boxes' caret (login). */
@keyframes caret-blink {
  0%, 70%, 100% { opacity: 1; }
  20%, 50% { opacity: 0; }
}
.animate-caret-blink { animation: caret-blink 1.2s ease-out infinite; }
