/* ============================================
   Equantu Setup Guide - Main Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
  --color-primary: #0d9488;
  --color-primary-dark: #0f766e;
  --color-primary-darker: #115e59;
  --color-primary-light: #5eead4;
  --color-primary-bg: #f0fdfa;
  --color-primary-surface: #ccfbf1;

  --color-bg: #f8fafb;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  --max-width: 1200px;
  --header-height: 68px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
  font-family: var(--font-arabic);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button, select {
  font-family: inherit;
  cursor: pointer;
}

/* --- Loading --- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  height: var(--header-height);
}

.header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__logo {
  height: 36px;
  width: auto;
}

.header__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Language Selector --- */
.lang-selector {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.22 4.47a.75.75 0 0 1 1.06 0L6 7.19l2.72-2.72a.75.75 0 0 1 1.06 1.06L6.53 8.78a.75.75 0 0 1-1.06 0L2.22 5.53a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 140px;
}

[dir="rtl"] .lang-selector {
  padding: 8px 12px 8px 32px;
  background-position: left 10px center;
}

.lang-selector:hover {
  border-color: var(--color-primary-light);
}

.lang-selector:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* --- Main --- */
.main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* --- Page Transitions --- */
.page-enter {
  animation: pageIn 0.35s ease forwards;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Home Page - Model Grid
   ============================================ */
.home-hero {
  text-align: center;
  padding: 48px 0 40px;
}

.home-hero__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.home-hero__subtitle {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding-bottom: 64px;
}

/* --- Model Card --- */
.model-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.model-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.model-card:active {
  transform: translateY(-2px);
}

.model-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-border-light);
}

.model-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.model-card:hover .model-card__image img {
  transform: scale(1.05);
}

.model-card__info {
  padding: 16px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-card__name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
}

.model-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--color-primary-bg);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.model-card:hover .model-card__btn {
  background: var(--color-primary);
  color: #fff;
}

.model-card__btn-arrow {
  transition: transform var(--transition);
  font-size: 1rem;
}

[dir="rtl"] .model-card__btn-arrow {
  transform: scaleX(-1);
}

.model-card:hover .model-card__btn-arrow {
  transform: translateX(2px);
}

[dir="rtl"] .model-card:hover .model-card__btn-arrow {
  transform: scaleX(-1) translateX(2px);
}

/* ============================================
   Guide Page
   ============================================ */
.guide-page {
  padding-bottom: 64px;
}

/* --- Back Button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 12px 0;
  margin-top: 16px;
  transition: color var(--transition);
}

.back-btn:hover {
  color: var(--color-primary);
}

.back-btn__icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition);
}

[dir="rtl"] .back-btn__icon {
  transform: scaleX(-1);
}

.back-btn:hover .back-btn__icon {
  transform: translateX(-3px);
}

[dir="rtl"] .back-btn:hover .back-btn__icon {
  transform: scaleX(-1) translateX(-3px);
}

/* --- Guide Header --- */
.guide-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px 0 40px;
}

.guide-header__image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  background: var(--color-border-light);
}

.guide-header__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guide-header__info {
  flex: 1;
}

.guide-header__model {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.025em;
}

.guide-header__label {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* --- Steps --- */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step {
  display: flex;
  gap: 24px;
  position: relative;
}

.step__indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 48px;
}

.step__number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.step__line {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, var(--color-primary-light), var(--color-border));
  margin: 8px 0;
}

.step:last-child .step__line {
  display: none;
}

.step__content {
  flex: 1;
  padding-bottom: 40px;
  min-width: 0;
}

.step:last-child .step__content {
  padding-bottom: 0;
}

.step__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  letter-spacing: -0.015em;
}

.step__desc {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
}

/* --- Video Container --- */
.video-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
  margin-bottom: 4px;
}

.video-container video {
  width: 100%;
  display: block;
}

.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.video-placeholder__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-placeholder__icon svg {
  width: 24px;
  height: 24px;
  opacity: 0.4;
}

.video-placeholder__text {
  font-size: 0.9375rem;
  font-weight: 500;
}

/* --- Download Section --- */
.download-section {
  margin-top: 24px;
  background: var(--color-primary-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid rgba(13, 148, 136, 0.1);
}

.download-section__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
}

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
  border: none;
  cursor: pointer;
}

.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn--appstore {
  background: #000;
  color: #fff;
}

.download-btn--googleplay {
  background: #1a73e8;
  color: #fff;
}

.download-btn--apk {
  background: #3ddc84;
  color: #1b3a2d;
}

.download-btn__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.download-btn__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.download-btn__label {
  font-size: 0.6875rem;
  font-weight: 400;
  opacity: 0.85;
}

.download-btn__name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.download-hint {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  text-align: center;
}

.footer__logo {
  height: 28px;
  width: auto;
  margin: 0 auto 12px;
  opacity: 0.5;
}

.footer__text {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.footer__tagline {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* ============================================
   Welcome Page (China IP Block)
   ============================================ */
.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-bg) 0%, #fff 50%, var(--color-primary-bg) 100%);
}

.welcome-card {
  text-align: center;
  padding: 60px 40px;
}

.welcome-card__logo {
  height: 64px;
  width: auto;
  margin: 0 auto 24px;
}

.welcome-card__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
}

.welcome-card__text {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .model-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  .model-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .home-hero {
    padding: 32px 0 28px;
  }

  .home-hero__title {
    font-size: 1.625rem;
  }

  .home-hero__subtitle {
    font-size: 0.9375rem;
  }

  .guide-header {
    padding: 20px 0 28px;
  }

  .guide-header__model {
    font-size: 1.5rem;
  }

  .step {
    gap: 16px;
  }

  .step__indicator {
    width: 40px;
  }

  .step__number {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .step__title {
    font-size: 1.1875rem;
  }

  .download-buttons {
    flex-direction: column;
  }

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

@media (max-width: 480px) {
  .main {
    padding: 0 16px;
  }

  .header__inner {
    padding: 0 16px;
  }

  .model-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .model-card__info {
    padding: 12px 14px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .model-card__name {
    font-size: 0.9375rem;
  }

  .guide-header {
    gap: 16px;
  }

  .guide-header__image {
    width: 60px;
    height: 60px;
  }

  .guide-header__model {
    font-size: 1.25rem;
  }

  .step__content {
    padding-bottom: 28px;
  }

  .download-section {
    padding: 16px;
  }

  .lang-selector {
    min-width: 110px;
    font-size: 0.8125rem;
  }

  .footer__inner {
    padding: 24px 16px;
  }
}

/* ============================================
   RTL Overrides
   ============================================ */
[dir="rtl"] .model-card__info {
  flex-direction: row-reverse;
}

[dir="rtl"] .guide-header {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .step {
  flex-direction: row-reverse;
}

[dir="rtl"] .step__content {
  text-align: right;
}

[dir="rtl"] .download-buttons {
  direction: rtl;
}

@media (max-width: 480px) {
  [dir="rtl"] .model-card__info {
    align-items: flex-end;
  }
}

/* ============================================
   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-width: 0;
}
