:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #38bdf8;
  --bg-dark: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2235;
  --bg-input: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-light: #334155;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
}

body.rtl {
  font-family: 'Cairo', 'Inter', sans-serif;
  direction: rtl;
}

.navbar {
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
}

.logo i {
  color: var(--primary);
  font-size: 24px;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.lang-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-primary:disabled {
  opacity: 0.7;
  transform: none;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px auto 0;
  padding: 8px;
  font-family: inherit;
}

.btn-text:hover {
  color: var(--primary-light);
}

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.btn-outline-sm:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 40px 20px;
  background: radial-gradient(ellipse at top, rgba(14, 165, 233, 0.08) 0%, transparent 60%);
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-icon {
  width: 64px;
  height: 64px;
  background: var(--gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: white;
}

.profile-icon {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.auth-step {
  display: none;
}

.auth-step.active {
  display: block;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 16px;
}

.rtl .input-wrapper i {
  left: auto;
  right: 14px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s;
  font-family: inherit;
}

.rtl .input-wrapper input {
  padding: 12px 42px 12px 14px;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

textarea {
  width: 100%;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  resize: vertical;
  font-family: inherit;
  transition: all 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

textarea::placeholder {
  color: var(--text-muted);
}

.code-sent-info {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(14, 165, 233, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(14, 165, 233, 0.15);
}

.code-sent-info i {
  color: var(--primary);
  font-size: 32px;
  margin-bottom: 8px;
}

.code-sent-info p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 4px;
}

.code-sent-info strong {
  color: var(--primary);
  font-size: 15px;
}

.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  direction: ltr;
}

.code-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  transition: all 0.2s;
  font-family: 'Inter', monospace;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.message {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.feature-item i {
  color: var(--primary);
}

.dashboard {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 700;
}

.dashboard-header p {
  color: var(--text-secondary);
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-icon.total {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
}

.stat-icon.open {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.stat-icon.progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.stat-icon.closed {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.ticket-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: var(--bg-card-hover);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ticket-id {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-open {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-in_progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-closed {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.ticket-subject {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.ticket-preview {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.ticket-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.ticket-priority {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.priority-low {
  color: var(--success);
}

.priority-medium {
  color: var(--warning);
}

.priority-high {
  color: var(--danger);
}

.ticket-date {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.back-link {
  margin-bottom: 24px;
}

.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

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

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.form-card-header {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.form-card-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.form-card-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.form-body {
  padding: 28px 32px;
}

.priority-options {
  display: flex;
  gap: 12px;
}

.priority-option {
  flex: 1;
  cursor: pointer;
}

.priority-option input {
  display: none;
}

.priority-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 2px solid var(--border);
  transition: all 0.2s;
  background: var(--bg-input);
}

.priority-option input:checked + .priority-label.priority-low {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.priority-option input:checked + .priority-label.priority-medium {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.priority-option input:checked + .priority-label.priority-high {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.ticket-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.ticket-detail-header {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.ticket-detail-title h1 {
  font-size: 22px;
  margin-bottom: 12px;
}

.ticket-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.conversation {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-bubble {
  padding: 16px 20px;
  border-radius: 16px;
  max-width: 85%;
}

.user-message {
  background: var(--bg-input);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.rtl .user-message {
  align-self: flex-end;
}

.admin-message {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.15);
  align-self: flex-end;
}

.rtl .admin-message {
  align-self: flex-start;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.message-author i {
  color: var(--primary);
}

.message-author strong {
  color: var(--text-primary);
}

.message-time {
  color: var(--text-muted);
  font-size: 12px;
}

.message-content {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
}

.reply-form {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
}

.reply-form h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.reply-form textarea {
  margin-bottom: 12px;
}

.ticket-closed-notice {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.05);
}

.ticket-closed-notice i {
  font-size: 20px;
}

@media (max-width: 640px) {
  .navbar {
    padding: 0 16px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .nav-actions {
    gap: 8px;
  }

  .user-info {
    display: none;
  }

  .dashboard {
    padding: 20px 16px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ticket-detail-header,
  .conversation,
  .reply-form,
  .form-card-header,
  .form-body {
    padding: 20px;
  }

  .priority-options {
    flex-direction: column;
  }

  .code-input {
    width: 42px;
    height: 48px;
    font-size: 18px;
  }

  .ticket-detail-meta {
    gap: 8px;
  }
}
