:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.7);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.2) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.2) 0, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.highlight {
    color: var(--primary);
}

nav a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 30px;
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--primary);
}

/* Search Section */
.search-section {
    text-align: center;
    padding: 80px 0 40px;
}

.search-section h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-section p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    border-radius: 12px;
}

#searchInput {
    flex: 1;
    padding: 20px 25px;
    font-size: 1.1rem;
    border: none;
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 12px 0 0 12px;
    outline: none;
    border: 1px solid var(--border-color);
    border-right: none;
    font-family: 'Outfit', sans-serif;
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#searchBtn {
    padding: 0 30px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    font-family: 'Outfit', sans-serif;
}

#searchBtn:hover {
    background: var(--primary-hover);
}

#searchBtn:active {
    transform: scale(0.98);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    z-index: 10;
    text-align: left;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.autocomplete-dropdown div {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.autocomplete-dropdown div:hover {
    background: rgba(255,255,255,0.05);
}

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

#loading {
    margin-top: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px;
}

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

/* Results Section */
.results-section {
    padding: 40px 0 80px;
    animation: fadeIn 0.5s ease;
}

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

.highlight-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.highlight-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s;
}

.highlight-box:hover {
    transform: translateY(-5px);
}

.lowest-box {
    border-bottom: 4px solid var(--accent-green);
}

.fastest-box {
    border-bottom: 4px solid var(--accent-yellow);
}

.highlight-box h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 10px;
}

.highlight-box p {
    font-size: 1.8rem;
    font-weight: 700;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 1024px) {
    .comparison-container {
        grid-template-columns: 3fr 2fr;
    }
}

.table-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-x: auto;
    padding: 1px; /* for inner border radius */
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(255,255,255,0.03);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255,255,255,0.02);
}

.store-logo {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-col {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Smart Colors */
.lowest-price { color: var(--accent-green) !important; }
.highest-price { color: var(--accent-red) !important; }
.mid-price { color: var(--accent-yellow) !important; }

.btn-buy {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-buy:hover {
    background: var(--primary);
}

.charts-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Ads Section */
#ads-section {
    margin: 40px 0;
    min-height: 90px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 60px;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

@media (min-width: 768px) {
    footer .container {
        flex-direction: row;
        justify-content: space-between;
    }
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 768px) {
    .search-section h2 { font-size: 2.2rem; }
    .search-container { flex-direction: column; }
    #searchInput { border-radius: 12px; border-right: 1px solid var(--border-color); margin-bottom: 10px; }
    #searchBtn { border-radius: 12px; padding: 15px; }
    nav { display: none; } /* Simple mobile menu can be added later */
}
