/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    
    --carrefour-color: #004b93;
    --noon-color: #feee00;
    --noon-text: #1a1a1a;
    --sharafdg-color: #d4a93c;
    
    --success: #10b981;
    --error: #ef4444;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --border-radius: 16px;
    --border-radius-sm: 8px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== App Container ===== */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* ===== Animated Background ===== */
.bg-animated {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: #06b6d4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    margin-left: 0.25rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    padding: 0 1.5rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Search Section ===== */
.search-container {
    max-width: 800px;
    margin: 0 auto 2rem;
}

.search-form {
    margin-bottom: 1rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.search-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-lg);
}

.search-icon {
    font-size: 1.25rem;
    padding: 0 1rem;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-primary);
    padding: 0.75rem 0;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: calc(var(--border-radius) - 4px);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.search-btn:hover .btn-icon {
    transform: translateX(4px);
}

.search-info {
    text-align: center;
}

.store-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.store-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    transition: transform 0.2s ease;
}

.store-badge:hover {
    transform: scale(1.05);
}

.store-badge.carrefour {
    background: var(--carrefour-color);
    color: white;
}

.store-badge.noon {
    background: var(--noon-color);
    color: var(--noon-text);
}

.store-badge.sharafdg {
    background: var(--sharafdg-color);
    color: #1a1a1a;
}

/* ===== Results Section ===== */
.results-container {
    animation: fadeIn 0.5s ease;
}

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

.search-stats {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.search-stats strong {
    color: var(--text-primary);
}

/* ===== Stores Grid ===== */
.stores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

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

.store-column {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.store-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
}

.store-header.carrefour {
    background: linear-gradient(135deg, var(--carrefour-color), #0066cc);
    color: white;
}

.store-header.noon {
    background: linear-gradient(135deg, var(--noon-color), #ffcc00);
    color: var(--noon-text);
}

.store-header.sharafdg {
    background: linear-gradient(135deg, var(--sharafdg-color), #c9952e);
    color: #1a1a1a;
}

.store-logo {
    font-size: 1.5rem;
}

.store-name {
    flex: 1;
}

.product-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.products-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
}

/* ===== Product Card ===== */
.product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.product-card.lowest-price {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.lowest-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: var(--success);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-image-wrapper {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

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

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

.product-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
}

.product-price::before {
    content: 'AED ';
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.no-products {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ===== Loading State ===== */
.loading-container {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-content {
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.loading-stores {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.loading-store {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

.loading-store:nth-child(2) .loading-dot {
    animation-delay: 0.2s;
}

.loading-store:nth-child(3) .loading-dot {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===== Skeleton Loader ===== */
.skeleton-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius-sm);
}

.skeleton-title {
    height: 16px;
    margin-bottom: 0.5rem;
}

.skeleton-title-short {
    height: 16px;
    width: 60%;
    margin-bottom: 0.75rem;
}

.skeleton-price {
    height: 24px;
    width: 40%;
    margin-bottom: 0.75rem;
}

.skeleton-btn {
    height: 40px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ===== Error State ===== */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--error);
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.retry-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== Utilities ===== */
.hidden {
    display: none !important;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
