:root {
    --primary-color: #7C3AED;
    --secondary-color: #5B21B6;
    --accent-color: #10B981;
    --background-color: #ffffff;
    --text-color: #333333;
    --card-background: #ffffff;
    --hover-background: #f5f5f5;
    --chart-text: #333333;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --muted-text: #666666;
    --recommendation-text: #333333;
}

[data-theme="dark"] {
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --card-background: #2d2d2d;
    --hover-background: #363636;
    --chart-text: #ffffff;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    --muted-text: #cccccc;
    --recommendation-text: #ffffff;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
    contain: content;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
    contain: layout style paint;
    will-change: transform;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    perspective: 1000px;
}

h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    transform-style: preserve-3d;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotateX(0); }
    50% { transform: translateY(-10px) rotateX(5deg); }
}

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

.product-card {
    background: var(--card-background);
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--card-shadow);
    contain: layout style;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    background: var(--hover-background);
}

.product-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 1rem;
}

.platform-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.platform-badge.amazon {
    background: #FF9900;
    color: #000;
}

.platform-badge.flipkart {
    background: #2874F0;
    color: #fff;
}

.platform-badge.croma {
    background: #212121;
    color: #fff;
}

.platform-badge.shopclues {
    background: #2CB742;
    color: #fff;
}

.platform-badge.meesho {
    background: #F43397;
    color: #fff;
}

.platform-badge.myntra {
    background: #FF3F6C;
    color: #fff;
}

.platform-badge.healthkart {
    background: #00B5B7;
    color: #fff;
}

.platform-badge.ajio {
    background: #2C4152;
    color: #fff;
}

.platform-badge.netmeds {
    background: #32AEB1;
    color: #fff;
}

.platform-badge.nykaa {
    background: #FC2779;
    color: #fff;
}

.platform-badge.nykaafashion {
    background: #FD7685;
    color: #fff;
}

.platform-badge.test {
    background: linear-gradient(45deg, #4CAF50, #2196F3);
    color: white;
}
.product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.product-title {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -moz-box;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    display: box;
    line-clamp: 2;
    box-orient: vertical;
    max-height: 2.8em;
}

.product-price {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.current-price.increase {
    color: #ff4d4d !important;
}

.current-price.decrease {
    color: #2ecc71 !important;
}

.current-price.out-of-stock {
    color: #ff4d4d !important;
    font-style: italic;
    font-weight: 500;
}

.savings {
    font-size: 0.875rem;
    color: #10B981;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.product-actions button,
.product-actions a {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: 2px solid transparent;
}

.show-history {
    background: var(--primary-color);
    color: white;
}

.buy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 28px;
    border-radius: 12px;
    text-decoration: none;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transition: all 0.3s ease;
    border: none;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.buy-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.6s ease;
}

.buy-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.buy-btn:hover::before {
    left: 100%;
}

.buy-btn i {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.buy-btn:hover i {
    transform: translateX(4px) scale(1.1);
}

.view-product {
    background: var(--secondary-color);
    color: white;
}

.show-history:hover,
.view-product:hover {
    opacity: 0.9;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.search-bar {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.search-bar input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

.search-bar input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-bar i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    opacity: 0.7;
}

.sort-control {
    min-width: 150px;
}

.sort-control select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
}

.view-history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transition: all 0.3s ease;
    border: none;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
    font-size: 1rem;
}

.view-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.view-history-btn i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.view-history-btn:hover i {
    transform: scale(1.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background: #1a1a1a;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
}

/* Chart and Stats Container */
.price-history-page {
    position: relative;
    z-index: 1;
    background: rgba(var(--background-rgb), 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 15px;
    margin: 10px auto;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.large-chart-container {
    position: relative;
    background: var(--chart-background);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

#price-chart-container {
    width: 100%;
    height: 400px;
}

.chart-info {
    padding: 0;
    margin: 0;
    background: none;
    box-shadow: none;
}

.price-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 0;
    padding: 0;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat .value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .price-history-page {
        margin: 0 auto;
        padding: 10px;
    }

    .large-chart-container {
        padding: 15px;
    }

    .price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .price-history-page {
        margin: 0;
        padding: 10px 5px;
        border-radius: 0;
        backdrop-filter: blur(10px);  /* Reduced blur for better performance */
        -webkit-backdrop-filter: blur(10px);
    }

    .large-chart-container {
        padding: 10px;
        margin-bottom: 30px;
    }

    #price-chart-container {
        height: 300px;
        margin-bottom: 20px;
    }

    .price-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-top: 10px;
    }

    .stat {
        padding: 10px;
    }

    .stat .label {
        font-size: 0.8rem;
    }

    .stat .value {
        font-size: 1rem;
    }
}

/* Fix initial page load */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--background-color);
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

main {
    margin-top: 0;
}

header {
    margin-bottom: 15px;
}

@media (max-width: 480px) {
    header {
        margin-bottom: 10px;
    }

    .product-details {
        margin-top: 0;
    }
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    background: var(--card-background);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.nav-link:hover i {
    transform: scale(1.1);
}

.nav-link.active {
    background: var(--card-background);
    color: var(--text-color);
}

.nav-link.active:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.deals-container {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--card-shadow);
}

.deals-container iframe {
    border-radius: 8px;
    background: white;
}

/* Header text styles */
.subtitle {
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 10px 0;
}

.info-text {
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: inline-block;
    margin: 10px 0;
    font-weight: 500;
}

/* Recommendation box styles */
.recommendation-box {
    background: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--accent-color);
}

.recommendation-box h3 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

.recommendation {
    color: var(--accent-color);
    font-size: 1.1rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

[data-theme="light"] .recommendation {
    color: var(--text-color);
}

.recommendation i {
    color: var(--accent-color);
    font-size: 1.2em;
}

/* Price history page specific styles */
.price-history-page {
    color: var(--text-color);
}

.price-history-page h1 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.price-history-page h2 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin: 1rem 0;
}

.price-history-page p {
    color: var(--text-color);
    line-height: 1.6;
}

.product-meta {
    color: var(--muted-text);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.price-history-page .view-product {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transition: all 0.3s ease;
    border: none;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.price-history-page .view-product::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.6s ease;
}

.price-history-page .view-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.price-history-page .view-product:hover::before {
    left: 100%;
}

.price-history-page .view-product i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.price-history-page .view-product:hover i {
    transform: translateX(4px) scale(1.1);
}

.view-product-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    background: var(--primary-color);
    transition: all 0.3s ease;
    border: none;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
    position: relative;
    overflow: hidden;
}

.view-product-button:hover {
    transform: translateY(-2px);
    background: var(--accent-color);
    color: white;
    box-shadow: 0 6px 20px rgba(227, 79, 10, 0.4);
}

.view-product-button i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.view-product-button:hover i {
    transform: translateX(4px) scale(1.1);
}

.view-product-inline {
    display: inline-flex;
    margin-left: 16px;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 0 auto;
        max-width: 400px;
    }

    .product-card {
        padding: 1rem;
    }

    .product-image {
        height: 200px;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.2rem;
    }

    .view-history-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 0.5rem auto;
        padding: 1rem;
        border-radius: 16px;
    }
    
    .price-info {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .price-stat {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .graph-container {
        height: 300px;
        margin: 1.5rem 0;
        padding: 0.8rem;
    }

    .buy-btn {
        padding: 0.8rem 2rem;
        font-size: 0.9rem;
        width: 100%;
        text-align: center;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0.8rem;
    }

    .products-grid {
        gap: 0.8rem;
    }

    .product-card {
        border-radius: 16px;
    }

    .product-image {
        height: 180px;
    }

    .modal-content {
        padding: 0.8rem;
        margin: 0.3rem;
        width: 98%;
    }

    .graph-container {
        height: 250px;
    }

    .price-stat {
        padding: 0.8rem;
        font-size: 0.85rem;
    }
}

/* Handle notch devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .container {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Reduce animations on devices that prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.buy-button {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;  
    margin: 0 auto;     
}

.buy-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 2px;  
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.buy-now-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-width: 160px;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    background-size: 200% 100%;
    transition: all 0.3s ease;
    border: none;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.buy-now-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    background-position: 100% 0;
}

.buy-now-button i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.buy-now-button:hover i {
    transform: translateX(4px);
}

/* Mobile Styles */
@media (max-width: 480px) {
    .buy-now-button {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
        background-size: 100% 100%;
    }
}

.buy-button-container {
    display: flex;
    justify-content: center;
    width: 15%;  
    margin-top: 12px;  
}

.buy-now-button i {
    font-size: 1rem;  
    margin-right: 4px;
}

.buy-now-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #02c5ad, #96c93d);
}

.buy-now-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.recommendation-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--card-shadow);
}

.recommendation-box h3 {
    margin: 0 0 10px 0;
    color: #fff;
    font-size: 18px;
}

.recommendation {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #fff;
}

.price-history-page {
    position: relative;
    z-index: 1;
    background: rgba(var(--background-rgb), 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 15px;
    margin: 20px auto;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.price-history-page header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.product-details {
    background: var(--card-background);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-info {
    margin-bottom: 0;  
}

.large-chart-container {
    position: relative;
    background: var(--chart-background);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin: 0;  
    box-shadow: var(--card-shadow);
    min-height: 400px;  
}

#price-chart-container {
    width: 100%;
    height: 100%;
    min-height: 350px;
}

.chart-info {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.price-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 0;
}

@media (max-width: 768px) {
    .price-history-page header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .large-chart-container {
        padding: 10px;
        margin: 0;
    }

    .chart-info {
        margin-top: 20px;
    }

    .price-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .price-stats {
        grid-template-columns: 1fr;
    }

    .product-details {
        padding: 10px;
    }

    #price-chart-container {
        min-height: 300px;  
    }
}

.time-range-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0 10px;
}

.time-range-filters button {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-range-filters button.active {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 480px) {
    .time-range-filters {
        padding: 0 5px;
    }

    .time-range-filters button {
        min-width: 70px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Price colors */
.highest-price { color: #ff6b81 !important; }
.lowest-price { color: #26de81 !important; }
.average-price { color: #fed330 !important; }

/* Background animation */
.product-grid {
    position: relative;
    overflow: hidden;
}

.product-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(46, 204, 113, 0.1), rgba(52, 152, 219, 0.1));
    animation: gradientBG 15s ease infinite;
    z-index: -1;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.action-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 11%;
    margin: 12px auto;
}

.buy-button-container {
    display: flex;
    justify-content: center;
    width: fit-content;
}

.buy-now-button {
    width: fit-content;
    padding: 8px 16px;
    white-space: nowrap;
}

.view-product-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin: 0;
    text-decoration: none;
    line-height: 1.2;
}

.view-product-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #4ca1db, #3498db);
}

.view-product-button i {
    font-size: 1rem;
    margin-right: 4px;
}

.product-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.product-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.buy-now-button,
.view-product-button {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 4px;
}

.buy-now-button {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: white;
}

.view-product-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.buy-now-button:hover,
.view-product-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.buy-now-button i,
.view-product-button i {
    font-size: 0.8rem;
}

.product-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.view-product-inline {
    display: flex;
    align-items: center;
}

.view-product-button {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 4px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.view-product-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.view-product-button i {
    font-size: 0.8rem;
    margin-right: 4px;
}

.recommendation-metrics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: nowrap;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.metric-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
}

.theme-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-label {
    cursor: pointer;
    width: 60px;
    height: 30px;
    background-color: #1a1a1a;
    display: flex;
    border-radius: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    transform-origin: center;
    transition: all 0.3s ease;
}

.theme-label .sun-icon,
.theme-label .moon-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.sun-icon {
    color: #f39c12;
}

.moon-icon {
    color: #f1c40f;
}

.toggle-ball {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    left: 3px;
}

input:checked + .theme-label .toggle-ball {
    transform: translateX(30px);
}

input:checked + .theme-label {
    background-color: #4a4a4a;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--card-background);
}

.social-link:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.social-link i {
    font-size: 1.2em;
}

.social-link span {
    font-weight: 500;
}

.sorting-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
    max-width: 300px;
}

.form-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.form-select:hover {
    border-color: var(--primary-color);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.product-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 32px;
}

.product-details-container {
    flex: 1;
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.product-title-container {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.product-title-container h2 {
    flex: 1;
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    word-break: break-word;
    line-height: 1.3;
}

.view-product-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.product-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .product-details-container {
        width: 100%;
        padding: 16px;
    }

    .product-title-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .view-product-inline {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        width: 100%;
    }

    .product-meta {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .product-details-container {
        padding: 12px;
    }

    .product-title-container {
        gap: 12px;
    }

    .product-title-container h2 {
        font-size: 1.3rem;
    }

    .view-product-inline {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Product layout fixes */
.product-details {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.product-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.product-header {
    display: flex;
    gap: 2rem;
    width: 100%;
    padding: 1rem;
}

.product-image-container {
    flex: 0 0 150px;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    padding: 0.5rem;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 150px;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@media (max-width: 768px) {
    .product-image-container {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        height: 150px;
    }
}

.product-details-container {
    flex: 1;
    min-width: 0;
}

/* Chart container fixes */
.large-chart-container {
    width: 100%;
    margin: 2rem 0;
    padding: 1rem;
}

.chart-info {
    margin-top: 2rem;
    padding: 1rem;
}

/* Share buttons styles */
.share-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.buy-button-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.share-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.share-btn i {
    font-size: 1rem;
}

@media (max-width: 480px) {
    .buy-button-container {
        flex-direction: column;
        width: 100%;
    }

    .buy-now-button,
    .share-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .product-header {
        flex-direction: column;
        gap: 1rem;
    }

    .product-image-container {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .large-chart-container {
        height: 300px;
    }

    .price-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .chart-info {
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .price-stats {
        grid-template-columns: 1fr;
    }

    .share-buttons {
        flex-wrap: wrap;
    }

    .share-btn {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

/* Problem tab text styles */
.problem {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -moz-background-clip: text;
    -o-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.problem-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0.5rem 0;
    color: var(--text-color);
    opacity: 0.8;
}

/* Add fallback for browsers that don't support line-clamp */
@supports not (-webkit-line-clamp: 2) {
    .problem {
        max-height: 3em;
        position: relative;
        overflow: hidden;
    }

    .problem::after {
        content: "...";
        position: absolute;
        right: 0;
        bottom: 0;
        background: var(--background-color);
        padding-left: 0.5rem;
    }

    .problem-description {
        max-height: 4.5em;
        position: relative;
        overflow: hidden;
    }

    .problem-description::after {
        content: "...";
        position: absolute;
        right: 0;
        bottom: 0;
        background: var(--background-color);
        padding-left: 0.5rem;
    }
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4a90e2, #50c878);
    color: white;
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9em;
    height: 36px;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.share-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Chart zoom controls styling */
.apexcharts-toolbar {
    gap: 10px !important;
    padding: 0 10px !important;
}

.apexcharts-zoom-icon,
.apexcharts-zoomin-icon,
.apexcharts-zoomout-icon,
.apexcharts-reset-icon,
.apexcharts-pan-icon {
    margin: 0 5px !important;
    padding: 5px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 5px !important;
}

.apexcharts-zoom-icon:hover,
.apexcharts-zoomin-icon:hover,
.apexcharts-zoomout-icon:hover,
.apexcharts-reset-icon:hover,
.apexcharts-pan-icon:hover {
    background: rgba(215, 12, 12, 0.2) !important;
}

.apexcharts-toolbar > div {
    margin: 5px !important;
}

/* Increase icon size */
.apexcharts-toolbar i.fas {
    font-size: 1.2em !important;
}
