/* Brand palette matches ourmall.co.za's live theme (aiz-core.css --primary etc.) */
:root {
    --primary: #f77b0b;
    --hov-primary: #e56f0e;
    --soft-primary: rgba(247, 123, 11, 0.12);
    --secondary: #8f97ab;
    --success: #0abb75;
    --danger: #ef486a;
    --warning: #ffc519;
    --dark: #111723;
    --light: #f2f3f8;
    --white: #ffffff;
    --radius: 0.5rem;
    --shadow: 0 2px 10px rgba(17, 23, 35, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--hov-primary); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header {
    background: var(--dark);
    color: var(--white);
}
.site-header .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    max-width: 1120px;
    margin: 0 auto;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: var(--white); }
.brand img { height: 32px; width: 32px; border-radius: 6px; object-fit: cover; }
.brand small { display: block; font-weight: 400; color: var(--secondary); font-size: 0.72rem; }

.nav-links { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.nav-links a, .nav-links span { color: var(--white); font-size: 0.92rem; }
.nav-links .pill {
    background: var(--soft-primary);
    color: var(--primary);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--hov-primary); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--soft-primary); }
.btn-light { background: var(--white); color: var(--dark); border: 1px solid #e2e4ea; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Cards & layout */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}
.main { padding: 2rem 0 3rem; }

.search-hero {
    background: linear-gradient(135deg, var(--dark) 0%, #1c2534 100%);
    color: var(--white);
    padding: 2.5rem 0;
    margin-bottom: 1.75rem;
}
.search-hero h1 { margin: 0 0 0.4rem; font-size: 1.7rem; }
.search-hero p { margin: 0 0 1.25rem; color: #c3c8d6; }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid #e2e4ea;
    background: var(--white);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--dark);
}
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.search-form { display: flex; gap: 0.6rem; }
.search-form input[type=text] {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid #d8dbe4;
    font-size: 1rem;
}
input, select, textarea {
    font-family: inherit;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid #d8dbe4;
    font-size: 0.95rem;
    width: 100%;
}
label { display: block; font-weight: 600; font-size: 0.85rem; margin: 0.9rem 0 0.35rem; color: var(--dark); }

.limit-banner {
    background: var(--soft-primary);
    color: #9a5207;
    border-radius: var(--radius);
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}
.limit-banner.blocked { background: rgba(239, 72, 106, 0.12); color: #a01336; }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.result-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.result-card img { width: 100%; height: 160px; object-fit: contain; background: var(--light); padding: 0.5rem; }
.result-card .body { padding: 0.85rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.result-card .title { font-size: 0.9rem; font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.result-card .price { font-size: 1.15rem; font-weight: 700; color: var(--dark); }
.result-card .source {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--light);
    color: var(--secondary);
}
.result-card .cheapest { background: rgba(10, 187, 117, 0.12); color: var(--success); }
.result-card .actions { margin-top: auto; display: flex; gap: 0.4rem; }

.alert { border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-danger { background: rgba(239, 72, 106, 0.1); color: #a01336; }
.alert-success { background: rgba(10, 187, 117, 0.1); color: #086b47; }
.alert-info { background: var(--soft-primary); color: #9a5207; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--secondary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .site-header .bar { flex-direction: column; align-items: flex-start; }
}

.preview-thumb { width: 100%; max-width: 220px; border-radius: var(--radius); margin-top: 0.5rem; }

.site-footer {
    border-top: 1px solid #e2e4ea;
    padding: 1.5rem 0;
    margin-top: 3rem;
    color: var(--secondary);
    font-size: 0.85rem;
    text-align: center;
}

.badge-margin { font-size: 0.78rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 700; }
.badge-margin.good { background: rgba(10,187,117,.12); color: var(--success); }
.badge-margin.bad { background: rgba(239,72,106,.12); color: var(--danger); }

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 23, 35, 0.94);
    color: var(--white);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.1rem;
    text-align: center;
    padding: 2rem;
}
.loading-overlay.active { display: flex; }
.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: opf-spin 0.8s linear infinite;
}
.loading-overlay p { color: #c3c8d6; font-size: 0.85rem; margin: 0.4rem 0 0; max-width: 320px; }
@keyframes opf-spin { to { transform: rotate(360deg); } }
