/* Custom Styles for E-commerce Site */

:root {
  --primary-color: #cca35d;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #1D312D;
  --info-color: #0dcaf0;
  --light-color: #f8f9fa;
  --dark-color: #212529;
}

body {
  direction: rtl;
  text-align: right;
  margin: 0;
  padding: 0;
  /* Smooth scrolling for better animation experience */
  scroll-behavior: smooth;
  /* Optimize font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Messages */
.messages-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 9999;
  max-width: 400px;
}

.message {
  padding: 15px 20px;
  margin-bottom: 10px;
  border-radius: 5px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.message-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.message-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.message-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.message-close {
  position: absolute;
  top: 8px;
  left: 8px;
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.message-close:hover {
  opacity: 1;
}

/* Navbar */
.navbar-brand {
  font-size: 1.5rem;
}

/* Product Cards */
.product-card {
  transition: none; /* GSAP handles all animations */
  border: 1px solid #dee2e6;
  will-change: transform, opacity, box-shadow;
  transform: translateZ(0); /* GPU acceleration */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* GSAP handles hover animations - no CSS transitions needed */
.product-card img {
  transition: none; /* GSAP handles all animations */
  will-change: transform;
  transform: translateZ(0); /* GPU acceleration */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Category Cards */
.category-card {
  transition: transform 0.3s ease;
  border: 1px solid #dee2e6;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #1D322D 0%, #856404 100%);
  border-radius: 10px;
  margin-bottom: 2rem;
}

/* Forms */
.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Buttons */
.btn {
  transition: all 0.3s ease;
  will-change: transform;
  transform: translateZ(0); /* GPU acceleration */
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Cards */
.card {
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 0.5em 0.75em;
}

/* Tables */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background-color: var(--light-color);
  border-bottom: 2px solid var(--primary-color);
  font-weight: 600;
}

/* Pagination */
.pagination .page-link {
  color: var(--primary-color);
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Alerts */
.alert {
  border-radius: 8px;
  border: none;
}

/* Footer */
footer {
  margin-top: auto;
}

footer a {
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--primary-color) !important;
}

/* Loading Spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Image Thumbnails */
.img-thumbnail {
  border: 1px solid #dee2e6;
  transition: border-color 0.3s ease;
}

.img-thumbnail.active {
  border: 3px solid var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2rem;
  }

  .product-card {
    margin-bottom: 1rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

/* Utility Classes */
.text-shadow {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.shadow-sm-hover:hover {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Sticky Elements */
.sticky-top {
  position: sticky;
  top: 80px;
  z-index: 1020;
}

/* Breadcrumb */
.breadcrumb {
  background-color: transparent;
  padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "←";
  color: #6c757d;
}

/* List Group */
.list-group-item {
  border: 1px solid rgba(0, 0, 0, 0.125);
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background-color: var(--light-color);
  transform: translateX(-5px);
}

.list-group-item.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Cart Items */
.cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

/* Order Status Badges */
.badge.bg-success {
  background-color: var(--success-color) !important;
}

.badge.bg-danger {
  background-color: var(--danger-color) !important;
}

.badge.bg-warning {
  background-color: var(--warning-color) !important;
  color: var(--dark-color);
}

.badge.bg-info {
  background-color: var(--info-color) !important;
  color: var(--dark-color);
}

/* Address Cards */
.address-card {
  border-left: 4px solid var(--primary-color);
}

.address-card.is-default {
  border-left-color: var(--success-color);
}

/* Product Detail Images */
#main-image {
  border-radius: 8px;
  cursor: zoom-in;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
}

.empty-state i {
  font-size: 4rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

/* Price Display */
.price-original {
  text-decoration: line-through;
  color: var(--secondary-color);
  font-size: 0.9em;
}

.price-discount {
  color: var(--danger-color);
  font-weight: bold;
  font-size: 1.2em;
}

.price-normal {
  font-weight: bold;
  font-size: 1.2em;
}

/* Global Page Styles */
body {
  font-family: "Vazirmatn", sans-serif;
  background: #f8f9fa;
}

main {
  min-height: calc(100vh - 200px);
  padding: 0;
}

/* Product List Page */
.product-list-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin-bottom: 20px;
}

.product-list-page .card-header {
  border-radius: 10px 10px 0 0;
  font-weight: bold;
}

.product-list-page .list-group-item {
  border: none;
  border-bottom: 1px solid #e9ecef;
  transition: all 0.3s;
}

.product-list-page .list-group-item:hover {
  background: #f8f9fa;
  padding-right: 25px;
}

.product-list-page .list-group-item.active {
  background: var(--primary-color);
  color: white;
}

.product-list-page .product-card {
  transition: transform 0.3s, box-shadow 0.3s;
  height: 100%;
}

.product-list-page .product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Cart Page */
.cart-page .table {
  background: white;
  border-radius: 10px;
  overflow: hidden;
}

.cart-page .table thead {
  background: var(--primary-color);
  color: white;
}

.cart-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.cart-page .card-header {
  border-radius: 10px 10px 0 0;
  font-weight: bold;
}

/* Product Detail Page */
.product-detail-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.product-detail-page .breadcrumb {
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-detail-page .img-thumbnail {
  cursor: pointer;
  transition: all 0.3s;
}

.product-detail-page .img-thumbnail:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

/* Account Pages */
.account-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.account-page .nav-link {
  color: #333;
  transition: all 0.3s;
}

.account-page .nav-link:hover,
.account-page .nav-link.active {
  background: var(--primary-color);
  color: white;
}

/* Checkout Page */
.checkout-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.checkout-page .form-control:focus,
.checkout-page .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(204, 163, 93, 0.25);
}

/* Orders Page */
.orders-page .card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin-bottom: 20px;
}

.orders-page .badge {
  padding: 8px 15px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .product-list-page .col-lg-3 {
    margin-bottom: 20px;
  }

  .cart-page .table {
    font-size: 14px;
  }

  .product-detail-page .col-md-6 {
    margin-bottom: 20px;
  }
}

/* Product List Page Styles */
.product-list-page {
  padding: 40px 0;
  background: #f8f9fa;
  min-height: calc(100vh - 200px);
}

.product-list-sidebar {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.product-list-sidebar .card-header {
  background: var(--primary-color);
  color: white;
  border-radius: 8px 8px 0 0;
  padding: 15px;
  font-weight: bold;
}

.product-list-sidebar .list-group-item {
  border: none;
  border-bottom: 1px solid #e9ecef;
  padding: 12px 15px;
  transition: all 0.3s;
}

.product-list-sidebar .list-group-item:hover {
  background: #f8f9fa;
  padding-right: 20px;
}

.product-list-sidebar .list-group-item.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.product-search-filter {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.product-grid-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.product-grid-container .row {
  margin: 0 -10px;
}

.product-grid-container .col-md-6,
.product-grid-container .col-lg-4 {
  padding: 10px;
}

.product-grid-container .product-card {
  height: 100%;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s;
}

.product-grid-container .product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

.product-grid-container .product-card img {
  transition: transform 0.3s;
}

.product-grid-container .product-card:hover img {
  transform: scale(1.05);
}

/* Product Detail Page Styles */
.product-detail-page {
  padding: 40px 0;
  background: #f8f9fa;
  min-height: calc(100vh - 200px);
}

.product-detail-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.product-image-main {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.product-image-thumbnails {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.product-image-thumbnail {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s;
}

.product-image-thumbnail:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.product-image-thumbnail.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(204, 163, 93, 0.2);
}

.product-info-section h1 {
  color: #333;
  font-size: 32px;
  margin-bottom: 20px;
  font-weight: bold;
}

.product-price-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
}

.product-price-section .price-original {
  font-size: 18px;
  margin-left: 15px;
}

.product-price-section .price-discount {
  font-size: 28px;
  color: var(--danger-color);
}

.product-price-section .price-normal {
  font-size: 28px;
  color: var(--primary-color);
}

.product-badges {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.product-description-section {
  background: white;
  border-radius: 10px;
  padding: 30px;
  margin-top: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.product-description-section .card-header {
  background: var(--primary-color);
  color: white;
  border-radius: 8px 8px 0 0;
  padding: 15px 20px;
  font-weight: bold;
  font-size: 18px;
}

.product-description-section .card-body {
  padding: 20px;
  line-height: 1.8;
  color: #555;
}

.related-products-section {
  margin-top: 50px;
  padding: 30px 0;
}

.related-products-section h3 {
  color: var(--primary-color);
  font-size: 28px;
  margin-bottom: 30px;
  font-weight: bold;
}

/* Category Detail Page */
.category-detail-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1D322D 100%);
  color: white;
  padding: 40px 0;
  border-radius: 10px;
  margin-bottom: 30px;
  text-align: center;
}

.category-detail-header h1 {
  font-size: 36px;
  margin-bottom: 10px;
}

.category-detail-header p {
  font-size: 18px;
  opacity: 0.9;
}

/* Cart Page Styles */
.cart-page {
  padding: 40px 0;
  background: #f8f9fa;
  min-height: calc(100vh - 200px);
}

.cart-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  transition: background 0.3s;
}

.cart-item:hover {
  background: #f8f9fa;
}

.cart-item-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-left: 20px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.cart-item-price {
  font-size: 16px;
  color: var(--primary-color);
  font-weight: bold;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-summary {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 25px;
  margin-top: 30px;
}

.cart-summary h4 {
  color: #333;
  margin-bottom: 20px;
  font-weight: bold;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e9ecef;
}

.cart-summary-row.total {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
  border-bottom: none;
  margin-top: 10px;
  padding-top: 20px;
  border-top: 2px solid var(--primary-color);
}

/* Checkout Page Styles */
.checkout-page {
  padding: 40px 0;
  background: #f8f9fa;
  min-height: calc(100vh - 200px);
}

.checkout-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.checkout-section {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 2px solid #e9ecef;
}

.checkout-section:last-child {
  border-bottom: none;
}

.checkout-section h4 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-weight: bold;
}

/* Account Pages Styles */
.account-page {
  padding: 40px 0;
  background: #f8f9fa;
  min-height: calc(100vh - 200px);
}

.account-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.account-sidebar {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.account-sidebar .nav-link {
  color: #333;
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 5px;
  transition: all 0.3s;
}

.account-sidebar .nav-link:hover {
  background: var(--primary-color);
  color: white;
}

.account-sidebar .nav-link.active {
  background: var(--primary-color);
  color: white;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .product-list-sidebar {
    margin-bottom: 20px;
  }

  .product-grid-container .col-md-6,
  .product-grid-container .col-lg-4 {
    margin-bottom: 20px;
  }

  .product-info-section h1 {
    font-size: 24px;
  }

  .cart-item {
    flex-direction: column;
    text-align: center;
  }

  .cart-item-image {
    margin: 0 auto 15px;
  }

  .product-image-thumbnails {
    justify-content: center;
  }
}
