/* ===== PriceTracker Enhanced CSS ===== */

:root {
    --bg: #0a0a14;
    --bg-elevated: #12121f;
    --bg-card: #1a1a2e;
    --bg-hover: #222240;
    --border: rgba(124, 58, 237, 0.12);
    --border-strong: rgba(124, 58, 237, 0.25);
    --text: #f0f0f5;
    --text-muted: #8888a0;
    --text-dim: #555570;
    --primary: #7C3AED;
    --primary-light: #a78bfa;
    --primary-dark: #5B21B6;
    --accent: #10B981;
    --accent-light: #34d399;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gradient: linear-gradient(135deg, #7C3AED 0%, #ec4899 50%, #10B981 100%);
    --gradient-primary: linear-gradient(135deg, #7C3AED, #a78bfa);
    --gradient-accent: linear-gradient(135deg, #10B981, #34d399);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.25);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 32px rgba(124, 58, 237, 0.15);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f8f9fc;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f5;
    --border: rgba(124, 58, 237, 0.08);
    --border-strong: rgba(124, 58, 237, 0.15);
    --text: #1a1a2e;
    --text-muted: #6b6b80;
    --text-dim: #9b9bb0;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 32px rgba(124, 58, 237, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.4s, color 0.4s;
}

/* ===== Animated Background Blobs ===== */
.bg-blobs {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.blob {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.12;
    animation: float 20s ease-in-out infinite;
}
.blob-1 { width: 500px; height: 500px; background: #7C3AED; top: -10%; left: -10%; }
.blob-2 { width: 400px; height: 400px; background: #ec4899; bottom: -10%; right: -5%; animation-delay: -7s; }
.blob-3 { width: 300px; height: 300px; background: #10B981; top: 40%; left: 60%; animation-delay: -14s; }
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -40px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.95); }
}

/* ===== Theme Button ===== */
.theme-btn {
    position: fixed; top: 1rem; right: 1rem; z-index: 100;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    color: var(--text); cursor: pointer; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); backdrop-filter: blur(10px);
}
.theme-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-md); }
.theme-btn .sun-icon { display: none; }
.theme-btn .moon-icon { display: block; }
[data-theme="light"] .theme-btn .sun-icon { display: block; }
[data-theme="light"] .theme-btn .moon-icon { display: none; }

/* ===== Page Wrapper ===== */
.page-wrapper {
    position: relative; z-index: 1;
    max-width: 1400px; margin: 0 auto; padding: 1rem;
}

/* ===== Hero Header ===== */
.hero-header {
    text-align: center; padding: 5rem 1rem 2rem;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    padding: 0.5rem 1.2rem; border-radius: 50px;
    font-size: 0.85rem; color: var(--text-muted);
    margin-bottom: 1.5rem; box-shadow: var(--shadow-sm);
}
.hero-badge i { color: var(--primary-light); }

.hero-title {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 800; letter-spacing: -0.03em;
    line-height: 1.1; margin-bottom: 0.8rem;
}
.gradient-text {
    background: var(--gradient); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent;
    background-size: 200% 200%; animation: gradientShift 5s ease infinite;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem;
    line-height: 1.6;
}

.cta-telegram {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: linear-gradient(135deg, #0088cc, #006699);
    color: white; padding: 0.9rem 2rem; border-radius: 50px;
    text-decoration: none; font-weight: 600; font-size: 1rem;
    transition: var(--transition); box-shadow: 0 4px 20px rgba(0, 136, 204, 0.3);
    margin-bottom: 2rem;
}
.cta-telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 136, 204, 0.45);
}
.cta-telegram .arrow { transition: transform 0.3s; }
.cta-telegram:hover .arrow { transform: translateX(4px); }

/* Stats Bar */
.stats-bar {
    display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap;
}
.stat-pill {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--bg-card); border: 1px solid var(--border);
    padding: 0.4rem 1rem; border-radius: 50px;
    font-size: 0.85rem; color: var(--text-muted);
}
.stat-pill i { color: var(--accent); }
.stat-pill strong { color: var(--text); }

/* ===== Controls Bar ===== */
.controls-bar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem; margin: 1rem 0 2rem;
    display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
}
[data-theme="light"] .controls-bar { background: rgba(255,255,255,0.85); }

.search-wrap {
    flex: 1 1 250px; position: relative;
    display: flex; align-items: center;
}
.search-icon {
    position: absolute; left: 1rem; color: var(--text-dim);
    font-size: 0.9rem; pointer-events: none;
}
.search-input {
    width: 100%; padding: 0.7rem 1rem 0.7rem 2.6rem;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 0.95rem; font-family: inherit;
    transition: var(--transition);
}
.search-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.search-input::placeholder { color: var(--text-dim); }
.search-clear {
    position: absolute; right: 0.8rem; background: none;
    border: none; color: var(--text-dim); cursor: pointer;
    padding: 4px; font-size: 0.85rem;
}
.search-clear:hover { color: var(--text); }

.filter-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.filter-select {
    padding: 0.7rem 2.2rem 0.7rem 1rem;
    background: var(--bg-elevated) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.8rem center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.9rem; font-family: inherit;
    cursor: pointer; appearance: none; -webkit-appearance: none;
    transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--primary); }
.filter-select:hover { border-color: var(--border-strong); }

.view-toggle { display: flex; gap: 2px; background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 2px; border: 1px solid var(--border); }
.view-btn {
    width: 38px; height: 38px; border: none; background: none;
    color: var(--text-dim); cursor: pointer; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.view-btn.active { background: var(--primary); color: white; }
.view-btn:hover:not(.active) { color: var(--text); background: var(--bg-hover); }

/* ===== Products Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem; padding-bottom: 2rem;
}
.products-grid.list-view {
    grid-template-columns: 1fr;
}
.products-grid.list-view .product-card {
    display: flex; flex-direction: row;
}
.products-grid.list-view .product-image {
    width: 180px; height: 180px; flex-shrink: 0;
}
.products-grid.list-view .product-info { flex: 1; }

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden; transition: var(--transition);
    display: flex; flex-direction: column; position: relative;
    animation: cardFadeIn 0.4s ease-out;
}
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.product-image {
    position: relative; width: 100%; aspect-ratio: 1;
    background: var(--bg-elevated); overflow: hidden;
}
.product-image img {
    width: 100%; height: 100%; object-fit: contain;
    padding: 1rem; transition: transform 0.4s;
}
.product-card:hover .product-image img { transform: scale(1.06); }

.platform-badge {
    position: absolute; top: 0.6rem; right: 0.6rem;
    padding: 0.25rem 0.7rem; border-radius: 50px;
    font-size: 0.7rem; font-weight: 600;
    backdrop-filter: blur(8px); text-transform: capitalize;
}
.platform-badge.amazon { background: rgba(255, 153, 0, 0.85); color: #1a1a1a; }
.platform-badge.flipkart { background: rgba(40, 103, 178, 0.85); color: white; }
.platform-badge.myntra { background: rgba(233, 69, 135, 0.85); color: white; }
.platform-badge.croma { background: rgba(0, 102, 51, 0.85); color: white; }
.platform-badge.ajio { background: rgba(44, 44, 84, 0.85); color: white; }
.platform-badge.meesho { background: rgba(244, 51, 151, 0.85); color: white; }

.discount-tag {
    position: absolute; top: 0.6rem; left: 0.6rem;
    background: var(--danger); color: white;
    padding: 0.25rem 0.6rem; border-radius: 8px;
    font-size: 0.75rem; font-weight: 700;
    backdrop-filter: blur(8px);
}

.product-info {
    padding: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1;
}
.product-title {
    font-size: 0.88rem; font-weight: 500; line-height: 1.4;
    color: var(--text); display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.5rem;
}

.product-price-row {
    display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
.current-price {
    font-size: 1.3rem; font-weight: 700; color: var(--text);
}
.current-price.out-of-stock { color: var(--text-dim); font-size: 0.95rem; font-weight: 500; }
.original-price {
    font-size: 0.85rem; color: var(--text-dim); text-decoration: line-through;
}
.savings-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: rgba(16, 185, 129, 0.12); color: var(--accent-light);
    padding: 0.15rem 0.5rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 600;
}
[data-theme="light"] .savings-badge { color: #059669; }

.product-actions {
    display: flex; gap: 0.4rem; margin-top: auto; padding-top: 0.3rem;
}
.btn-history, .btn-view {
    flex: 1; padding: 0.6rem; border-radius: var(--radius-sm);
    font-size: 0.82rem; font-weight: 600; text-align: center;
    cursor: pointer; transition: var(--transition); border: none;
    text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.btn-history {
    background: var(--bg-hover); color: var(--text);
    border: 1px solid var(--border);
}
.btn-history:hover { background: var(--border-strong); }
.btn-view {
    background: var(--gradient-primary); color: white;
}
.btn-view:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3); }

/* Skeleton Loading */
.skeleton-grid {
    display: contents;
}
.skeleton-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); overflow: hidden;
    animation: shimmer 1.5s infinite;
}
.skeleton-card::before {
    content: ''; display: block; aspect-ratio: 1; background: var(--bg-elevated);
}
.skeleton-card::after {
    content: ''; display: block; padding: 1rem;
}
@keyframes shimmer {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.no-products {
    grid-column: 1/-1; text-align: center; padding: 4rem 1rem;
    color: var(--text-muted); font-size: 1.1rem;
}
.no-products i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: 0.3; }

/* Loading more */
.loading-more {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
    padding: 2rem; color: var(--text-muted); font-size: 0.9rem;
}
.spinner {
    width: 24px; height: 24px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); }
.modal-card {
    position: relative; background: var(--bg-card);
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-close {
    position: absolute; top: 1rem; right: 1rem; z-index: 1;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-hover); border: 1px solid var(--border);
    color: var(--text); cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }
.modal-header { padding: 1.5rem 1.5rem 0.5rem; }
.modal-title { font-size: 1.3rem; font-weight: 700; }
.modal-body { padding: 1rem 1.5rem 1.5rem; }
.price-stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem; margin-top: 1.5rem;
}
.price-stat {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.8rem; text-align: center;
}
.stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { display: block; font-size: 1.2rem; font-weight: 700; }
.stat-value.current-price { color: var(--accent-light); }
.stat-value.highest-price { color: var(--danger); }
.stat-value.lowest-price { color: var(--accent); }
.stat-value.average-price { color: var(--text-muted); }

/* ===== Footer ===== */
.site-footer {
    margin-top: 3rem; padding: 2rem 1rem; text-align: center;
    border-top: 1px solid var(--border);
}
.footer-links {
    display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.footer-link {
    color: var(--text-muted); text-decoration: none; font-size: 0.9rem;
    transition: var(--transition); display: inline-flex; align-items: center; gap: 0.4rem;
}
.footer-link:hover { color: var(--primary-light); }
.footer-copy { color: var(--text-dim); font-size: 0.8rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .page-wrapper { padding: 0.5rem; }
    .hero-header { padding: 3rem 0.5rem 1.5rem; }
    .hero-badge { font-size: 0.75rem; padding: 0.4rem 0.9rem; }
    .stats-bar { gap: 0.5rem; }
    .stat-pill { font-size: 0.75rem; padding: 0.3rem 0.7rem; }
    
    .controls-bar { padding: 0.6rem; gap: 0.4rem; }
    .filter-group { width: 100%; }
    .filter-select { flex: 1; font-size: 0.82rem; padding: 0.6rem 1.8rem 0.6rem 0.8rem; }
    .search-input { font-size: 0.9rem; }
    .view-toggle { display: none; }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }
    .product-info { padding: 0.6rem; gap: 0.3rem; }
    .product-title { font-size: 0.78rem; min-height: 2.2rem; -webkit-line-clamp: 2; }
    .current-price { font-size: 1.1rem; }
    .original-price { font-size: 0.75rem; }
    .savings-badge { font-size: 0.68rem; }
    .btn-history, .btn-view { font-size: 0.72rem; padding: 0.5rem 0.3rem; }
    .btn-history .btn-label, .btn-view .btn-label { display: none; }
    
    .modal-card { width: 95%; max-height: 90vh; }
    .price-stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
    .products-grid { grid-template-columns: 1fr; }
    .product-actions { flex-direction: column; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .blob { display: none; }
}
