@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Tajawal:wght@300;400;500;600;700&display=swap');

:root {
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(20, 14.3%, 4.1%);
  --muted: hsl(60, 4.8%, 95.9%);
  --muted-foreground: hsl(25, 5.3%, 44.7%);
  --popover: hsl(0, 0%, 100%);
  --popover-foreground: hsl(20, 14.3%, 4.1%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(20, 14.3%, 4.1%);
  --border: hsl(20, 5.9%, 90%);
  --input: hsl(20, 5.9%, 90%);
  --primary: hsl(207, 90%, 54%);
  --primary-foreground: hsl(211, 100%, 99%);
  --secondary: hsl(60, 4.8%, 95.9%);
  --secondary-foreground: hsl(24, 9.8%, 10%);
  --accent: hsl(60, 4.8%, 95.9%);
  --accent-foreground: hsl(24, 9.8%, 10%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-foreground: hsl(60, 9.1%, 97.8%);
  --ring: hsl(20, 14.3%, 4.1%);
  --radius: 0.5rem;
  
  /* Custom gold colors - Matching original React version */
  --gold-50: hsl(48, 100%, 96%);
  --gold-100: hsl(48, 96%, 89%);
  --gold-200: hsl(48, 97%, 77%);
  --gold-300: hsl(45, 93%, 63%);
  --gold-400: hsl(43, 74%, 66%);
  --gold-500: hsl(38, 92%, 50%);
  --gold-600: hsl(32, 95%, 44%);
  --gold-700: hsl(26, 90%, 37%);
  --gold-800: hsl(23, 83%, 31%);
  --gold-900: hsl(22, 78%, 26%);
  
  /* Corporate colors - Matching original React version */
  --corporate-50: hsl(214, 100%, 97%);
  --corporate-100: hsl(214, 95%, 93%);
  --corporate-200: hsl(213, 97%, 87%);
  --corporate-300: hsl(212, 96%, 78%);
  --corporate-400: hsl(213, 94%, 68%);
  --corporate-500: hsl(217, 91%, 60%);
  --corporate-600: hsl(221, 83%, 53%);
  --corporate-700: hsl(224, 76%, 48%);
  --corporate-800: hsl(226, 71%, 40%);
  --corporate-900: hsl(224, 64%, 33%);
  
  /* Text colors */
  --primary-color: var(--gold-600);
  --text-color: #1f2937;
}

.dark {
  --background: hsl(240, 10%, 3.9%);
  --foreground: hsl(0, 0%, 98%);
  --muted: hsl(240, 3.7%, 15.9%);
  --muted-foreground: hsl(240, 5%, 64.9%);
  --popover: hsl(240, 10%, 3.9%);
  --popover-foreground: hsl(0, 0%, 98%);
  --card: hsl(240, 10%, 3.9%);
  --card-foreground: hsl(0, 0%, 98%);
  --border: hsl(240, 3.7%, 15.9%);
  --input: hsl(240, 3.7%, 15.9%);
  --primary: hsl(207, 90%, 54%);
  --primary-foreground: hsl(211, 100%, 99%);
  --secondary: hsl(240, 3.7%, 15.9%);
  --secondary-foreground: hsl(0, 0%, 98%);
  --accent: hsl(240, 3.7%, 15.9%);
  --accent-foreground: hsl(0, 0%, 98%);
  --destructive: hsl(0, 62.8%, 30.6%);
  --destructive-foreground: hsl(0, 0%, 98%);
  --ring: hsl(240, 4.9%, 83.9%);
  --radius: 0.5rem;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: hsl(210, 40%, 98%);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-arabic {
  font-family: 'Tajawal', sans-serif;
}

.font-english {
  font-family: 'Inter', sans-serif;
}

/* Layout */
.min-h-screen {
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header Styles */
.header {
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar {
  border-bottom: 1px solid hsl(214, 32%, 91%);
  padding: 0.5rem 0;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
}

.live-dot {
  width: 0.75rem;
  height: 0.75rem;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.live-text {
  color: #10b981;
  font-weight: 500;
}

.main-header {
  padding: 1rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-600) 100%);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
}

.logo-text p {
  font-size: 0.875rem;
  color: #6b7280;
}

.search-bar {
  flex: 1;
  max-width: 28rem;
  margin: 0 2rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  padding-left: 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--corporate-600);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  width: 1rem;
  height: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-primary {
  background: #374151;
  color: white;
}

.btn-primary:hover {
  background: #1f2937;
}

.btn-ghost {
  background: transparent;
  color: #6b7280;
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--corporate-600);
}

/* Navigation */
.navigation {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

.nav-menu {
  display: flex !important;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

/* Arabic RTL Navigation Fix */
.nav-menu.rtl-menu {
  direction: rtl !important;
  flex-direction: row-reverse !important;
  justify-content: flex-start !important;
}

.nav-menu.ltr-menu {
  direction: ltr !important;
  flex-direction: row !important;
  justify-content: center !important;
}

/* Force RTL ordering for Arabic */
[lang="ar"] .nav-menu {
  direction: rtl !important;
  flex-direction: row-reverse !important;
}

[lang="en"] .nav-menu {
  direction: ltr !important;
  flex-direction: row !important;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-direction: row;
  order: 0;
}

.nav-item a {
  text-decoration: none;
  color: #4b5563;
  font-weight: 500;
  padding: 0.5rem 0;
  transition: color 0.2s;
}

.nav-item a:hover,
.nav-item.active a {
  color: var(--corporate-600);
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  background: #f8f9fa;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.card-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
}

.card-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
}

.card-content {
  padding: 1.5rem;
}

/* Price Cards */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.price-card {
  background: linear-gradient(135deg, hsl(0, 0%, 100%) 0%, hsl(210, 40%, 98%) 100%);
  border: 1px solid hsl(214, 32%, 91%);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 6px -1px hsla(0, 0%, 0%, 0.1), 0 2px 4px -1px hsla(0, 0%, 0%, 0.06);
}

.price-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-600);
  margin-bottom: 0.5rem;
}

.price-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.price-change {
  font-size: 0.75rem;
  font-weight: 500;
}

.price-change.positive {
  color: #10b981;
}

.price-change.negative {
  color: #ef4444;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 2px solid #e5e7eb;
}

.table tr:hover {
  background: #f9fafb;
}

/* Market Overview Banner */
.market-overview {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  color: white;
  padding: 2rem;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
}

.market-overview h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.market-stat {
  text-align: center;
}

.market-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.market-stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 1.5rem;
}

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

.lg-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lg-col-span-2 { grid-column: span 2; }

/* Crypto Icons */
.crypto-icon {
  font-size: 2rem;
  font-weight: bold;
  color: var(--gold-600);
  margin-bottom: 0.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Currency Icons */
.currency-icon {
  font-size: 1.5rem;
  color: var(--corporate-600);
  margin-bottom: 0.5rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Price Change Neutral */
.price-change.neutral {
  color: #6b7280;
}

/* Better table styling */
.price-table th {
  text-align: start;
  padding: 0.75rem;
  background: #f8f9fa;
  color: #1f2937;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

.price-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-gray-600 { color: #6b7280; }
.text-gray-800 { color: #1f2937; }
.text-green-600 { color: #10b981; }
.text-red-600 { color: #ef4444; }
.text-gold-600 { color: var(--gold-600); }

.bg-gray-50 { background-color: #f9fafb; }
.bg-white { background-color: white; }

.rounded-lg { border-radius: 0.5rem; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* RTL Support */
.rtl {
  direction: rtl;
}

.rtl .search-input {
  padding-left: 1rem;
  padding-right: 2.5rem;
}

.rtl .search-icon {
  left: auto;
  right: 0.75rem;
}

.rtl .logo {
  flex-direction: row-reverse;
}

.rtl .header-actions {
  flex-direction: row-reverse;
}

.rtl .nav-menu {
  flex-direction: row-reverse;
}

/* Shimmer Loading */
.shimmer {
  background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
  background-size: 200px;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* News Cards */
.news-card {
  transition: transform 0.3s ease;
}

.news-card:hover {
  transform: translateY(-2px);
}

/* Footer */
.footer {
  background: #1f2937;
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 3rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--gold-400);
}

.footer-section p,
.footer-section a {
  color: #d1d5db;
  text-decoration: none;
  margin-bottom: 0.5rem;
  display: block;
}

.footer-section a:hover {
  color: var(--gold-400);
}

.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .search-bar {
    order: 3;
    margin: 0;
    max-width: none;
  }
  
  .nav-menu {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }
  
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .lg-grid-cols-3 {
    grid-template-columns: 1fr;
  }
  
  .lg-col-span-2 {
    grid-column: span 1;
  }
  
  .market-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .price-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .price-grid {
    grid-template-columns: 1fr;
  }
  
  .market-stats {
    grid-template-columns: 1fr;
  }
}