body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Cart badge animation */
.cart-badge-container {
    position: relative;
    display: inline-flex;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    background-color: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Custom scrollbar for filter area */
.space-y-2::-webkit-scrollbar {
    width: 6px;
}

.space-y-2::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.space-y-2::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.space-y-2::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Toast notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Product card hover effect */
.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-4px);
}

.product-card img {
    transition: transform 0.3s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

/* Button ripple effect */
button {
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

/* Focus styles for accessibility */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Loading state */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    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); }
}

/* Smooth page transitions */
main {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .cart-badge-container,
    button,
    input[type="submit"] {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(to bottom right, #1e293b, #0f172a);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    a {
        text-decoration: underline;
    }

    button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .cart-count {
        font-size: 10px;
        min-width: 18px;
        height: 18px;
    }

    .toast-notification {
        bottom: 16px;
        right: 16px;
        left: 16px;
        padding: 14px 18px;
    }
}

/* Responsive tweaks */
html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Better touch targets on mobile */
@media (max-width: 768px) {
    button,
    a {
        min-height: 44px;
    }
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* SVG icon sizing */
svg {
    flex-shrink: 0;
}

/* Mobile menu animation */
#mobile-menu {
    transition: all 0.3s ease;
}

/* Mobile filter toggle arrow */
#filter-arrow {
    transition: transform 0.3s ease;
}

#filter-arrow.rotate-180 {
    transform: rotate(180deg);
}

/* ============================================
   Product Description Content Styles
   Tailwind-flavored HTML tag styles for product description
   ============================================ */

.product-description-content {
    color: #374151;
    font-size: 1rem;
    line-height: 1.75;
    word-wrap: break-word;
}

.product-description-content > *:first-child {
    margin-top: 0 !important;
}

.product-description-content > *:last-child {
    margin-bottom: 0 !important;
}

.product-description-content p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.product-description-content h1,
.product-description-content h2,
.product-description-content h3,
.product-description-content h4,
.product-description-content h5,
.product-description-content h6 {
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.product-description-content h1 { font-size: 1.875rem; }
.product-description-content h2 { font-size: 1.5rem; }
.product-description-content h3 { font-size: 1.25rem; }
.product-description-content h4 { font-size: 1.125rem; }
.product-description-content h5 { font-size: 1rem; }
.product-description-content h6 { font-size: 0.875rem; color: #4b5563; }

.product-description-content ul,
.product-description-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.product-description-content ul li {
    list-style-type: disc;
    margin-bottom: 0.25rem;
    line-height: 1.75;
}

.product-description-content ol li {
    list-style-type: decimal;
    margin-bottom: 0.25rem;
    line-height: 1.75;
}

.product-description-content strong {
    font-weight: 600;
    color: #1f2937;
}

.product-description-content em {
    font-style: italic;
}

.product-description-content a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.product-description-content a:hover {
    color: #1d4ed8;
}

.product-description-content blockquote {
    border-left: 4px solid #3b82f6;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: #6b7280;
    font-style: italic;
    background-color: #eff6ff;
    border-radius: 0 0.375rem 0.375rem 0;
}

.product-description-content code {
    background-color: #f3f4f6;
    color: #be185d;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875em;
}

.product-description-content pre {
    background-color: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.product-description-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.product-description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.product-description-content hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 1.5rem 0;
}

.product-description-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.product-description-content th,
.product-description-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.product-description-content th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.product-description-content tr:nth-child(even) {
    background-color: #f9fafb;
}

.product-description-content div {
    margin: 0.5rem 0;
}

.specs-content {
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.specs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 14px;
    background-color: #ffffff;
    border-radius: 6px;
    overflow: hidden;
}

.specs-content table td {
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    text-align: left;
}

.specs-content table td strong {
    color: #1f2937;
    font-weight: 600;
}

.specs-content table tr:nth-child(even) td {
    background-color: #f9fafb;
}

.specifications-table {
    margin: 0;
}

/* wangEditor editor area styles (for admin panel) */
.w-e-text {
    color: #374151 !important;
    font-size: 1rem !important;
    line-height: 1.75 !important;
}

.w-e-text p {
    margin-bottom: 1rem !important;
    line-height: 1.75 !important;
}

.w-e-text h1,
.w-e-text h2,
.w-e-text h3,
.w-e-text h4,
.w-e-text h5,
.w-e-text h6 {
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #1f2937 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

.w-e-text h1 { font-size: 1.875rem !important; }
.w-e-text h2 { font-size: 1.5rem !important; }
.w-e-text h3 { font-size: 1.25rem !important; }
.w-e-text h4 { font-size: 1.125rem !important; }
.w-e-text h5 { font-size: 1rem !important; }
.w-e-text h6 { font-size: 0.875rem !important; color: #4b5563 !important; }

.w-e-text ul,
.w-e-text ol {
    margin: 1rem 0 !important;
    padding-left: 1.5rem !important;
}

.w-e-text ul li {
    list-style-type: disc !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.75 !important;
}

.w-e-text ol li {
    list-style-type: decimal !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.75 !important;
}

.w-e-text strong {
    font-weight: 600 !important;
    color: #1f2937 !important;
}

.w-e-text em {
    font-style: italic !important;
}

.w-e-text a {
    color: #2563eb !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
}

.w-e-text blockquote {
    border-left: 4px solid #3b82f6 !important;
    padding: 0.75rem 1rem !important;
    margin: 1rem 0 !important;
    color: #6b7280 !important;
    font-style: italic !important;
    background-color: #eff6ff !important;
    border-radius: 0 0.375rem 0.375rem 0 !important;
}

.w-e-text code {
    background-color: #f3f4f6 !important;
    color: #be185d !important;
    padding: 0.125rem 0.375rem !important;
    border-radius: 0.25rem !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-size: 0.875em !important;
}

.w-e-text pre {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    padding: 1rem !important;
    border-radius: 0.5rem !important;
    overflow-x: auto !important;
    margin: 1rem 0 !important;
    font-size: 0.875rem !important;
}

.w-e-text pre code {
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
}

.w-e-text img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.w-e-text hr {
    border: 0 !important;
    border-top: 1px solid #e5e7eb !important;
    margin: 1.5rem 0 !important;
}

.w-e-text table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 1rem 0 !important;
    font-size: 0.875rem !important;
}

.w-e-text th,
.w-e-text td {
    border: 1px solid #e5e7eb !important;
    padding: 0.5rem 0.75rem !important;
    text-align: left !important;
}

.w-e-text th {
    background-color: #f9fafb !important;
    font-weight: 600 !important;
    color: #374151 !important;
}

.w-e-text tr:nth-child(even) {
    background-color: #f9fafb !important;
}
