/* Reset & General Variables */
:root {
  --bg-color: #0b0c10;
  --card-bg: rgba(30, 30, 30, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --primary-color: #ff9800;
  --primary-hover: #e68a00;
  --danger-color: #f44336;
  --danger-hover: #d32f2f;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --font-family-en: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-ar: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-speed: 0.3s;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family-ar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* English Override */
html[lang="en"] body {
  font-family: var(--font-family-en);
}

/* Background Decorative Orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.25;
  animation: orbFloat 20s infinite ease-in-out alternate;
}

.orb-1 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
  top: -50px;
  right: -50px;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--danger-color) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(30px, 40px) scale(1.1);
  }
}

/* Header */
.app-header {
  width: 100%;
  max-width: 1200px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 8px rgba(255, 152, 0, 0.4));
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-speed) ease;
  backdrop-filter: blur(10px);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Main Container & Card */
.main-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 20px;
  z-index: 5;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

/* Step Animations */
.step-section {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Typography */
.title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}

.text-danger {
  color: var(--danger-color);
  background: linear-gradient(135deg, #ff8a80 0%, var(--danger-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 30px;
  text-align: center;
}

/* Form Styles */
.input-group {
  position: relative;
  margin-bottom: 28px;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

/* Floating labels */
.input-group label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.25s ease;
}

/* Position labels correctly depending on text direction */
html[dir="rtl"] .input-group label {
  right: 18px;
}

html[dir="ltr"] .input-group label {
  left: 18px;
}

.input-group input:focus,
.input-group input:not(:placeholder-shown) {
  border-color: var(--primary-color);
  background: rgba(255, 152, 0, 0.03);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 0;
  font-size: 12px;
  color: var(--primary-color);
  background: #14151a;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Warning Checklist */
.warning-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.warning-list li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: rgba(244, 67, 54, 0.05);
  border: 1px solid rgba(244, 67, 54, 0.1);
  border-radius: 16px;
  transition: all var(--transition-speed) ease;
}

.warning-list li:hover {
  background: rgba(244, 67, 54, 0.08);
  transform: translateX(-3px);
}

html[dir="ltr"] .warning-list li:hover {
  transform: translateX(3px);
}

.warning-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.warning-info h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #ff8a80;
}

.warning-info p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Checkbox Container */
.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.checkbox-container input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.checkbox-container input:checked + .checkmark {
  border-color: var(--danger-color);
  background: var(--danger-color);
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked + .checkmark::after {
  display: block;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 14px;
}

.btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #e68a00 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffaa2b 0%, #cc7a00 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color) 0%, #d32f2f 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff5c4d 0%, #b71c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

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

.hidden {
  display: none !important;
}

/* Error Banner */
.error-banner {
  background: rgba(244, 67, 54, 0.12);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ff8a80;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.5;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Success Screen Specifics */
.success-icon-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.success-circle {
  width: 72px;
  height: 72px;
  background: rgba(76, 175, 80, 0.12);
  border: 2px solid #4caf50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-checkmark {
  font-size: 36px;
  color: #4caf50;
  font-weight: bold;
}

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

/* Footer */
.app-footer {
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  z-index: 10;
}

/* Responsive Rules */
@media (max-width: 580px) {
  .app-header {
    padding: 16px 20px;
  }
  
  .brand-name {
    font-size: 18px;
  }
  
  .main-container {
    padding: 12px;
  }

  .card {
    padding: 24px 16px;
    border-radius: 16px;
  }
  
  .title {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .subtitle {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .input-group {
    margin-bottom: 20px;
  }

  .input-group input {
    padding: 14px 16px;
    font-size: 14px;
  }

  /* Adjust labels floating positions for mobile */
  html[dir="rtl"] .input-group label {
    right: 16px;
  }

  html[dir="ltr"] .input-group label {
    left: 16px;
  }

  .input-group label {
    font-size: 14px;
  }

  .warning-list {
    gap: 12px;
    margin-bottom: 24px;
  }

  .warning-list li {
    padding: 12px;
    gap: 10px;
  }

  .warning-icon {
    font-size: 20px;
  }

  .warning-info h3 {
    font-size: 14px;
  }

  .warning-info p {
    font-size: 12px;
  }

  .checkbox-container {
    font-size: 13px;
    margin-bottom: 24px;
    padding-left: 28px; /* Extra padding for ease of check on mobile */
  }

  .btn {
    padding: 14px 16px;
    font-size: 15px;
    width: 100%; /* Ensure full-width buttons on mobile for easy tapping */
  }

  .action-buttons {
    flex-direction: column-reverse;
    gap: 10px;
    width: 100%;
  }

  .orb {
    filter: blur(80px);
    opacity: 0.15;
  }

  .orb-1 {
    width: 200px;
    height: 200px;
  }

  .orb-2 {
    width: 250px;
    height: 250px;
  }

  /* Form spacing on extremely small screens */
  @media (max-width: 380px) {
    .card {
      padding: 20px 12px;
    }
    .title {
      font-size: 18px;
    }
    .warning-list li {
      padding: 8px;
    }
  }
}
