/* Revak AI - Professional Styles */

/* ==================== BASE STYLES ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden;
}

:root {
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== TYPOGRAPHY ==================== */
[dir="rtl"] * {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[dir="ltr"] * {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== GRADIENTS ==================== */
.gradient-bg {
  background: var(--gradient-primary);
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==================== ANIMATIONS ==================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(14, 165, 233, 0.3);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Rawaq Logo Loader */
.rawaq-loader {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rawaq-loader img {
  width: 80px;
  height: auto;
  animation: pulse-logo 1.5s ease-in-out infinite;
  background: transparent !important;
  filter: drop-shadow(0 4px 16px rgba(255, 255, 255, 0.4));
}

.rawaq-progress {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.85;
  }
}

@keyframes fade-pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

/* ==================== SERVICE CARDS ==================== */
.service-card {
  cursor: pointer;
  position: relative;
  transition: all var(--transition-base) ease;
  will-change: transform, box-shadow;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.25) !important;
}

.service-card.active {
  border-color: var(--purple-500) !important;
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.35) !important;
}

.service-card .chevron {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.25rem;
  transition: transform var(--transition-base) ease;
  opacity: 0.6;
}

[dir="ltr"] .service-card .chevron {
  right: auto;
  left: 1rem;
}

.service-card.active .chevron {
  transform: rotate(180deg);
  opacity: 1;
  color: var(--purple-500);
}

/* ==================== FORM ANIMATIONS ==================== */
.form-container {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--transition-slow) ease-in-out;
  overflow: hidden;
}

.form-container.show {
  grid-template-rows: 1fr;
}

.form-content {
  min-height: 0;
  opacity: 0;
  transition: opacity var(--transition-base) ease 0.1s;
}

.form-container.show .form-content {
  opacity: 1;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  pointer-events: none;
}

[dir="ltr"] .toast-container {
  right: auto;
  left: 1rem;
}

.toast {
  pointer-events: auto;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideDown var(--transition-base) ease-out;
  backdrop-filter: blur(10px);
  min-width: 300px;
}

.toast.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
  color: white;
}

.toast.error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
  color: white;
}

.toast.info {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.95) 0%, rgba(2, 132, 199, 0.95) 100%);
  color: white;
}

.toast.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
  color: white;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  opacity: 1;
}

/* ==================== LOADING STATES ==================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: pulse 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==================== FOCUS STATES (Accessibility) ==================== */
*:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 2px;
}

/* ==================== UTILITIES ==================== */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.smooth-scroll {
  scroll-behavior: smooth;
}

/* ==================== RESPONSIVE IMAGES ==================== */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--transition-base);
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .no-print {
    display: none !important;
  }
}

/* ==================== DARK MODE SUPPORT (Future) ==================== */
@media (prefers-color-scheme: dark) {
  /* Prepared for dark mode implementation */
}

/* ==================== LANGUAGE TOGGLE BUTTON ==================== */
.lang-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  overflow: hidden;
}

.lang-toggle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lang-toggle-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.lang-toggle-btn:hover::before {
  opacity: 1;
}

.lang-toggle-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.lang-toggle-icon {
  font-size: 16px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.lang-toggle-text {
  font-family: 'Cairo', sans-serif;
  letter-spacing: 0.3px;
}

/* Mobile Language Toggle */
.lang-toggle-btn-mobile {
  padding: 6px 12px;
  font-size: 12px;
  gap: 4px;
}

.lang-toggle-btn-mobile .lang-toggle-icon {
  font-size: 14px;
}

/* Animation for language switch */
@keyframes langSwitch {
  0% { opacity: 1; transform: rotateY(0deg); }
  50% { opacity: 0; transform: rotateY(90deg); }
  100% { opacity: 1; transform: rotateY(0deg); }
}

.lang-switching {
  animation: langSwitch 0.4s ease-in-out;
}
