/**
 * YasTV Main CSS - Design System & Core Styles
 * Netflix-inspired VOD platform styling
 */

@import url('./video-catalog-cards.css');
@import url('./content-stable.css');

/* CSS Custom Properties (Design System) */
:root {
  /* Netflix-inspired Color Palette */
  --color-primary: #E50914;        /* Netflix Red */
  --color-primary-dark: #B20710;   /* Darker Red */
  --color-primary-light: #F40612;  /* Lighter Red */
  
  --color-background: #141414;     /* Dark Background */
  --color-surface: #1F1F1F;       /* Card/Surface Background */
  --color-surface-elevated: #2F2F2F; /* Elevated Surface */
  
  --color-text-primary: #FFFFFF;   /* Primary Text */
  --color-text-secondary: #B3B3B3; /* Secondary Text */
  --color-text-muted: #808080;     /* Muted Text */
  
  --color-success: #46D369;        /* Success Green */
  --color-warning: #FFB800;        /* Warning Yellow */
  --color-error: #E87C03;          /* Error Orange */
  --color-info: #0099E0;           /* Info Blue */
  
  /* Gradients */
  --gradient-hero: linear-gradient(77deg, rgba(0,0,0,0.6) 0%, transparent 85%);
  --gradient-card: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%);
  --gradient-primary: linear-gradient(45deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  
  /* Typography */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-persian: 'Ravi', 'Tahoma', sans-serif;
  --font-family-display: 'Inter', sans-serif;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */
  --font-size-6xl: 3.75rem;   /* 60px */
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  
  /* Spacing System */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 0.75rem;   /* 12px */
  --spacing-lg: 1rem;      /* 16px */
  --spacing-xl: 1.5rem;    /* 24px */
  --spacing-2xl: 2rem;     /* 32px */
  --spacing-3xl: 2.5rem;   /* 40px */
  --spacing-4xl: 3rem;     /* 48px */
  --spacing-5xl: 4rem;     /* 64px */
  --spacing-6xl: 5rem;     /* 80px */
  
  /* Border Radius */
  --radius-sm: 0.125rem;   /* 2px */
  --radius-md: 0.25rem;    /* 4px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-modal: 1010;
  --z-popover: 1020;
  --z-tooltip: 1030;
  --z-toast: 1040;
}

/* CSS Reset & Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-normal);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Persian/RTL — font on body only; avoid `body.rtl *` (breaks metrics, icons, and causes layout jank) */
body.rtl {
  direction: rtl;
  font-family: var(--font-family-persian);
}

/* Headings use --font-family-display by default; in RTL use Persian stack */
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6 {
  font-family: var(--font-family-persian);
}

/* Focus Styles */
:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Selection Styles */
::selection {
  background-color: var(--color-primary);
  color: var(--color-text-primary);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-text-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
}

h1 {
  font-size: var(--font-size-5xl);
}

h2 {
  font-size: var(--font-size-4xl);
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
}

p {
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-light);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-bottom: var(--spacing-lg);
  padding-left: var(--spacing-xl);
}

body.rtl ul,
body.rtl ol {
  padding-left: 0;
  padding-right: var(--spacing-xl);
}

li {
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-secondary);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Form Elements Base */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden !important;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--spacing-2xl);
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0 var(--spacing-3xl);
  }
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.p-0 { padding: 0; }
.pt-0 { padding-top: 0; }

/* Fixed navbar offset — same shell as home (index + entry-shell pages), exclude auth */
body.layout-main:not(.auth-page) > main#main-content,
body.layout-player > main#main-content {
  padding-top: 68px;
  min-height: calc(100vh - 68px);
  box-sizing: border-box;
}

/* Full-bleed Video.js page inside SPA (navbar hidden via router) */
body.layout-video-player > main#main-content {
  padding-top: 0 !important;
  min-height: 100vh !important;
}
.pb-0 { padding-bottom: 0; }
.pl-0 { padding-left: 0; }
.pr-0 { padding-right: 0; }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

body.rtl:not(.auth-page) .text-left { text-align: right; }
body.rtl:not(.auth-page) .text-right { text-align: left; }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-primary); }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Loading States */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 640px) {
  :root {
    --font-size-5xl: 2.25rem; /* Smaller on mobile */
    --font-size-4xl: 1.875rem;
    --font-size-3xl: 1.5rem;
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --color-text-secondary: #E0E0E0;
    --color-text-muted: #C0C0C0;
  }
}

/* Reduced Motion Support */
@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;
  }
}