@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Theme */
:root {
  /* Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-primary: #1e293b;
  --bg-secondary: #0f172a;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #475569;
  --border-hover: #64748b;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
}

body {
  font-family: 'Vazirmatn', 'Tahoma', Arial, sans-serif;
  direction: rtl;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  text-align: center;
  min-width: 120px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 10px var(--shadow);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
  min-width: auto;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-control:focus {
  outline: none;
  border-color: #3b82f6;
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-admin {
  background: #fef3c7;
  color: #92400e;
}

.badge-super-admin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 600;
}

.badge-customer {
  background: #dbeafe;
  color: #1e40af;
}

.badge-verified {
  background: #d1fae5;
  color: #065f46;
}

.badge-unverified {
  background: #fee2e2;
  color: #991b1b;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px var(--shadow-hover);
  border-color: var(--primary-color);
}

.theme-toggle .theme-icon {
  width: 22px;
  height: 22px;
  color: var(--text-primary);
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(15deg);
}

/* Theme Modal */
.theme-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.theme-modal-content {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.theme-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Vazirmatn', 'Tahoma', Arial, sans-serif;
}

.theme-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.theme-modal-close:hover {
  background: var(--bg-secondary);
}

.theme-modal-close svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.theme-option.active {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.theme-option-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 10px;
  transition: transform 0.2s ease;
}

.theme-option:hover .theme-option-icon {
  transform: scale(1.1);
}

.theme-option-icon svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

.theme-option.active .theme-option-icon svg {
  color: var(--primary-color);
}

.theme-option-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: 'Vazirmatn', 'Tahoma', Arial, sans-serif;
}

.theme-option.active .theme-option-label {
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 10px;
  }
  
  .form-control {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}