:root {
  /* Light mode colors */
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-muted: #f1f3f5;
  --text-primary: #1a1d29;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --primary: #4f7aeb;
  --primary-hover: #3d67d9;
  --primary-light: rgba(79, 122, 235, 0.1);
  --secondary: #10b981;
  --secondary-hover: #059669;
  --secondary-light: rgba(16, 185, 129, 0.1);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-light: rgba(239, 68, 68, 0.1);
  --shadow: rgba(0, 0, 0, 0.05);
  --shadow-md: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  /* Dark mode colors */
  --bg-primary: #1a1d29;
  --bg-secondary: #252936;
  --bg-muted: #2d3142;
  --text-primary: #f8f9fb;
  --text-secondary: #cbd5e0;
  --text-muted: #a0aec0;
  --border: #3a3f52;
  --primary: #5b8ff9;
  --primary-hover: #7ba7ff;
  --primary-light: rgba(91, 143, 249, 0.15);
  --secondary: #34d399;
  --secondary-hover: #6ee7b7;
  --secondary-light: rgba(52, 211, 153, 0.15);
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.15);
  --error: #f87171;
  --error-light: rgba(248, 113, 113, 0.15);
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-md: rgba(0, 0, 0, 0.4);
}

:root.access-high-contrast {
  --bg-primary: #0b0b0b;
  --bg-secondary: #141414;
  --bg-muted: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: #e5e5e5;
  --text-muted: #cccccc;
  --border: #2e2e2e;
  --primary: #ffb400;
  --primary-hover: #ffcf52;
  --primary-light: rgba(255, 180, 0, 0.25);
  --secondary: #2dd4bf;
  --secondary-hover: #5eead4;
  --secondary-light: rgba(45, 212, 191, 0.25);
  --success: #22d3ee;
  --success-light: rgba(34, 211, 238, 0.25);
  --error: #f97316;
  --error-light: rgba(249, 115, 22, 0.25);
  --shadow: rgba(0, 0, 0, 0.8);
  --shadow-md: rgba(0, 0, 0, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Alef", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.access-text-large {
  font-size: 1.1rem;
}

body.access-highlight-links a,
body.access-highlight-links a:visited {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  text-decoration: underline;
}

body.access-highlight-links a:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container.wider {
  max-width: 1400px;
}

/* Header */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.nav {
  display: flex;
  gap: 2rem;
  flex: 1;
  justify-content: center;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  color: var(--primary);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-secondary);
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--primary);
}

.theme-toggle .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: block;
}

/* Removed old accessibility widget styles - now using yAccessibility built-in styles */

/* Main Content */
.main {
  min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
  padding: 4rem 0;
  text-align: center;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0 auto;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Features */
.features {
  padding: 4rem 0;
  background: var(--bg-muted);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  transition: box-shadow 0.3s, transform 0.3s;
}

.feature-card:hover {
  box-shadow: 0 10px 30px var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.feature-icon.secondary {
  background: var(--secondary-light);
  color: var(--secondary);
}

.feature-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.feature-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-description {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.feature-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.feature-link:hover {
  color: var(--primary-hover);
}

/* Info Section */
.info-section {
  padding: 4rem 0;
}

.info-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-text {
  font-size: 1.125rem;
  color: var(--text-muted);
}

/* Page Content */
.page-content {
  padding: 3rem 0;
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.page-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.page-icon.secondary {
  background: var(--secondary-light);
  color: var(--secondary);
}

.page-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-description {
  font-size: 1.125rem;
  color: var(--text-muted);
}

/* Card */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 2rem;
  transition: box-shadow 0.3s;
}

.card:hover {
  box-shadow: 0 4px 12px var(--shadow);
}

.card.center {
  text-align: center;
}

.card-body {
  padding: 2rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Form Elements */
.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1.125rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-input.mono {
  font-family: "Courier New", monospace;
  letter-spacing: 0.1em;
}

.form-input.center {
  text-align: center;
}

.form-help {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-xl {
  padding: 1.25rem 3rem;
  font-size: 1.25rem;
}

/* Alert */
.alert {
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.5s;
}

.alert.success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.alert.error {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error);
}

.alert-content {
  flex: 1;
}

/* Modal */
.app-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.app-modal.hidden {
  display: none;
}

.app-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.app-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.app-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}

.app-modal.open .app-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.app-modal-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-modal-text {
  flex: 1;
}

.app-modal-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
}

.app-modal-dialog[data-type="success"] .app-modal-icon {
  background: var(--success-light);
  color: var(--success);
}

.app-modal-dialog[data-type="error"] .app-modal-icon {
  background: var(--error-light);
  color: var(--error);
}

.app-modal-dialog[data-type="info"] .app-modal-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.app-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.app-modal-message {
  font-size: 1rem;
  color: var(--text-secondary);
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.app-modal-confirm {
  min-width: 120px;
}

/* Calculation Display */
.calculation {
  margin-top: 1.5rem;
}

.calculation-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calculation-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.calc-step {
  padding: 0.75rem 1rem;
  background: var(--bg-muted);
  border-radius: 0.5rem;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
}

.calc-summary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.calc-row.primary {
  font-size: 1rem;
  font-weight: 700;
}

.calc-row .value {
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.calc-row.primary .value {
  color: var(--primary);
  font-size: 1.25rem;
}

/* Result Display */
.result-display {
  padding: 2rem;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: 1rem;
  margin: 1.5rem 0;
  animation: fadeIn 0.5s;
}

.result-number {
  font-size: 3rem;
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.result-number .check-digit {
  color: var(--primary);
}

.result-help {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 1rem;
}

/* Batch Results */
.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.batch-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.batch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-muted);
  border-radius: 0.5rem;
  transition: background 0.2s;
}

.batch-item:hover {
  background: var(--bg-primary);
}

.batch-item .index {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 3rem;
}

.batch-item .number {
  font-family: "Courier New", monospace;
  font-size: 1.125rem;
  letter-spacing: 0.1em;
  flex: 1;
  text-align: center;
}

.batch-item .number .check-digit {
  color: var(--primary);
  font-weight: 700;
}

.batch-item .copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--text-muted);
}

.batch-item .copy-btn:hover {
  background: var(--bg-secondary);
}

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

.step {
  display: flex;
  gap: 1rem;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.step.success .step-number {
  background: var(--success-light);
  color: var(--success);
}

.step-content {
  flex: 1;
}

.step-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.step-text {
  color: var(--text-muted);
}

/* Example Card */
.example-card {
  background: var(--primary-light);
  border-color: var(--primary);
}

.example-calc {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin: 1rem 0;
}

.calc-line {
  font-family: "Courier New", monospace;
  padding: 0.25rem 0;
}

.calc-line.total {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-weight: 700;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.mono {
  font-family: "Courier New", monospace;
}

.bold {
  font-weight: 700;
}

.large {
  font-size: 1.25rem;
}

.xlarge {
  font-size: 1.5rem;
}

.primary {
  color: var(--primary);
}

.text-lg {
  font-size: 1.125rem;
  line-height: 1.75;
}

.center {
  text-align: center;
}

.disclaimer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 3rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  flex: 1;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.footer-text {
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.25rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .input-group {
    flex-direction: column;
  }

  .footer-content {
    flex-direction: column;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}
