/* ExpertiseHub - Global Styles (Arabic RTL Edition) */

/* ========== RTL BASE ========== */
html, body {
  direction: rtl;
  text-align: right;
}

/* Arabic Typography */
* {
  font-family: 'Tajawal', 'Cairo', system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Icons always stay LTR */
.fa, .fas, .far, .fab, .fal, .fad {
  direction: ltr !important;
  display: inline-block;
}

/* Inputs in RTL */
input, textarea, select {
  text-align: right;
  direction: rtl;
}

input[type="email"], input[type="url"] {
  direction: ltr;
  text-align: left;
}

/* ========== CUSTOM SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f8fafc; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ========== LINE CLAMP ========== */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ========== SMOOTH TRANSITIONS ========== */
a { transition: all 0.2s ease; }

/* Alpine.js hide before load */
[x-cloak] { display: none !important; }

/* ========== BACKGROUND ========== */
.gradient-mesh {
  background-color: #f8faff;
  background-image:
    radial-gradient(at 40% 20%, rgba(99,102,241,0.08) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(124,58,237,0.06) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(14,165,233,0.05) 0px, transparent 50%);
}

/* ========== SKELETON ========== */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, #f0f4f8 25%, #e4e9f0 50%, #f0f4f8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(79,70,229,0.4);
}
.btn-primary:active { transform: translateY(0); }

/* ========== CARD HOVER ========== */
.card-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* ========== SQUARE CATEGORY CARD ========== */
.cat-square-card {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border-radius: 1.25rem;
  background: white;
  border: 1.5px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cat-square-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: inherit;
}
.cat-square-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.12);
  border-color: transparent;
}
.cat-square-card:hover::before { opacity: 1; }
.cat-square-card .cat-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  transition: transform 0.25s ease;
}
.cat-square-card:hover .cat-icon { transform: scale(1.15); }
.cat-square-card .cat-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: #1f2937;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.cat-square-card .cat-count {
  font-size: 0.7rem;
  color: #9ca3af;
  font-weight: 500;
}

/* ========== ONLINE PULSE ========== */
@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.7); }
  50% { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
}
.pulse-online { animation: online-pulse 2s ease-in-out infinite; }

/* ========== STARS ========== */
.star-filled { color: #f59e0b; }

/* ========== SELECT ========== */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 2.5rem;
}

/* ========== FOCUS ========== */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
:focus-visible {
  outline: 3px solid #6366f1;
  outline-offset: 2px;
}

/* ========== HERO ========== */
.gradient-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
}

/* ========== NAV ========== */
.nav-link {
  position: relative;
  transition: color 0.2s ease;
}
.shadow-soft {
  box-shadow: 0 2px 15px -3px rgba(0,0,0,.07), 0 10px 20px -2px rgba(0,0,0,.04);
}
.shadow-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

/* ========== NOTIFICATION BADGE ========== */
.badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ========== TOOLTIP ========== */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 50%;
  transform: translateX(50%);
  background: #1e293b;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ========== PACKAGE CARDS ========== */
.package-card {
  border: 2px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: right;
}
.package-card.active, .package-card:hover {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.package-card.premium-card {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
}
.package-card.premium-card.active { box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: white;
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: right;
}

/* ========== EXPERT PROFILE ========== */
.expert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  .card-hover:hover { transform: none; }
  button, a { -webkit-tap-highlight-color: transparent; }
  .cat-square-card { padding: 1rem; }
  .cat-square-card .cat-icon { font-size: 2rem; }
}

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

/* ========== CSS VARIABLES ========== */
:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #818cf8;
  --color-secondary: #7c3aed;
  --color-accent: #f97316;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-soft: 0 2px 15px -3px rgba(0,0,0,0.07), 0 10px 20px -2px rgba(0,0,0,0.04);
}

/* ========== ARABIC TYPOGRAPHY UTILS ========== */
.font-arabic { font-family: 'Cairo', 'Tajawal', sans-serif !important; }
.font-arabic-heavy { font-family: 'Cairo', sans-serif !important; font-weight: 900; }
.text-arabic { direction: rtl; text-align: right; }

/* ========== DASHBOARD TABS (RTL) ========== */
.tab-bar { display: flex; gap: 0.25rem; overflow-x: auto; flex-direction: row; }
.tab-item { white-space: nowrap; padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.tab-item.active { background: linear-gradient(135deg,#4f46e5,#7c3aed); color: white; }
.tab-item:not(.active) { color: #6b7280; }
.tab-item:not(.active):hover { background: #f3f4f6; color: #374151; }

/* ========== STATS CARD ========== */
.stat-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  text-align: right;
}
.stat-card .stat-value { font-size: 1.875rem; font-weight: 900; color: #1f2937; }
.stat-card .stat-label { font-size: 0.8125rem; color: #6b7280; margin-top: 0.25rem; }
.stat-card .stat-icon {
  width: 3rem; height: 3rem;
  border-radius: 0.875rem;
  display: flex; align-items: center; justify-content: center;
}
