:root {
    --primary-color: #8e44ad; /* 紫色系 */
    --secondary-color: #6c3483; /* 深紫色 */
    --light-color: #f3e5f5; /* 淡紫色 */
    --dark-color: #4a235a; /* 深紫色 */
    --accent-color: #2c3e50; /* 深灰色點綴 */
}
a {
    text-decoration: none  !important;
}
.navbar { 
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.navbar-brand, .nav-link { 
    color: white !important; 
    font-weight: 500;
}

.product-card { 
    transition: transform 0.3s, box-shadow 0.3s; 
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}
.product-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 10px 25px rgba(142, 68, 173, 0.15);
}
.product-img { 
    /*height: 250px; */
    width: 100%;
    background: var(--light-color);
    aspect-ratio: 1 / 1;   /* 這行讓元素保持正方形 */
    object-fit: cover;     /* 圖片填滿並裁切，而不是變形 */
}
.product-price { 
    color: var(--primary-color); 
    font-weight: bold;
    font-size: 1.2em;
}
.original-price {
    color: #9e9e9e;
    font-size: 0.9em;
}
.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 1;
}
.sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #e74c3c, #e67e22);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 1;
}
.new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 1;
}

.category-sidebar { 
    background: linear-gradient(135deg, var(--light-color) 0%, #ffffff 100%);
    border-radius: 12px; 
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #f8f8f8;
}
.category-list a { 
    color: var(--dark-color); 
    text-decoration: none; 
    display: block; 
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    font-weight: 500;
}
.category-list a:hover { 
    color: var(--dark-color); 
    background-color: rgba(142, 68, 173, 0.05);
    padding-left: 15px;
    transform: translateX(5px);
}
.category-list a:last-child {
    border-bottom: none;
}

.section-title {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 40px 0 25px 0;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.5em;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 80px 0;
    margin-bottom: 50px;
    border-radius: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><polygon fill="rgba(255,255,255,0.05)" points="0,1000 1000,0 1000,1000"/></svg>');
}

.price-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border: none;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(142, 68, 173, 0.4);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 搜索框样式 */
.search-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 0px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.search-type-select {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    border-color: #e0e0e0;
}
.search-input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-color: #e0e0e0;
}

.stats-card {
    background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.product-category {
    font-size: 0.85em;
    color: var(--accent-color);
    font-weight: 500;
    margin-bottom: 5px;
}

.benefit-tag {
    display: inline-block;
    background: rgba(142, 68, 173, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 0;
        margin-bottom: 30px;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-section p.lead {
        font-size: 1.2rem;
    }
}

/* 分類側邊欄樣式 */
.category-sidebar {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.category-sidebar h5 {
    color: #2c3e50;
    border-bottom: 2px solid #8e44ad;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: 600;
}

.category-list a {
    display: block;
    padding: 12px 15px;
    color: #34495e;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.category-list > a {
    background: #f8f9fa;
    font-weight: 600;
    border-left-color: #8e44ad;
}

.category-list > a:hover {
    background: #8e44ad;
    color: white;
    transform: translateX(5px);
}

.category-group {
    margin-bottom: 8px;
}

.category-main {
    display: block;
    padding: 12px 15px;
    /*background: linear-gradient(135deg, #e19aff 0%, #eccff7 100%);*/
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    font-weight: 500;
    position: relative;
}

.category-main:hover {
    background: linear-gradient(135deg, #eccff7 0%, #e19aff 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.category-main .fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.category-group.expanded .category-main .fa-chevron-down {
    transform: rotate(180deg);
}

.subcategory-list {
    padding-left: 25px;
    margin-top: 8px;
    display: none;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 5px;
}

.category-group.expanded .subcategory-list {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.subcategory-item {
    display: block;
    padding: 10px 15px;
    color: #5d6d7e;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    margin-bottom: 3px;
    font-size: 0.9rem;
    border-left: 3px solid #bdc3c7;
}

.subcategory-item:hover {
    color: #8e44ad;
    background: #f3e5f5;
    border-left-color: #8e44ad;
    text-decoration: none;
    transform: translateX(5px);
}

.subcategory-item.active {
    color: #8e44ad;
    background: #f3e5f5;
    border-left-color: #8e44ad;
    font-weight: 600;
}

/* 统计卡片样式 */
.stats-card {
    background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.stats-card h6 {
    margin-bottom: 15px;
    font-weight: 600;
}

.stats-card p {
    margin-bottom: 8px;
    opacity: 0.9;
}

.benefit-tag {
    display: inline-block;
    background: #8e44ad;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    margin: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* =============================
   Added (integrated) components
   from user's <style> block
   ============================= */

/* Optional: control product image height via CSS variable */
:root {
  --product-img-h: 250px; /* change to 200px if you prefer the tighter card */
}

/* Ensure cards stretch evenly in Bootstrap/GRID columns */
.product-card { 
  height: 100%;
}

/* Let height be controlled by variable without breaking existing look */


/* Badges (new) */
.out-of-stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #6c757d;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
  z-index: 1;
}

/* Sidebar & lists (keeps existing styles; these are compatible) */
.active-category {
  background-color: var(--primary-color) !important;
  color: #fff !important;
}

/* Pagination styles */
.pagination .page-link {
  color: var(--primary-color);
}
.pagination .page-item.active .page-link {
  background-color: var(--light-color);
  border-color: var(--primary-color);
}

/* Result summary */
.results-info {
  background-color: #f8f9fa;
  padding: 10px 15px;
  border-radius: 5px;
  margin-bottom: 20px;
}

/* Price stack helper */
.price-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Call service hint */
.contact-service {
  color: #dc3545;
  font-weight: bold;
  font-size: 0.9em;
  text-align: center;
  padding: 5px;
  background-color: #fff3cd;
  border-radius: 4px;
  margin-top: 10px;
}

/* Button states */
.btn-out-of-stock {
  background-color: #6c757d;
  color: #fff;
  cursor: not-allowed;
}

/* Search controls (compatible with existing) */
.search-type-select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.search-input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Minor product meta */
.product-model {
  color: #6c757d;
  font-size: 0.9em;
}

/* Debug panel */
.debug-info {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 15px;
  font-size: 0.9em;
  color: #6c757d;
}

/* Add-to-cart loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-right-color: transparent;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Product attributes (color/size/stock) ===== */
.product-attributes {
  margin: 10px 0;
  font-size: 0.85em;
}
.color-section { margin-bottom: 10px; }
.attributes-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  font-size: 0.8em;
}
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.color-option {
/*  width: 20px;
  height: 20px;*/
  border-radius: 20%;
  padding: 4px 8px;
  border: 2px solid #ddd;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}
.color-option:hover { transform: scale(1.1); border-color: #666; }
.color-option.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}
.color-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}

.color-option:hover .color-tooltip { opacity: 1; }

.size-options {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
}
.size-options.active { display: flex; }

.size-option {
  padding: 2px 6px;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  font-size: 0.75em;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.size-option:hover { transform: scale(1.05); }
.size-option.active {
  border-color: #2563eb;
  background: #e6f0ff;
  font-weight: bold;
}
.size-option.in-stock {
  border-color: #28a745;
  background: #f8fff9;
  color: #155724;
}
.size-option.low-stock {
  border-color: #ffc107;
  background: #fffdf4;
  color: #856404;
}
.size-option.out-of-stock {
  border-color: #dc3545;
  background: #fef7f7;
  color: #721c24;
  text-decoration: line-through;
  cursor: not-allowed;
}
.size-option.out-of-stock:hover { transform: none; }

.stock-info {
  color: #6c757d;
  font-size: 0.8em;
  margin-top: 8px;
}
.low-stock { color: #dc3545; font-weight: bold; }

/* Selection guidance */
.selection-info {
  background: #e6f0ff;
  border: 1px solid #2563eb;
  border-radius: 4px;
  padding: 5px 8px;
  margin-top: 8px;
  font-size: 0.75em;
  color: #2563eb;
}

/* Attributes container separator */
.attributes-container {
  border-top: 1px solid #eee;
  padding-top: 10px;
  margin-top: 10px;
}
