/* terms.css - Official Terms & Conditions Styles for Atom Tournament */

:root {
  --terms-container-width: 1320px;
  --terms-content-max: 880px;
  --terms-line-height: 1.95;
  --terms-heading-color: #ffffff;
  --terms-text-color: rgba(254, 254, 254, 0.88);
  --terms-muted-color: #94a3b8;
  --terms-card-bg: rgba(30, 41, 59, 0.72);
  --terms-card-border: rgba(255, 255, 255, 0.08);
  --terms-card-hover-border: rgba(0, 245, 255, 0.35);
  --terms-primary: var(--color-primary, #00f5ff);
  --terms-accent: var(--accent-secondary, #8961ff);
  --terms-nav-width: 320px;
  --terms-header-offset: 96px;
}

/* Page wrapper & Layout */
.terms-page-wrapper {
  min-height: 100vh;
  background-color: var(--background-color, #0f172a);
  color: var(--terms-text-color);
  font-family: Peyda, IRANSansX, Vazirmatn, sans-serif;
  direction: rtl;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* Background Ambient Glows */
.terms-bg-glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  z-index: 0;
}

.terms-bg-glow--top {
  top: -100px;
  right: -80px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, var(--terms-primary) 0%, transparent 70%);
}

.terms-bg-glow--mid {
  top: 40%;
  left: -120px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--terms-accent) 0%, transparent 70%);
  opacity: 0.12;
}

.terms-container {
  width: min(var(--terms-container-width), calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Breadcrumbs */
.terms-breadcrumb-nav {
  padding: 24px 0 16px;
}

.terms-breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--terms-muted-color);
  flex-wrap: wrap;
}

.terms-breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terms-breadcrumb-link {
  color: var(--terms-muted-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.terms-breadcrumb-link:hover,
.terms-breadcrumb-link:focus-visible {
  color: var(--terms-primary);
}

.terms-breadcrumb-sep {
  opacity: 0.4;
  font-size: 11px;
}

.terms-breadcrumb-current {
  color: var(--white-color, #ffffff);
  font-weight: 500;
}

/* Hero Section */
.terms-hero-card {
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.85) 0%,
    rgba(15, 23, 42, 0.95) 100%
  );
  border: 1px solid var(--terms-card-border);
  border-radius: 24px;
  padding: 36px 40px;
  margin-bottom: 36px;
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.terms-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--terms-primary) 50%,
    transparent 100%
  );
}

.terms-hero-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.terms-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.3);
  color: var(--terms-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.terms-hero-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.terms-page-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  color: var(--terms-heading-color);
  line-height: 1.45;
  margin: 0;
}

.terms-page-description {
  font-size: clamp(14px, 2vw, 15.5px);
  line-height: 1.8;
  color: rgba(254, 254, 254, 0.78);
  margin: 0;
  max-width: 860px;
}

/* Metadata Grid */
.terms-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 24px;
}

.terms-metadata-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.terms-metadata-label {
  font-size: 12px;
  color: var(--terms-muted-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.terms-metadata-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
  color: var(--terms-primary);
}

.terms-metadata-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--white-color, #ffffff);
}

.terms-metadata-value--placeholder {
  color: #fbbf24;
  font-style: italic;
  font-weight: 500;
}

/* Hero Action Bar */
.terms-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.terms-quick-note {
  font-size: 12.5px;
  color: var(--terms-muted-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile Quick TOC Toggle Bar */
.terms-mobile-toc-bar {
  display: none;
  position: sticky;
  top: 72px;
  z-index: 40;
  margin-bottom: 24px;
}

.terms-mobile-toc-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 14px;
  color: var(--white-color, #ffffff);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  font-family: inherit;
  transition: all 0.2s ease;
}

.terms-mobile-toc-toggle-btn:focus-visible {
  outline: 2px solid var(--terms-primary);
}

.terms-mobile-toc-toggle-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terms-mobile-toc-toggle-text svg {
  color: var(--terms-primary);
}

.terms-mobile-toc-arrow {
  transition: transform 0.3s ease;
}

.terms-mobile-toc-bar.is-open .terms-mobile-toc-arrow {
  transform: rotate(180deg);
}

.terms-mobile-toc-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  z-index: 50;
}

.terms-mobile-toc-bar.is-open .terms-mobile-toc-dropdown {
  display: block;
}

/* Main Layout Grid (Content + Sidebar) */
.terms-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--terms-nav-width);
  gap: 36px;
  align-items: start;
}

/* Table of Contents Sidebar (Desktop) */
.terms-sidebar-wrapper {
  position: sticky;
  top: var(--terms-header-offset);
  max-height: calc(100vh - var(--terms-header-offset) - 32px);
  display: flex;
  flex-direction: column;
}

.terms-toc-card {
  background: var(--terms-card-bg);
  border: 1px solid var(--terms-card-border);
  border-radius: 20px;
  padding: 20px 18px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.3);
}

.terms-toc-header {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.terms-toc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white-color, #ffffff);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

.terms-toc-title-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terms-toc-title-text svg {
  color: var(--terms-primary);
}

.terms-toc-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.12);
  color: var(--terms-primary);
}

.terms-toc-nav {
  overflow-y: auto;
  padding-left: 4px;
  padding-right: 2px;
  margin-top: 4px;
  max-height: calc(100vh - 280px);
}

.terms-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terms-toc-item {
  position: relative;
}

.terms-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.terms-toc-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--terms-muted-color);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.terms-toc-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white-color, #ffffff);
}

.terms-toc-link:hover .terms-toc-num-badge {
  background: rgba(0, 245, 255, 0.15);
  color: var(--terms-primary);
}

.terms-toc-link.is-active {
  background: rgba(0, 245, 255, 0.12);
  color: var(--terms-primary);
  font-weight: 600;
}

.terms-toc-link.is-active .terms-toc-num-badge {
  background: var(--terms-primary);
  color: #0b1120;
}

.terms-toc-link:focus-visible {
  outline: 2px solid var(--terms-primary);
}

/* Legal Content Body */
.terms-content-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0; /* Prevents flex children blowout */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Preamble Card */
.terms-preamble-card {
  background: var(--terms-card-bg);
  border: 1px solid var(--terms-card-border);
  border-radius: 20px;
  padding: 28px 32px;
  backdrop-filter: blur(10px);
}

.terms-preamble-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: var(--terms-line-height);
  color: rgba(255, 255, 255, 0.85);
}

/* Article Card */
.terms-article-card {
  background: var(--terms-card-bg);
  border: 1px solid var(--terms-card-border);
  border-radius: 20px;
  padding: 32px 36px;
  backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  scroll-margin-top: calc(var(--terms-header-offset) + 16px);
  position: relative;
}

.terms-article-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

/* Article Header */
.terms-article-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.terms-article-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 240px;
}

.terms-article-num-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(137, 97, 255, 0.15));
  border: 1px solid rgba(0, 245, 255, 0.35);
  color: var(--terms-primary);
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.terms-article-title {
  font-size: clamp(17px, 2.5vw, 20px);
  font-weight: 700;
  color: var(--terms-heading-color);
  line-height: 1.45;
  margin: 0;
}

/* Article Body Typography (Preserves 100% of exact text) */
.terms-article-body {
  font-size: 15px;
  line-height: var(--terms-line-height);
  color: var(--terms-text-color);
}

.terms-article-body p {
  margin: 0 0 16px 0;
}

.terms-article-body p:last-child {
  margin-bottom: 0;
}

.terms-article-body strong {
  color: var(--white-color, #ffffff);
  font-weight: 700;
}

.terms-article-body ul,
.terms-article-body ol {
  margin: 12px 0 16px 0;
  padding-right: 28px;
  padding-left: 0;
}

.terms-article-body li {
  margin-bottom: 10px;
  line-height: var(--terms-line-height);
}

.terms-article-body li:last-child {
  margin-bottom: 0;
}

.terms-article-body a {
  color: var(--terms-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s ease;
}

.terms-article-body a:hover {
  color: #38f8ff;
}

/* Contact Info Section inside Article 25 or general */
.terms-article-body ul li:has(strong) {
  list-style: none;
}

/* Floating Back to Top Button */
.terms-back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(0, 245, 255, 0.35);
  color: var(--terms-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.85);
  transition: all 0.25s ease;
}

.terms-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.terms-back-to-top:hover {
  background: var(--terms-primary);
  color: #0b1120;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 28px rgba(0, 245, 255, 0.4);
}

.terms-back-to-top:focus-visible {
  outline: 2px solid var(--terms-primary);
  outline-offset: 2px;
}

.terms-back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* 1024px to 1439px: Desktop Standard */
@media (max-width: 1200px) {
  :root {
    --terms-nav-width: 280px;
  }
}

/* 768px to 1023px: Tablet */
@media (max-width: 1024px) {
  :root {
    --terms-header-offset: 80px;
  }

  .terms-main-grid {
    grid-template-columns: 1fr;
  }

  .terms-sidebar-wrapper {
    display: none; /* Mobile/tablet uses floating toggle */
  }

  .terms-mobile-toc-bar {
    display: block;
  }

  .terms-hero-card {
    padding: 30px 24px;
    border-radius: 20px;
  }

  .terms-article-card {
    padding: 26px 24px;
  }
}

/* Large Mobile (431px to 767px) */
@media (max-width: 768px) {
  .terms-container {
    width: min(100%, calc(100% - 24px));
  }

  .terms-hero-card {
    padding: 24px 18px;
    margin-bottom: 24px;
  }

  .terms-metadata-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .terms-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .terms-quick-note {
    justify-content: center;
  }

  .terms-article-card {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .terms-article-num-indicator {
    min-width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .terms-article-title-wrap {
    gap: 10px;
  }

  .terms-article-body {
    font-size: 14px;
  }
}

/* Small Mobile (320px to 430px) */
@media (max-width: 430px) {
  .terms-container {
    width: min(100%, calc(100% - 16px));
  }

  .terms-hero-card {
    padding: 20px 14px;
    border-radius: 14px;
  }

  .terms-article-card {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .terms-article-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .terms-article-body ul,
  .terms-article-body ol {
    padding-right: 20px;
  }

  .terms-back-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 12pt !important;
    line-height: 1.6 !important;
    direction: rtl !important;
  }

  header,
  footer,
  .terms-bg-glow,
  .terms-sidebar-wrapper,
  .terms-mobile-toc-bar,
  .terms-hero-actions,
  .terms-back-to-top,
  .terms-breadcrumb-nav {
    display: none !important;
  }

  .terms-page-wrapper {
    background: transparent !important;
    padding: 0 !important;
  }

  .terms-container {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .terms-hero-card {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 0 20pt 0 !important;
    margin-bottom: 20pt !important;
    border-bottom: 2pt solid #111827 !important;
  }

  .terms-page-title {
    color: #000000 !important;
    font-size: 20pt !important;
  }

  .terms-metadata-grid {
    background: none !important;
    border: 1pt solid #cbd5e1 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8pt !important;
    padding: 10pt !important;
  }

  .terms-metadata-label {
    color: #475569 !important;
    font-size: 9pt !important;
  }

  .terms-metadata-value {
    color: #000000 !important;
    font-size: 10pt !important;
  }

  .terms-article-card {
    background: none !important;
    border: none !important;
    border-bottom: 1pt solid #e2e8f0 !important;
    border-radius: 0 !important;
    padding: 16pt 0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .terms-article-title {
    color: #000000 !important;
    font-size: 14pt !important;
  }

  .terms-article-num-indicator {
    background: none !important;
    border: 1pt solid #000000 !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .terms-article-body {
    color: #1f2937 !important;
    font-size: 10.5pt !important;
  }

  .terms-article-body strong {
    color: #000000 !important;
  }

  .terms-article-body a {
    color: #000000 !important;
    text-decoration: underline !important;
  }
}
