/* CompetitorLens — Dark sleek UI */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap');

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

:root {
    --bg: #09090B;
    --bg-subtle: #131316;
    --surface: #18181B;
    --surface-hover: #27272A;
    --border: #27272A;
    --border-subtle: #1E1E22;
    --text: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #52525B;
    --accent: #E12828;
    --accent-glow: rgba(225, 40, 40, 0.15);
    --success: #4ADE80;
    --error: #F87171;
    --warning: #FBBF24;
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    background: var(--bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: transparent;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Shared Background Layer --- */

.page-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center;
}

.page-bg.login-bg {
    background-image: url('images/login-bg.jpg');
    opacity: 0.8;
}

.page-bg.home-bg {
    background-image: url('images/home-bg.jpg');
    opacity: 0.75;
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.vignette.login-vignette {
    background:
        radial-gradient(ellipse 90% 70% at 50% 45%, #09090BEE 0%, #09090B22 100%),
        linear-gradient(to bottom, #09090B00 60%, #09090BCC 100%);
}

.vignette.home-vignette {
    background:
        radial-gradient(ellipse 50% 65% at 50% 45%, #09090BEE 0%, #09090BCC 60%, #09090B55 100%),
        linear-gradient(to top, #09090B00 0%, #09090B00 60%, #09090BAA 85%, #09090BDD 100%);
}

/* --- Mono Font Utility --- */

.mono {
    font-family: 'Geist Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
}

/* --- Logo --- */

.logo {
    font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    color: var(--text);
}

.logo-lg {
    font-size: 44px;
    letter-spacing: -1.5px;
}

.logo-sm {
    font-size: 32px;
    letter-spacing: -1px;
}

/* --- Login Page --- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 400px;
    max-width: calc(100% - 2rem);
}

.brand-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    width: 100%;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.06);
}

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

/* Override browser autocomplete highlight — prevents harsh white bg */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-subtle) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.login-footer {
    display: flex;
    align-items: center;
    gap: 4px;
}

.text-muted-sm {
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
}

.text-secondary-sm {
    color: var(--text-secondary);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
}

.text-secondary-sm:hover {
    color: var(--text);
}

.footer-links {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.footer-links a {
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
}

.maker-credit {
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* --- Error Flash --- */

.error-flash {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    width: 100%;
}

/* --- Home Page --- */

.home-page {
    min-height: 100vh;
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    max-width: 600px;
    margin: 0 auto;
    padding: 140px 24px 60px;
    min-height: 100vh;
}

.center-content.has-running {
    padding-top: 80px;
    gap: 32px;
}

/* --- Search Bar --- */

.search-form {
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 52px;
    padding: 0 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.19);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--text-muted);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(250, 250, 250, 0.05);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input[type="text"] {
    flex: 1;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 14px;
}

.search-bar input[type="text"]:focus {
    box-shadow: none;
}

.search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.search-submit:hover {
    color: var(--text);
    background: var(--text-muted);
    border-color: var(--text-muted);
}

.search-hint {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
    pointer-events: none;
}

/* --- Sections --- */

.jobs-section {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.section-header {
    padding: 0 4px 12px 4px;
}

.section-title {
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- Running Job Card (compact, in list) --- */

.job-card-running {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.12);
    width: 100%;
}

.job-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.job-query {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.flex-spacer {
    flex: 1;
}

.job-status-label {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
}

.job-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.meta-date {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.meta-sep {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.meta-detail {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

/* --- Progress Bar --- */

.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: bar-shimmer 1.5s ease-in-out infinite;
}

@keyframes bar-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill {
    height: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- Expanded Progress Card --- */

.progress-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.19);
    width: 100%;
}

.progress-header {
    display: flex;
    align-items: center;
    width: 100%;
}

.progress-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.progress-meta {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.progress-bar-lg {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar-lg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: bar-shimmer 1.5s ease-in-out infinite;
}

.progress-bar-lg .progress-fill {
    height: 100%;
}

.progress-count {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.progress-divider {
    width: 100%;
    height: 1px;
    background: var(--border-subtle);
}

/* --- Store List --- */

.store-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.store-row {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 4px;
}

.store-icon {
    font-size: 14px;
    font-weight: 600;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.store-icon.done {
    color: var(--success);
    text-shadow: 0 0 8px var(--success), 0 0 16px rgba(74, 222, 128, 0.4);
}
.store-icon.in-progress { color: var(--text-secondary); }
.store-icon.blocked { color: var(--error); }
.store-icon.queued { color: #f0ad4e; }

.store-name {
    font-size: 14px;
    color: var(--text);
}

.store-name.blocked {
    color: var(--text-muted);
}
.store-name.queued {
    color: var(--text-secondary);
}

.store-stat {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
}

.store-stat.done {
    color: var(--success);
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}
.store-stat.in-progress { color: var(--text-secondary); }
.store-stat.blocked { color: var(--error); }
.store-stat.queued { color: #f0ad4e; }

.progress-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.progress-note {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 10px;
    color: var(--text-muted);
}

.btn-cancel {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

.btn-cancel:hover {
    color: var(--error);
}

/* --- Done / Failed / Cancelled Job Rows --- */

.job-row-done {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    width: 100%;
}

.job-row-done .job-query {
    color: var(--text-secondary);
}

.job-meta-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-text {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.btn-download {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.btn-download:hover {
    text-decoration: underline;
}

.btn-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

.btn-dismiss:hover {
    color: var(--error);
}

/* --- Empty State --- */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 14px;
}

/* --- Responsive --- */

@media (max-width: 480px) {
    .center-content {
        padding: 80px 16px 40px;
        gap: 32px;
    }

    .login-wrapper {
        width: 100%;
        padding: 0 1rem;
    }

    .logo-lg {
        font-size: 36px;
    }

    .search-bar {
        height: 48px;
    }
}
