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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f6fa;
  color: #333;
  line-height: 1.6;
}

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

/* Responsive Visibility */
.desktop-only {
  display: table !important;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  
  .mobile-only {
    display: block !important;
  }
}

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.logo h1 {
  font-size: 28px;
  margin: 0;
}

.logo a {
  color: white;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
  position: relative;
}

.nav a:hover {
  opacity: 0.8;
}

.cart-link {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* Main Content */
.main-content {
  min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
}

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

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

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

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

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-lg {
  padding: 15px 40px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
}

/* Sections */
.categories-section,
.products-section,
.features-section {
  padding: 60px 0;
}

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

.section-header h2 {
  font-size: 36px;
  margin-bottom: 10px;
  color: #333;
}

.section-header p {
  font-size: 18px;
  color: #666;
}

/* Categories Grid - Modern 4-Column Cards */
.categories-section {
  background: #f8f9fa;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .categories-grid {
    grid-template-columns: 1fr;
  }
}

.category-card {
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: #333;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-color, #667eea);
  transition: width 0.3s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border-color: var(--card-color, #667eea);
}

.category-card:hover::before {
  width: 6px;
}

.category-icon {
  width: 60px;
  height: 60px;
  min-width: 60px;
  background: var(--card-color, #667eea);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-card:hover .category-icon {
  transform: scale(1.1);
}

.category-info {
  flex: 1;
}

.category-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #333;
}

.category-info .product-count {
  font-size: 14px;
  color: #888;
}

.category-arrow {
  color: #ccc;
  font-size: 14px;
  transition: all 0.3s ease;
}

.category-card:hover .category-arrow {
  color: var(--card-color, #667eea);
  transform: translateX(4px);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
}

.product-card {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s;
  position: relative;
}

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

.product-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #ff4757;
  color: white;
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1;
}

.product-badge.sale {
  background: #ff4757;
}

.product-badge.out-of-stock {
  background: #95a5a6;
}

.product-image {
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: #f8f9fa;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .product-image img {
  transform: scale(1.1);
}

.product-info {
  padding: 20px;
}

.product-info h3 {
  margin-bottom: 10px;
}

.product-info h3 a {
  color: #333;
  text-decoration: none;
  font-size: 18px;
}

.product-info h3 a:hover {
  color: #667eea;
}

.product-category {
  color: #999;
  font-size: 13px;
  margin-bottom: 10px;
}

.product-price {
  margin: 15px 0;
  font-size: 24px;
  font-weight: 700;
}

.price-old {
  text-decoration: line-through;
  color: #999;
  font-size: 18px;
  margin-right: 10px;
}

.price-new {
  color: #667eea;
}

/* Features Section */
.features-section {
  background: white;
}

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

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

.feature-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: white;
  font-size: 30px;
}

.feature-box h4 {
  font-size: 20px;
  margin-bottom: 10px;
  color: #333;
}

.feature-box p {
  color: #666;
  font-size: 14px;
}

/* Cart Page */
.empty-cart {
  text-align: center;
  padding: 80px 20px;
}

.empty-cart i {
  font-size: 80px;
  color: #ddd;
  margin-bottom: 20px;
}

.empty-cart h3 {
  font-size: 28px;
  margin-bottom: 15px;
  color: #333;
}

.cart-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin: 40px 0;
}

.cart-table {
  width: 100%;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.cart-table th,
.cart-table td {
  padding: 20px;
  text-align: left;
}

.cart-table th {
  background: #f8f9fa;
  font-weight: 600;
}

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

.cart-product img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #e1e8ed;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s;
}

.qty-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.qty-input {
  width: 60px;
  text-align: center;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  padding: 6px;
}

.btn-remove {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s;
}

.btn-remove:hover {
  color: #c82333;
}

/* Desktop/Mobile Toggle */
.desktop-only {
  display: table;
}

.mobile-only {
  display: none;
}

/* Mobile Cart Cards */
.cart-mobile {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.cart-card-top {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.cart-card-top img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.cart-card-info {
  flex: 1;
  min-width: 0;
}

.cart-card-info h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.3;
}

.cart-card-info h4 a {
  color: #333;
  text-decoration: none;
}

.cart-card-price {
  color: #667eea;
  font-weight: 600;
  font-size: 15px;
}

.btn-remove-mobile {
  background: #ffebee;
  border: none;
  color: #d32f2f;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.cart-card-total {
  text-align: right;
}

.cart-card-total span {
  font-size: 12px;
  color: #888;
  display: block;
}

.cart-card-total strong {
  font-size: 16px;
  color: #333;
}

.cart-summary {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  height: fit-content;
}

.cart-summary h3 {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 16px;
}

.summary-row.total {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
  padding-top: 15px;
  border-top: 2px solid #f0f0f0;
  margin-top: 15px;
}

.free-shipping-notice {
  background: #d4edda;
  color: #155724;
  padding: 12px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 14px;
  text-align: center;
}

/* Order Result Page */
.order-result-page {
  padding: 60px 0;
}

.result-box {
  background: white;
  padding: 60px 40px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.result-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.result-box.success .result-icon {
  color: #28a745;
}

.result-box.error .result-icon {
  color: #dc3545;
}

.result-box h1 {
  font-size: 32px;
  margin-bottom: 15px;
}

.result-box p {
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
}

.order-details,
.order-info,
.order-items {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
  text-align: left;
}

.order-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e1e8ed;
}

.order-detail-row:last-child {
  border-bottom: none;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Footer */
.footer {
  background: #2c3e50;
  color: white;
  padding: 40px 0 20px;
  margin-top: 60px;
}

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

.footer-col h3,
.footer-col h4 {
  margin-bottom: 15px;
}

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

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-col a:hover {
  color: white;
}

.social-links {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.social-links a {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s;
}

.social-links a:hover {
  background: #667eea;
}

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

/* Responsive */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 32px;
  }

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

  .cart-content {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }
}

/* Page Headers */
.page-header {
  margin: 40px 0;
  text-align: center;
}

.page-header h1 {
  font-size: 36px;
  margin-bottom: 10px;
}

.filters-bar {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group select {
  padding: 10px 15px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  background: white;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 40px;
}

.pagination-info {
  color: #666;
}

/* Checkout Forms */
.checkout-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-top: 30px;
}

.checkout-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.checkout-section h3 {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 13px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.order-summary {
  margin-bottom: 20px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.summary-item-info {
  display: flex;
  flex-direction: column;
}

.summary-divider {
  height: 2px;
  background: #f0f0f0;
  margin: 15px 0;
}

.payment-info {
  text-align: center;
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  color: #666;
  font-size: 14px;
}

@media (max-width: 768px) {
  .checkout-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
  }

  .checkout-section {
    padding: 15px;
  }

  .checkout-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  /* Header Mobile */
  .header-content {
    flex-wrap: wrap;
  }

  .nav {
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: 15px;
  }

  /* Hero Mobile */
  .hero {
    padding: 50px 0;
  }

  .hero-content h1 {
    font-size: 28px;
  }

  .hero-content p {
    font-size: 16px;
  }

  /* Products Grid Mobile */
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .product-image {
    height: 200px;
  }

  .product-info {
    padding: 15px;
  }

  .product-info h3 a {
    font-size: 14px;
  }

  .product-price {
    font-size: 18px;
  }

  /* Cart Mobile */
  .cart-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .cart-summary {
    padding: 20px;
  }

  .cart-summary h3 {
    font-size: 16px;
    margin-bottom: 15px;
  }

  /* Features Mobile */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  /* Section Headers */
  .section-header h2 {
    font-size: 24px;
  }

  .section-header p {
    font-size: 14px;
  }

  /* Buttons */
  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .btn-lg {
    padding: 12px 25px;
    font-size: 16px;
  }

  /* Result Actions */
  .result-actions {
    flex-direction: column;
  }

  /* Container */
  .container {
    padding: 0 15px;
  }

  /* Page Header */
  .page-header h1 {
    font-size: 24px;
  }

  /* Filters */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group select {
    width: 100%;
  }
}
