/* RTL specific styles */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .header-container,
[dir="rtl"] .toolbar,
[dir="rtl"] .cart-item,
[dir="rtl"] .form-grid {
  direction: rtl;
}

[dir="rtl"] .search-container i {
  left: auto;
  right: 1rem;
}

[dir="rtl"] .search-container input {
  padding-left: 1rem;
  padding-right: 3rem;
}

[dir="rtl"] .cart-item-details {
  text-align: right;
}

[dir="rtl"] .cart-actions {
  justify-content: flex-start;
}

[dir="rtl"] .form-actions {
  text-align: left;
}

[dir="rtl"] .footer-links {
  text-align: right;
}

[dir="rtl"] .modal-header {
  text-align: right;
}

[dir="rtl"] .card-actions {
  justify-content: flex-start;
}

/* Keep all the original CSS from your main styles.css */
:root {
  /* ... your existing CSS variables ... */
}

/* ... rest of your existing CSS ... */

:root {
  --primary: #0ea5a4;
  --primary-dark: #0d9488;
  --primary-light: #14b8a6;
  --secondary: #063547;
  --accent: #f59e0b;
  --text: #0f172a;
  --text-light: #64748b;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, var(--secondary) 0%, #0a4b5a 100%);
  color: white;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.7s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.brand-text h1 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  transition: all 0.3s ease;
}

.brand-text p {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
  transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease; 
}

nav {
  display: flex;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

nav a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  padding: 0.5rem 0;
  position: relative;
}

nav a:hover {
  color: white;
}

nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-light);
  border-radius: 3px 3px 0 0;
}

.cart-count {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.admin-link {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Collapsed Header for Mobile */
header.compact {
  padding: 0.5rem 1rem;
}

header.compact .brand-text h1 {
  font-size: 1.1rem;
}

header.compact .brand-text p {
  display: none;
}

header.compact .logo {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

header.compact nav a span:not(.cart-count) {
  display: none;
  transition: opacity 0.3s ease; /* Smooth text hide */
}

header.compact nav a {
  padding: 0.5rem;
  font-size: 1.2rem;
  padding 0.3s ease, font-size 0.3s ease; /* Smooth icon transition */
}

header.compact nav a .cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 0.7rem;
  padding: 1px 4px;
  min-width: 18px;
  text-align: center;
}

/* Main Content */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-container {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.order-summary {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  background: var(--card);
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.order-item:last-child {
  border-bottom: none;
}

.order-total {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0 0;
  border-top: 2px solid var(--border);
  margin-top: 0.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.search-container i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.search-container input {
  padding-left: 2.5rem;
  width: 100%;
}

.filter-container {
  min-width: 180px;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--secondary);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Form Elements */
input, select, textarea {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  width: 100%;
  font-family: inherit;
  transition: all 0.2s;
}

#syncNotification {
  background: var(--success) !important;
  border: 1px solid rgba(255,255,255,0.2);
}

#syncNotification i {
  margin-right: 8px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.1);
}

/* Grid & Cards - Updated for Mobile */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(14, 165, 164, 0.1);
}

.media {
  height: 160px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef2f7, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
  overflow: hidden;
  position: relative;
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .media img {
  transform: scale(1.05);
}

.media .placeholder-icon {
  position: absolute;
  opacity: 0.3;
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

.title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.description {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.price {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.card-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Cart Styles */
.cart-list {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.cart-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-item-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef2f7, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary);
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-details {
  flex: 1;
}

.cart-item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.cart-item-sku {
  color: var(--text-light);
  font-size: 0.875rem;
}

.cart-item-price {
  font-weight: 700;
  min-width: 100px;
  text-align: right;
}

.cart-item-qty {
  width: 80px;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.cart-total {
  font-weight: 800;
  font-size: 1.5rem;
}

.cart-actions {
  display: flex;
  gap: 0.5rem;
}

/* Special Request Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-full {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 1rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 1100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

.toast.warning {
  background: var(--warning);
}

/* Footer */
footer {
  background: var(--secondary);
  color: rgba(255, 255, 255, 0.8);
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
}

/* ==================== */
/* RESPONSIVE DESIGN */
/* ==================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

  nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    margin-left: 0;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .cart-item {
    flex-wrap: wrap;
  }

  .cart-summary {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .cart-actions {
    width: 100%;
    justify-content: space-between;
  }

  .modal-content {
    margin: 1rem;
    padding: 1.5rem;
  }

  /* 2-column grid for tablets */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .media {
    height: 120px;
    font-size: 2rem;
  }

  .title {
    font-size: 1rem;
  }

  .price {
    font-size: 1.1rem;
  }

  .card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-actions .btn {
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
    margin: 1rem auto;
  }

  /* Compact header for mobile */
  header {
    padding: 0.75rem 1rem;
  }

  header.compact {
    padding: 0.5rem 1rem;
  }

  header.compact .brand-text h1 {
    font-size: 1rem;
  }

  header.compact .brand-text p {
    display: none;
  }

  header.compact .logo {
    width: 32px;
    height: 20px;
    font-size: 0.7rem;
  }

  header.compact nav a span:not(.cart-count) {
    display: none;
  }

  header.compact nav a {
    padding: 0.2rem;
    font-size: 0.7rem;
  }

  header.compact nav a .cart-count {
    position: absolute;
    top: -3px;
    right: -3px;
    font-size: 0.6rem;
    padding: 1px 3px;
    min-width: 16px;
    text-align: center;
  }

  /* 2-column grid for mobile */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .card {
    padding: 0.75rem;
    border-radius: 8px;
  }

  .media {
    height: 100px;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }

  .meta {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .description {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .price {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .stock-info {
    font-size: 0.75rem;
  }

  .card-actions {
    flex-direction: column;
    gap: 0.25rem;
  }

  .card-actions .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    min-height: auto;
  }

  .card-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    top: 8px;
    right: 8px;
  }

  /* Cart adjustments for mobile */
  .cart-item {
    padding: 0.75rem 0;
    gap: 0.75rem;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }

  .cart-item-title {
    font-size: 0.9rem;
  }

  .cart-item-sku, .cart-item-stock {
    font-size: 0.75rem;
  }

  .cart-item-price {
    font-size: 0.9rem;
    min-width: 80px;
  }

  .cart-item-qty {
    width: 60px;
    padding: 0.5rem;
  }

  /* Toolbar adjustments */
  .toolbar {
    margin-bottom: 1.5rem;
    gap: 0.75rem;
  }

  .search-container {
    min-width: auto;
  }

  .filter-container {
    min-width: 150px;
  }

  /* Modal adjustments */
  .modal-content {
    padding: 1rem;
    margin: 0.5rem;
  }

  .modal-title {
    font-size: 1.2rem;
  }

  /* Toast adjustments */
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    padding: 0.75rem 1rem;
  }
}

/* Small Mobile (360px and below) */
@media (max-width: 360px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .media {
    height: 140px;
  }

  .card-actions {
    flex-direction: row;
  }

  header.compact nav {
    gap: 0.2rem;
  }

  header.compact nav a {
    padding: 0.1rem;
    font-size: 1rem;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.hide { display: none; }









/* Add these styles to your styles.css file */

/* Product Detail Modal - Mobile Layout */
@media (max-width: 768px) {
  .product-detail-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    margin-bottom: 1.5rem !important;
  }
  
  .product-detail-image {
    width: 100% !important;
    height: 300px !important; /* Larger height for mobile */
    margin-bottom: 1rem !important;
  }
  
  .product-detail-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    background: #f5f5f5 !important;
    border-radius: 12px !important;
  }
  
  .product-detail-info {
    width: 100% !important;
    padding: 1rem 0 !important;
  }
  
  .modal-content {
    padding: 1.5rem !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }
  
  .modal-title {
    font-size: 1.3rem !important;
    margin-bottom: 0.5rem !important;
  }
}

/* For very small mobile devices */
@media (max-width: 480px) {
  .product-detail-image {
    height: 250px !important;
  }
  
  .modal-content {
    padding: 1rem !important;
    margin: 0.5rem !important;
  }
  
  .product-detail-info .price {
    font-size: 1.3rem !important;
    margin: 0.75rem 0 !important;
  }
}

/* Product Detail Modal - Desktop Layout (existing, keep as is) */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.product-detail-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 12px;
  overflow: hidden;
}

.product-detail-image img {
  width: 100%;
  height: 200px;
  object-fit: contain;
}