/* CSS Variables */
:root {
  --primary: #0061fe;
  --primary-hover: #004bcc;
  --success: #10b981;
  --error: #ef4444;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* RTL Support */
html[dir="rtl"] body {
  direction: rtl;
}

/* Container */
.container {
  width: 100%;
  max-width: 420px;
  position: relative;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
  text-align: center;
}

/* Logo */
.logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, #0061fe 0%, #6366f1 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: white;
}

/* App Icon Container */
.app-icon-container {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-icon {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  object-fit: contain;
}

/* Language Toggle */
.lang-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow);
  z-index: 10;
}

html[dir="rtl"] .lang-toggle {
  right: auto;
  left: 16px;
}

.lang-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: inherit;
}

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

.lang-btn:hover:not(.active) {
  background: var(--bg);
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

html[dir="rtl"] .form-group {
  text-align: right;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  text-align: inherit;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.1);
}

input.error {
  border-color: var(--error);
}

.error-text {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
  display: none;
}

.error-text.show {
  display: block;
}

.password-requirements {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
  margin-top: 12px;
}

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

.copy-btn {
  font-size: 12px;
  padding: 6px 12px;
  margin-top: 8px;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Icons */
.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--error);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 16px;
}

/* Store Buttons */
.store-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.store-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #000;
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.store-btn:hover {
  opacity: 0.9;
}

.store-btn svg {
  width: 24px;
  height: 24px;
}

/* Info Box */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
  color: #1e40af;
  text-align: start;
}

.info-box.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

/* Token Display */
.token-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  text-align: start;
  max-height: 60px;
  overflow: auto;
  direction: ltr;
}

/* Large Activation Code Display */
.activation-code-large {
  background: var(--bg);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  font-family: 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  letter-spacing: 2px;
  word-break: break-all;
  direction: ltr;
}

/* QR Code Section */
.qr-section {
  margin-top: 24px;
  text-align: center;
}

.qr-label {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}

.qr-label strong {
  color: var(--primary);
}

.qr-code {
  width: 250px;
  height: 250px;
  display: block;
  margin: 16px auto;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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