@import url('fonts.css');

/* ==========================================================================
   CSS DESIGN TOKENS & THEME VARIABLES
   ========================================================================== */
:root {
  color-scheme: light;

  /* Typography Tokens */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Nirmala UI', 'Noto Sans Devanagari', 'Noto Sans Arabic', Tahoma, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Nirmala UI', 'Noto Sans Devanagari', 'Noto Sans Arabic', Tahoma, sans-serif;
  --font-family: var(--font-body);

  --font-size-base: 1.0625rem; /* ~17px desktop standard */
  --line-height-base: 1.68;

  /* Vibrant Light Theme Colors */
  --bg-primary: #fafcff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f4ff;
  --bg-card-alt: #fdf4ff;
  --bg-hero: radial-gradient(120% 120% at 50% -10%, rgba(99, 102, 241, 0.12) 0%, rgba(236, 72, 153, 0.08) 45%, rgba(250, 252, 255, 0) 80%);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  /* Brand Colors & Gradients */
  --brand-primary: #6366f1;
  --brand-primary-hover: #4f46e5;
  --brand-accent: #ec4899;
  --brand-accent-hover: #db2777;
  --brand-warm: #f59e0b;

  --accent-color: var(--brand-primary);
  --accent-hover: var(--brand-primary-hover);
  --accent-light: #ede9fe;
  --accent-light-rgb: 237, 233, 254;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 48%, #ec4899 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 48%, #db2777 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(236, 72, 153, 0.08) 100%);

  --btn-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  --btn-shadow-hover: 0 8px 24px rgba(99, 102, 241, 0.45);

  --success-color: #059669;
  --success-bg: #ecfdf5;
  --danger-color: #e11d48;
  --danger-bg: #fff1f2;
  --warning-color: #d97706;
  --warning-bg: #fffbeb;

  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-focus: #6366f1;

  --shadow-sm: 0 2px 4px 0 rgba(15, 23, 42, 0.04), 0 1px 2px 0 rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 35px -6px rgba(15, 23, 42, 0.1), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
  --card-glow: 0 10px 30px -10px rgba(99, 102, 241, 0.15);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-3xl: 1.75rem;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   DARK THEME TOKENS
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;

  /* Dark Theme Colors */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2234;
  --bg-card-alt: #161f30;
  --bg-hero: radial-gradient(120% 120% at 50% -10%, rgba(129, 140, 248, 0.18) 0%, rgba(244, 114, 182, 0.1) 45%, rgba(11, 15, 25, 0) 80%);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --brand-primary: #818cf8;
  --brand-primary-hover: #6366f1;
  --brand-accent: #f472b6;
  --brand-accent-hover: #ec4899;
  --brand-warm: #fbbf24;

  --accent-color: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.18);
  --accent-light-rgb: 99, 102, 241;
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a855f7 48%, #f472b6 100%);
  --accent-gradient-hover: linear-gradient(135deg, #6366f1 0%, #9333ea 48%, #ec4899 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(129, 140, 248, 0.12) 0%, rgba(244, 114, 182, 0.1) 100%);

  --btn-shadow: 0 4px 20px rgba(129, 140, 248, 0.3);
  --btn-shadow-hover: 0 8px 28px rgba(129, 140, 248, 0.45);

  --success-color: #34d399;
  --success-bg: rgba(16, 185, 129, 0.14);
  --danger-color: #fb7185;
  --danger-bg: rgba(244, 63, 94, 0.14);
  --warning-color: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.14);

  --border-color: #1e293b;
  --border-color-hover: #334155;
  --border-focus: #818cf8;

  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 35px -6px rgba(0, 0, 0, 0.6);
  --card-glow: 0 10px 30px -10px rgba(129, 140, 248, 0.25);
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  word-spacing: normal;
}

h1 {
  font-size: clamp(2.35rem, 4.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  word-spacing: normal;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  font-weight: 800;
  line-height: 1.25;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 700;
}

h4 {
  font-size: 1.15rem;
  font-weight: 700;
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .navbar {
  background-color: rgba(11, 15, 25, 0.85);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.75rem;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  text-decoration: none;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-icon {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 6px rgba(224, 19, 89, 0.35));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
  padding: 0.35rem 0;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-color);
  font-weight: 700;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme Toggle Button */
.theme-toggle {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.55rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--accent-color);
  background-color: var(--accent-light);
  border-color: var(--accent-color);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 1.3rem;
  height: 1.3rem;
}

/* Language Dropdown Selector */
.lang-select {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  color-scheme: light dark;
}

[data-theme="dark"] .lang-select {
  color-scheme: dark;
}

[data-theme="light"] .lang-select {
  color-scheme: light;
}

.lang-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.lang-select:hover {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
}

.lang-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-xl);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  line-height: 1.3;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff !important;
  box-shadow: var(--btn-shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: var(--btn-shadow-hover);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--btn-shadow);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--brand-primary);
  color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-danger {
  background-color: var(--danger-color);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3);
}

.btn-danger:hover {
  background-color: #be123c;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.45);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero {
  padding: 6.5rem 0 4.5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
  width: 50rem;
  height: 40rem;
  background: var(--bg-hero);
  z-index: -1;
  pointer-events: none;
  filter: blur(20px);
}

.hero h1 {
  margin-bottom: 1.5rem;
  max-width: 55rem;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 span, .hero-title-highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-pitch {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 44rem;
  margin: 0 auto 2.75rem auto;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

/* ==========================================================================
   TRUST & FEATURE CARDS
   ========================================================================== */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.trust-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 2.25rem;
  text-align: left;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.trust-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.trust-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl), var(--card-glow);
  border-color: rgba(99, 102, 241, 0.4);
}

.trust-card:hover::before {
  opacity: 1;
}

.trust-icon-box {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-xl);
  background: var(--accent-gradient-subtle);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(99, 102, 241, 0.15);
  transition: all var(--transition-normal);
}

.trust-card:hover .trust-icon-box {
  background: var(--accent-gradient);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

.trust-icon-box svg {
  width: 1.75rem;
  height: 1.75rem;
}

.trust-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.trust-card p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ==========================================================================
   TOOL VIEW & TABS CONTAINER
   ========================================================================== */
.tabs-container {
  margin: 0.75rem 0 2rem 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-lg), var(--card-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tabs-header {
  display: flex;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.35rem 0.35rem 0 0.35rem;
  gap: 0.35rem;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  white-space: nowrap;
}

.tab-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--accent-color);
  background-color: var(--bg-secondary);
  position: relative;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.tab-btn.active svg {
  transform: scale(1.1);
  color: var(--brand-accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient);
}

.tabs-content {
  padding: 1.5rem;
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-secondary);
}

.tab-panel {
  display: none;
  flex-direction: column;
  flex-grow: 1;
}

.tab-panel.active {
  display: flex;
}

/* ==========================================================================
   DRAG & DROP DROPZONE
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-color);
  background: var(--accent-light);
  transform: scale(1.008);
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.dropzone-icon {
  width: 3rem;
  height: 3rem;
  color: var(--brand-primary);
  margin-bottom: 0.75rem;
  transition: all var(--transition-normal);
  filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.25));
}

.dropzone:hover .dropzone-icon {
  transform: translateY(-4px) scale(1.08);
  color: var(--brand-accent);
}

.dropzone p {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dropzone span {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.file-input {
  display: none;
}

/* ==========================================================================
   MERGE FILE LIST
   ========================================================================== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.75rem 0;
  max-height: 22rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.file-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  transition: all var(--transition-fast);
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.file-item:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

.file-item:active {
  cursor: grabbing;
}

.file-item.dragging {
  opacity: 0.45;
  border: 2px dashed var(--accent-color);
  background-color: var(--accent-light);
}

.file-info-container {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: 1;
  min-width: 0;
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0.25rem;
}

.drag-handle:hover {
  color: var(--text-primary);
}

.drag-handle svg {
  width: 1.35rem;
  height: 1.35rem;
}

.file-icon {
  color: var(--danger-color);
  display: flex;
  align-items: center;
}

.file-icon svg {
  width: 2rem;
  height: 2rem;
}

.file-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.2rem;
}

.file-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.file-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.6rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-remove:hover {
  color: var(--danger-color);
  background-color: var(--danger-bg);
  transform: scale(1.1);
}

.btn-remove svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ==========================================================================
   PAGE PREVIEWS WORKSPACE (SPLIT, REORDER, ROTATE)
   ========================================================================== */
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.workspace-title {
  font-size: 1.3rem;
  font-weight: 800;
}

.workspace-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

.page-card {
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.85rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.page-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.page-card.dragging {
  opacity: 0.4;
  border: 2px dashed var(--brand-primary);
}

/* Selected state for split/extract & rotate */
.page-card.selected {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3), var(--shadow-md);
  background-color: var(--accent-light);
}

.page-checkbox {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  transition: all var(--transition-fast);
  z-index: 10;
}

.page-card.selected .page-checkbox {
  background: var(--accent-gradient);
  border-color: transparent;
}

.page-checkbox svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: #ffffff;
  stroke-width: 3.5;
  display: none;
}

.page-card.selected .page-checkbox svg {
  display: block;
}

/* Delete button for reorder */
.page-delete-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

[data-theme="dark"] .page-delete-btn {
  background-color: rgba(30, 41, 59, 0.95);
}

.page-delete-btn:hover {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: #ffffff;
  transform: scale(1.15);
}

.page-delete-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* Rotate overlay button */
.page-rotate-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

[data-theme="dark"] .page-rotate-btn {
  background-color: rgba(30, 41, 59, 0.95);
}

.page-rotate-btn:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  transform: scale(1.15) rotate(45deg);
}

.page-rotate-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

.page-thumb-container {
  width: 100%;
  aspect-ratio: 3/4;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.06);
}

.page-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.page-number {
  margin-top: 0.85rem;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.page-angle-badge {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--accent-light);
  color: var(--accent-color);
  pointer-events: none;
  z-index: 5;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.rotate-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-xl);
  margin-bottom: 1.5rem;
}

.rotated-90 {
  transform: rotate(90deg) scale(0.75) !important;
}

.rotated-180 {
  transform: rotate(180deg) !important;
}

.rotated-270 {
  transform: rotate(270deg) scale(0.75) !important;
}

.action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

/* ==========================================================================
   WATERMARK FEATURE LAYOUT & STYLES
   ========================================================================== */
.watermark-main-container {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 2rem;
  margin-top: 1.75rem;
  align-items: start;
}

@media (max-width: 980px) {
  .watermark-main-container {
    grid-template-columns: 1fr;
  }
}

.watermark-controls-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.watermark-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-number-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-number-wrap input {
  padding-right: 2.25rem;
  width: 100%;
}

.input-unit {
  position: absolute;
  right: 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.color-picker-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.4rem 0.75rem;
  height: 44px;
}

.color-input-field {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-hex-text {
  font-family: monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.segmented-control {
  display: flex;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.3rem;
  gap: 0.3rem;
}

.segment-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}

.segment-btn:hover {
  color: var(--text-primary);
}

.segment-btn.active {
  background-color: var(--bg-secondary);
  color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.watermark-preview-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
}

.watermark-preview-stage {
  padding: 2.25rem;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  background-image: radial-gradient(var(--border-color) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  overflow: auto;
}

.watermark-canvas-container {
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wm-preview-canvas {
  display: block;
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-control {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 0.98rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-color);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.form-range {
  width: 100%;
  accent-color: var(--accent-color);
  cursor: pointer;
  height: 6px;
}

/* ==========================================================================
   LOADING & ALERTS
   ========================================================================== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius-3xl);
  transition: background-color var(--transition-normal);
}

[data-theme="dark"] .loading-overlay {
  background-color: rgba(11, 15, 25, 0.88);
}

.spinner {
  width: 3.5rem;
  height: 3.5rem;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 1.25rem;
}

.loading-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.alert {
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-xl);
  margin-bottom: 1.5rem;
  display: none;
  align-items: flex-start;
  gap: 0.85rem;
  border: 1px solid transparent;
  animation: fadeIn 0.3s ease;
}

.alert-danger {
  background-color: var(--danger-bg);
  border-color: rgba(225, 29, 72, 0.2);
  color: var(--danger-color);
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.alert-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.alert-message {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.alert-close:hover {
  opacity: 1;
}

.alert-close svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* ==========================================================================
   HOW IT WORKS STEPS TIMELINE
   ========================================================================== */
.steps-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2.25rem;
  margin: 3.5rem 0;
  position: relative;
}

.step-item {
  position: relative;
  text-align: left;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.step-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--card-glow);
  border-color: var(--brand-primary);
}

.step-num {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.step-item h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.step-item p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ==========================================================================
   FAQ SECTION & CARDS
   ========================================================================== */
.faq-section {
  margin-top: 4.5rem;
}

.faq-title {
  text-align: center;
  margin-bottom: 2.5rem;
}

.faq-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 48rem;
  margin: 0 auto;
}

.faq-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.faq-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.faq-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.faq-card:hover::before {
  opacity: 1;
}

.faq-card h4 {
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
}

.faq-card p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.7;
}

/* ==========================================================================
   ABOUT CONTENT STYLING
   ========================================================================== */
.about-section {
  max-width: 48rem;
  margin: 3.5rem auto;
  text-align: center;
}

.about-title {
  margin-bottom: 1.5rem;
}

.about-text {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.75;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background-color: var(--success-bg);
  color: var(--success-color);
  padding: 1rem 2.25rem;
  border-radius: var(--radius-3xl);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  border: 1px solid rgba(5, 150, 105, 0.25);
  margin-bottom: 2.75rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.15);
}

.privacy-badge svg {
  width: 1.6rem;
  height: 1.6rem;
}

/* ==========================================================================
   FOOTER STYLING
   ========================================================================== */
.footer {
  margin-top: auto;
  padding: 3.5rem 0;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.85rem;
  column-gap: 1.75rem;
  list-style: none;
}

.footer-link {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--accent-color);
}

/* ==========================================================================
   ANIMATIONS & MEDIA QUERIES
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-panel.active {
  animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 1rem; /* 16px mobile standard */
  }

  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 1.25rem 0;
    gap: 1.15rem;
  }

  .nav-links {
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero {
    padding: 4.5rem 0 3rem 0;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero-pitch {
    font-size: 1.08rem;
  }

  .tabs-content {
    padding: 1.5rem;
  }

  .tabs-header {
    flex-direction: column;
    padding: 0.5rem;
  }

  .tab-btn {
    padding: 0.95rem;
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--border-color);
  }

  .tab-btn.active::after {
    bottom: 0;
    left: 0;
    width: 3px;
    height: 100%;
  }

  .footer-container {
    flex-direction: column;
    gap: 1.25rem;
    text-align: center;
  }
}

/* ==========================================================================
   RTL SUPPORT (FOR ARABIC AND RTL LANGUAGES)
   ========================================================================== */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .brand {
  gap: 0.75rem;
}

[dir="rtl"] .nav-links {
  padding: 0;
}

[dir="rtl"] .nav-link.active::after {
  left: auto;
  right: 0;
}

[dir="rtl"] .page-checkbox {
  left: auto;
  right: 0.6rem;
}

[dir="rtl"] .page-delete-btn,
[dir="rtl"] .page-rotate-btn {
  right: auto;
  left: 0.6rem;
}

[dir="rtl"] .page-angle-badge {
  right: auto;
  left: 0.6rem;
}

[dir="rtl"] .action-bar {
  justify-content: flex-start;
}

[dir="rtl"] #split-count-label,
[dir="rtl"] #reorder-count-label,
[dir="rtl"] #rotate-count-label {
  margin-right: 0 !important;
  margin-left: auto !important;
  text-align: right;
}

[dir="rtl"] .alert-close {
  margin-left: 0 !important;
  margin-right: auto !important;
}

[dir="rtl"] .trust-card,
[dir="rtl"] .faq-card,
[dir="rtl"] .step-item,
[dir="rtl"] .watermark-controls-card {
  text-align: right;
}

[dir="rtl"] .faq-card::before {
  left: auto;
  right: 0;
}

[dir="rtl"] .faq-card:hover {
  transform: translateX(-4px);
}

[dir="rtl"] .input-number-wrap input {
  padding-right: 1rem;
  padding-left: 2.25rem;
}

[dir="rtl"] .input-unit {
  right: auto;
  left: 0.85rem;
}

@media (max-width: 768px) {
  [dir="rtl"] .tab-btn.active::after {
    left: auto;
    right: 0;
  }
}

/* ==========================================================================
   ERROR PAGES (404 & 500) STYLES
   ========================================================================== */
.error-page-wrapper {
  min-height: calc(100vh - 3.75rem - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem 5rem 1.5rem;
  position: relative;
}

.error-card {
  position: relative;
  max-width: 48rem;
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  padding: 3.5rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.error-ambient-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  height: 220px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(236, 72, 153, 0.16) 50%, transparent 75%);
  filter: blur(50px);
  pointer-events: none;
  animation: errorPulse 5s ease-in-out infinite alternate;
}

.error-ambient-glow-500 {
  background: radial-gradient(circle, rgba(225, 29, 72, 0.28) 0%, rgba(245, 158, 11, 0.18) 50%, transparent 75%);
}

[data-theme="dark"] .error-ambient-glow {
  background: radial-gradient(circle, rgba(129, 140, 248, 0.38) 0%, rgba(244, 114, 182, 0.22) 50%, transparent 75%);
}

[data-theme="dark"] .error-ambient-glow-500 {
  background: radial-gradient(circle, rgba(244, 63, 94, 0.38) 0%, rgba(251, 191, 36, 0.22) 50%, transparent 75%);
}

@keyframes errorPulse {
  0% {
    opacity: 0.6;
    transform: translateX(-50%) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
}

@keyframes errorFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-9px) rotate(1.2deg);
  }
}

.error-illustration {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: errorFloat 5s ease-in-out infinite;
}

.error-illustration svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 12px 24px rgba(99, 102, 241, 0.25));
}

.error-illustration-500 svg {
  filter: drop-shadow(0 12px 24px rgba(225, 29, 72, 0.25));
}

.error-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-3xl);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.error-badge-404 {
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.error-badge-500 {
  background: rgba(225, 29, 72, 0.12);
  color: var(--danger-color);
  border: 1px solid rgba(225, 29, 72, 0.25);
}

.error-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  margin-bottom: 0.85rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.error-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 34rem;
  margin: 0 auto 2.25rem auto;
  line-height: 1.7;
}

.error-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.75rem;
}

.error-actions .btn {
  min-width: 160px;
}

.error-quick-tools {
  border-top: 1px solid var(--border-color);
  padding-top: 2.25rem;
  text-align: left;
}

.error-quick-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-align: center;
}

.error-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.error-tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.15rem 1.25rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all var(--transition-normal);
}

.error-tool-card:hover {
  border-color: var(--brand-primary);
  background-color: var(--bg-card-alt);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.error-tool-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.error-tool-header svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--brand-primary);
  flex-shrink: 0;
}

.error-tool-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.error-privacy-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 2.25rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--success-bg);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-3xl);
  color: var(--success-color);
  font-size: 0.9rem;
  font-weight: 600;
}

.error-privacy-banner svg {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

/* RTL overrides for error pages */
[dir="rtl"] .error-quick-tools {
  text-align: right;
}

[dir="rtl"] .error-tool-header {
  flex-direction: row;
}

@media (max-width: 640px) {
  .error-card {
    padding: 2.5rem 1.25rem;
  }
  .error-quick-grid {
    grid-template-columns: 1fr;
  }
  .error-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   LEGAL PAGES (PRIVACY POLICY & TERMS OF SERVICE)
   ========================================================================== */
.legal-header {
  text-align: center;
  max-width: 48rem;
  margin: 0 auto 3rem auto;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.15rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 1.25rem;
}

.legal-badge svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.legal-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.legal-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.legal-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.legal-toc-wrapper {
  position: sticky;
  top: 6.5rem;
}

.legal-toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.legal-toc-title {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.legal-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.legal-toc-link {
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: block;
  line-height: 1.4;
}

.legal-toc-link:hover {
  color: var(--accent-color);
  background-color: var(--bg-tertiary);
  transform: translateX(4px);
}

[dir="rtl"] .legal-toc-link:hover {
  transform: translateX(-4px);
}

.legal-article {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
}

.legal-meta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.legal-meta-banner strong {
  color: var(--text-primary);
}

.legal-section {
  margin-bottom: 2.75rem;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--border-color);
  scroll-margin-top: 7rem;
}

.legal-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.legal-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.legal-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  flex-shrink: 0;
}

.legal-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem 0;
}

.legal-section p {
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.98rem;
}

.legal-section ul, .legal-section ol {
  margin: 0.75rem 0 1.25rem 1.5rem;
  line-height: 1.75;
}

[dir="rtl"] .legal-section ul, [dir="rtl"] .legal-section ol {
  margin: 0.75rem 1.5rem 1.25rem 0;
}

.legal-section li {
  margin-bottom: 0.5rem;
  font-size: 0.98rem;
}

.legal-callout-shield {
  display: flex;
  gap: 1.25rem;
  background-color: var(--success-bg);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-primary);
}

.legal-callout-shield svg {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--success-color);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.legal-callout-shield h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success-color);
  margin-bottom: 0.35rem;
}

.legal-callout-shield p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.legal-contact-box {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--accent-light) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.legal-contact-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.legal-contact-info p {
  margin-bottom: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.legal-email-link {
  font-weight: 700;
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   CONTACT US PAGE STYLING (MINIMAL)
   ========================================================================== */
.contact-main {
  padding: 5rem 1.5rem 8rem 1.5rem;
  flex: 1;
}

.contact-wrapper {
  max-width: 700px;
  margin: 0 auto;
  text-align: left;
}

.contact-title {
  font-family: var(--font-heading);
  font-size: clamp(2.35rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 1.15rem;
}

.contact-intro {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.contact-box {
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), background-color var(--transition-normal);
}

.contact-box:hover {
  border-color: var(--border-color-hover);
}

.contact-email-group {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.contact-email-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.contact-email-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
  overflow-wrap: anywhere;
  transition: color var(--transition-fast);
}

.contact-email-link:hover {
  color: var(--accent-hover);
}

.contact-copy-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.contact-copy-btn:hover {
  border-color: var(--brand-primary);
  color: var(--accent-color);
  background-color: var(--bg-card-alt);
}

.contact-copy-btn.copied {
  border-color: var(--success-color);
  color: var(--success-color);
  background-color: var(--success-bg);
}

.contact-copy-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* RTL support for Contact */
[dir="rtl"] .contact-wrapper {
  text-align: right;
}

[dir="rtl"] .contact-email-link {
  direction: ltr;
  display: inline-block;
}

/* Responsive adjustments for Legal & Contact */
@media (max-width: 900px) {
  .legal-grid {
    grid-template-columns: 1fr;
  }
  .legal-toc-wrapper {
    position: static;
    margin-bottom: 2rem;
  }
}

@media (max-width: 640px) {
  .legal-article {
    padding: 2rem 1.25rem;
  }
  .contact-main {
    padding: 3.5rem 1.25rem 5rem 1.25rem;
  }
  .contact-intro {
    font-size: 1.05rem;
    margin-bottom: 2rem;
  }
  .contact-box {
    padding: 1.15rem 1.25rem;
  }
  .contact-email-link {
    font-size: 0.94rem;
  }
}

@media (max-width: 440px) {
  .contact-box {
    padding: 1rem 1.1rem;
    gap: 0.75rem;
  }
  .contact-email-link {
    font-size: 0.88rem;
  }
  .contact-copy-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }
}