/* main.css - Modern Design System Implementation */
@import 'design-tokens.css';

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

/* =========================================================================
   Reset & Base
   ========================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-base);
  background-color: var(--color-bg-body);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  color: var(--color-surface-900);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  color: var(--color-brand-hover);
  opacity: 0.8;
}

/* =========================================================================
   Layout Utilities
   ========================================================================= */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
}

.flex {
  display: flex;
}

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

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-xs {
  gap: var(--space-xs);
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.gap-xl {
  gap: var(--space-xl);
}

.mb-xs {
  margin-bottom: var(--space-xs);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

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

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

.text-small {
  font-size: var(--font-size-sm);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* =========================================================================
   Components
   ========================================================================= */

/* Cards */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.card:hover {
  /* Slight lift on hover */
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--space-xl);
}

.card-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-50);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-brand);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background-color: var(--color-brand-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--color-surface-700);
  border: 1px solid var(--color-surface-200);
}

.btn-secondary:hover {
  background-color: var(--color-surface-50);
  border-color: var(--color-surface-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--color-surface-200);
  color: var(--color-surface-500);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-surface-700);
  font-size: var(--font-size-sm);
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--color-surface-200);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: var(--font-size-md);
  transition: all var(--transition-normal);
  background-color: var(--color-surface-white);
  color: var(--color-surface-900);
}

.form-input:hover {
  border-color: var(--color-surface-300);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 4px var(--color-primary-100);
}

.form-input::placeholder {
  color: var(--color-surface-400);
}

.form-hint {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Alerts */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border: 1px solid transparent;
}

.alert-error {
  background-color: #fef2f2;
  color: var(--color-error);
  border-color: #fecaca;
}

.alert-success {
  background-color: #ecfdf5;
  color: var(--color-success);
  border-color: #a7f3d0;
}

/* Navbar (Simple Top) */
.navbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  /* Glassmorphism */
  border-bottom: 1px solid var(--color-border);
  height: 70px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.nav-logo {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
  color: var(--color-brand);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
}

.nav-link {
  color: var(--color-surface-600);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-brand);
}

/* Map specific */
#map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-surface-300);
  margin-top: var(--space-xs);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--transition-normal) forwards;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.modal-content {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  animation: slideInUp var(--transition-normal) ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-50);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-300);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-surface-400);
}

/* =========================================================================
   Language Switcher
   ========================================================================= */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: var(--space-sm);
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-surface-50);
  border: 1px solid var(--color-surface-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-surface-700);
  transition: all var(--transition-fast);
}

.lang-switcher-btn:hover {
  background: var(--color-surface-100);
  border-color: var(--color-surface-300);
}

.lang-switcher-current {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}

.lang-switcher-arrow {
  font-size: 0.6em;
  opacity: 0.6;
  transition: transform var(--transition-fast);
}

.lang-switcher.open .lang-switcher-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 140px;
  background: white;
  border: 1px solid var(--color-surface-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 1000;
  overflow: hidden;
}

.lang-switcher.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--font-size-sm);
  color: var(--color-surface-700);
  text-align: left;
  transition: background var(--transition-fast);
}

.lang-option:hover {
  background: var(--color-surface-50);
}

.lang-option-active {
  background: var(--color-primary-50);
  color: var(--color-brand);
  font-weight: var(--font-weight-semibold);
}

.lang-flag {
  font-size: 1.1em;
}

.lang-name {
  flex: 1;
}

/* =========================================================================
   RTL (Right-to-Left) Support for Arabic
   ========================================================================= */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .flex {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-links {
  flex-direction: row-reverse;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-option {
  text-align: right;
  flex-direction: row-reverse;
}

[dir="rtl"] .card-body {
  text-align: right;
}

[dir="rtl"] .form-label {
  text-align: right;
}

[dir="rtl"] .form-input {
  text-align: right;
}

[dir="rtl"] .justify-between {
  flex-direction: row-reverse;
}

[dir="rtl"] .gap-sm,
[dir="rtl"] .gap-md {
  flex-direction: row-reverse;
}

/* RTL specific overrides for common layouts */
[dir="rtl"] .section-tag {
  text-align: right;
}

[dir="rtl"] .filter-panel .grid {
  direction: rtl;
}

[dir="rtl"] .card-image-wrapper .badge-premium,
[dir="rtl"] .card-image-wrapper span[class*="badge"] {
  left: var(--space-md);
  right: auto;
}

[dir="rtl"] .price-tag {
  direction: ltr;
  unicode-bidi: embed;
}