/* ===== Variables ===== */
:root {
  --primary-color: #1a7b8e;
  --primary-dark: #156270;
  --primary-light: #2d99ae;
  --secondary-color: #f4f4f4;
  --text-dark: #333;
  --text-light: #666;
  --border-color: #ddd;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --white: #ffffff;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: #fafafa;
}

body.rtl {
  direction: rtl;
  text-align: right;
}

body.ltr {
  direction: ltr;
  text-align: left;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
.header {
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-bar {
  background: var(--primary-color);
  color: var(--white);
  padding: 10px 0;
  font-size: 14px;
}

.top-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.language-switcher {
  display: flex;
  gap: 10px;
}

.language-switcher button {
  background: none;
  border: 1px solid var(--white);
  color: var(--white);
  padding: 5px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.language-switcher button.active,
.language-switcher button:hover {
  background: var(--white);
  color: var(--primary-color);
}

.main-header {
  padding: 20px 0;
}

.main-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo img {
  height: 60px;
}

.logo-text h1 {
  font-size: 24px;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-light);
}

.search-bar {
  flex: 1;
  max-width: 500px;
}

.search-form {
  display: flex;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  overflow: hidden;
}

.search-form input {
  flex: 1;
  padding: 12px 15px;
  border: none;
  outline: none;
  font-size: 14px;
}

.search-form button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 12px 25px;
  cursor: pointer;
  transition: background 0.3s;
}

.search-form button:hover {
  background: var(--primary-dark);
}

.header-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: color 0.3s;
  position: relative;
}

.header-btn:hover {
  color: var(--primary-color);
}

.header-btn .icon {
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
}

.header-btn .text {
  font-size: 12px;
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  background: var(--danger-color);
  color: var(--white);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

/* ===== Navigation ===== */
.nav {
  background: var(--primary-color);
  padding: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.nav-list li a {
  display: block;
  padding: 15px 25px;
  color: var(--white);
  transition: background 0.3s;
}

.nav-list li a:hover,
.nav-list li a.active {
  background: var(--primary-dark);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 80px 0;
  text-align: center;
}

.hero h2 {
  font-size: 48px;
  margin-bottom: 20px;
}

.hero p {
  font-size: 20px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.btn-primary {
  background: var(--white);
  color: var(--primary-color);
  padding: 15px 40px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== Categories Section ===== */
.categories-section {
  padding: 60px 0;
  background: var(--white);
}

.section-title {
  text-align: center;
  margin-bottom: 50px;
}

.section-title h2 {
  font-size: 36px;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.section-title p {
  color: var(--text-light);
  font-size: 16px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}

.category-card {
  background: var(--secondary-color);
  padding: 40px 20px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 3px solid transparent;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 10px 30px rgba(26, 123, 142, 0.2);
  background: var(--primary-color);
}

.category-card:hover h3 {
  color: var(--white);
}

.category-card h3 {
  font-size: 24px;
  color: var(--primary-color);
  font-weight: 600;
  transition: color 0.3s;
}

/* ===== Products Section ===== */
.products-section {
  padding: 60px 0;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
}

.product-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: all 0.3s;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.product-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  background: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--primary-color);
}

.product-info {
  padding: 20px;
}

.product-category {
  color: var(--primary-color);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 5px;
}

.product-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-dark);
}

.product-price {
  font-size: 24px;
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 15px;
}

.product-price .currency {
  font-size: 16px;
}

.btn-add-cart {
  width: 100%;
  background: var(--primary-color);
  color: var(--white);
  padding: 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.btn-add-cart:hover {
  background: var(--primary-dark);
}

/* ===== Footer ===== */
.footer {
  background: var(--text-dark);
  color: var(--white);
  padding: 50px 0 20px;
  margin-top: 60px;
}

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

.footer-section h3 {
  margin-bottom: 20px;
  color: var(--primary-light);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section ul li a {
  color: var(--white);
  opacity: 0.8;
  transition: opacity 0.3s;
}

.footer-section ul li a:hover {
  opacity: 1;
  color: var(--primary-light);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  text-align: center;
  opacity: 0.7;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .main-header .container {
    flex-direction: column;
    gap: 15px;
  }
  
  .search-bar {
    width: 100%;
    max-width: 100%;
  }
  
  .nav-list {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .nav-list li a {
    padding: 12px 15px;
    font-size: 14px;
  }
  
  .hero h2 {
    font-size: 32px;
  }
  
  .hero p {
    font-size: 16px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* ===== Cart Styles ===== */
.cart-page {
  padding: 40px 0;
}

.cart-items {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
}

.cart-item {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--primary-color);
}

.cart-item-info {
  flex: 1;
}

.cart-summary {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.summary-row.total {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
  border-bottom: none;
}

/* ===== Admin Dashboard ===== */
.admin-dashboard {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 250px;
  background: var(--text-dark);
  color: var(--white);
  padding: 20px 0;
}

.admin-sidebar ul {
  list-style: none;
}

.admin-sidebar ul li a {
  display: block;
  padding: 15px 20px;
  color: var(--white);
  transition: background 0.3s;
}

.admin-sidebar ul li a:hover,
.admin-sidebar ul li a.active {
  background: var(--primary-color);
}

.admin-content {
  flex: 1;
  padding: 40px;
  background: var(--secondary-color);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--white);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
}

.stat-card .icon {
  font-size: 48px;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.stat-card .value {
  font-size: 36px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.stat-card .label {
  color: var(--text-light);
  font-size: 14px;
}

.data-table {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--primary-color);
  color: var(--white);
  padding: 15px;
  text-align: right;
}

.data-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: var(--secondary-color);
}

.btn-action {
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  margin: 0 5px;
  transition: all 0.3s;
}

.btn-edit {
  background: var(--primary-color);
  color: var(--white);
}

.btn-delete {
  background: var(--danger-color);
  color: var(--white);
}

.btn-action:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

/* ===================================================
   📱 MOBILE RESPONSIVE - تحسينات الموبايل
   =================================================== */

/* ===== Hamburger Menu Button ===== */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  gap: 5px;
  transition: all 0.3s;
}

.hamburger-menu span {
  display: block;
  width: 22px;
  height: 3px;
  background: var(--white);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* ===== Mobile Navigation Overlay ===== */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Mobile Navigation Menu ===== */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh;
  background: var(--white);
  z-index: 9999;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.3s ease;
  overflow-y: auto;
}

.mobile-nav.active {
  right: 0;
}

.mobile-nav-header {
  background: var(--primary-color);
  color: var(--white);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-nav-header h3 {
  font-size: 18px;
  margin: 0;
}

.mobile-nav-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.mobile-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-list li {
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-list li a {
  display: block;
  padding: 16px 20px;
  color: var(--text-dark);
  font-size: 16px;
  transition: all 0.3s;
}

.mobile-nav-list li a:hover,
.mobile-nav-list li a.active {
  background: var(--primary-color);
  color: var(--white);
}

.mobile-nav-list li a .nav-icon {
  margin-left: 10px;
}

/* ===== Responsive Breakpoints ===== */

/* Tablet and below - 992px */
@media (max-width: 992px) {
  .main-header .container {
    flex-wrap: wrap;
  }
  
  .search-bar {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin-top: 15px;
  }
}

/* Mobile - 768px */
@media (max-width: 768px) {
  /* Top Bar */
  .top-bar {
    padding: 8px 0;
  }
  
  .top-bar .container {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .top-bar > .container > div:first-child {
    font-size: 13px;
  }
  
  .language-switcher button {
    padding: 4px 12px;
    font-size: 12px;
  }
  
  /* Main Header */
  .main-header {
    padding: 15px 0;
  }
  
  .main-header .container {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  
  .logo img {
    height: 45px;
  }
  
  .logo-text h1 {
    font-size: 18px;
  }
  
  .logo-text p {
    font-size: 10px;
  }
  
  /* Hide desktop search on mobile */
  .search-bar {
    display: none;
  }
  
  /* Header Actions */
  .header-actions {
    gap: 10px;
  }
  
  .header-btn .text {
    display: none;
  }
  
  .header-btn .icon {
    width: 22px;
    height: 22px;
    margin-bottom: 0;
  }
  
  /* Show Hamburger Menu */
  .hamburger-menu {
    display: flex;
  }
  
  /* Hide Desktop Navigation */
  .nav {
    display: none;
  }
  
  /* Hero Section */
  .hero {
    padding: 50px 0;
  }
  
  .hero h2 {
    font-size: 26px;
    line-height: 1.3;
  }
  
  .hero p {
    font-size: 15px;
  }
  
  .btn-primary {
    padding: 12px 30px;
    font-size: 14px;
  }
  
  /* Section Titles */
  .section-title h2 {
    font-size: 26px;
  }
  
  .section-title p {
    font-size: 14px;
  }
  
  /* Products Grid */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .product-image {
    height: 180px;
  }
  
  .product-info {
    padding: 12px;
  }
  
  .product-name {
    font-size: 14px;
  }
  
  .product-price {
    font-size: 18px;
  }
  
  .btn-add-cart {
    padding: 10px;
    font-size: 13px;
  }
  
  /* Footer */
  .footer {
    padding: 40px 0 20px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center;
  }
  
  .footer-section h3 {
    margin-bottom: 15px;
  }
}

/* Small Mobile - 480px */
@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
  
  /* Logo */
  .logo img {
    height: 40px;
  }
  
  .logo-text h1 {
    font-size: 16px;
  }
  
  .logo-text p {
    display: none;
  }
  
  /* Hero */
  .hero {
    padding: 40px 0;
  }
  
  .hero h2 {
    font-size: 22px;
  }
  
  .hero p {
    font-size: 14px;
    padding: 0 10px;
  }
  
  /* Products */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .product-image {
    height: 150px;
  }
  
  .product-info {
    padding: 10px;
  }
  
  .product-name {
    font-size: 13px;
    line-height: 1.3;
  }
  
  .product-price {
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  .product-category {
    font-size: 10px;
  }
  
  /* Categories */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .category-card {
    padding: 25px 15px;
    min-height: 80px;
  }
  
  .category-card h3 {
    font-size: 16px;
  }
}

/* Extra Small - 360px */
@media (max-width: 360px) {
  .logo-text h1 {
    font-size: 14px;
  }
  
  .hero h2 {
    font-size: 20px;
  }
  
  .hero p {
    font-size: 13px;
  }
  
  .products-grid {
    gap: 8px;
  }
  
  .product-image {
    height: 130px;
  }
  
  .product-name {
    font-size: 12px;
  }
  
  .product-price {
    font-size: 15px;
  }
  
  .btn-add-cart {
    padding: 8px;
    font-size: 12px;
  }
}

/* ===== Mobile Search (في الـ Mobile Nav) ===== */
.mobile-search {
  padding: 15px 20px;
  background: var(--secondary-color);
}

.mobile-search-form {
  display: flex;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  overflow: hidden;
}

.mobile-search-form input {
  flex: 1;
  padding: 12px;
  border: none;
  outline: none;
  font-size: 14px;
}

.mobile-search-form button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 12px 15px;
  cursor: pointer;
}

/* ===== Body Lock when Mobile Nav Open ===== */
body.nav-open {
  overflow: hidden;
}

/* ===== Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}

/* ===== Touch Friendly ===== */
@media (hover: none) and (pointer: coarse) {
  .btn-primary:hover,
  .btn-add-cart:hover,
  .product-card:hover,
  .category-card:hover {
    transform: none;
  }
}