:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --bg-soft: #f3f4ff;
    --card-bg: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --success: #059669;
    --danger: #dc2626;
    --border: #e5e7eb;
}

html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: radial-gradient(circle at top, #eef2ff 0%, #f8fafc 45%, #ffffff 100%);
    color: var(--text-dark);
}

.app-shell {
    flex: 1;
}

.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
    box-shadow: 0 10px 24px rgba(55, 48, 163, 0.2);
}

.navbar-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 0.2rem 0.45rem;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.35);
    font-size: 0.95rem;
}

.brand-stack {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-main {
    color: #ffffff;
    font-size: 1.03rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.brand-sub {
    color: #c7d2fe;
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.page-title {
    font-weight: 800;
    letter-spacing: -0.3px;
}

.hero-panel,
.results-panel,
.site-card,
.results-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
}

.hero-panel,
.results-panel {
    padding: 0.95rem;
    max-width: 920px;
    margin: 0 auto;
}

.results-toolbar {
    max-width: 920px;
    margin: 0 auto 0.5rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    padding: 0.5rem 0.7rem;
}

.results-inline-form {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.results-inline-form .form-control {
    height: 38px;
    border-radius: 10px;
}

.site-card,
.results-card {
    padding: 0.65rem;
    margin-bottom: 0.6rem;
}

.form-control-lg {
    border-radius: 12px;
}

.search-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 12px;
    padding: 0.5rem 0.95rem;
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.search-btn-main {
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
    min-width: 180px;
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(79, 70, 229, 0.28);
}

.site-card-title {
    font-weight: 700;
}

.site-card-desc {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.result-box {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    border-radius: 12px;
    padding: 0.35rem 0.65rem;
    font-weight: 700;
    font-size: 0.98rem;
}

.matchbox {
    background: linear-gradient(135deg, #0d9488, var(--success));
    color: #fff;
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    font-weight: 700;
    margin-bottom: 0;
}

.lowest-price-result {
    margin-bottom: 0.7rem;
    padding: 0.55rem;
    border-radius: 14px;
    background: var(--bg-soft);
    border: 1px dashed #c7d2fe;
}

.results-card .table {
    margin: 0;
    table-layout: fixed;
    width: 100%;
    font-size: 0.89rem;
}

.results-card .table th,
.results-card .table td {
    vertical-align: middle;
}

.results-card .table th {
    width: 34%;
    color: #111827;
    font-weight: 700;
    padding: 0.43rem 0.5rem;
}

.results-card .table td {
    color: #374151;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 0.43rem 0.5rem;
}

.picture-link {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: #1d4ed8;
    background: #dbeafe;
}

.picture-link:hover {
    color: #1e40af;
    background: #bfdbfe;
}

.picture-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.picture-thumb {
    width: 48px;
    height: 34px;
    border-radius: 7px;
    object-fit: cover;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
}

.compact-page {
    margin-top: 0.8rem !important;
}

.compact-title {
    margin-bottom: 0.65rem !important;
    font-size: clamp(1.45rem, 2.4vw, 2.05rem);
}

.compact-subtitle {
    margin-bottom: 0.75rem !important;
    font-size: clamp(1rem, 1.7vw, 1.45rem);
}

.results-page .row.g-3 {
    --bs-gutter-y: 0.45rem;
}

.results-actions {
    margin-top: 1.25rem;
    margin-bottom: 2rem;
    padding: 0.35rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.results-actions .btn {
    min-width: 150px;
}

.results-actions .action-btn {
    min-height: 40px;
}

.status-alert {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 0.85rem 1rem;
    font-weight: 500;
}

.status-alert.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.footer {
    width: 100%;
    background: #111827;
    color: #ffffff;
    text-align: center;
    padding: 0.6rem 0;
    margin-top: auto;
}

.footertext {
    margin: 0;
    color: #e5e7eb;
}

.footertext a {
    color: #93c5fd;
    text-decoration: none;
}

.footertext a:hover {
    text-decoration: underline;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.loading-overlay.active {
    display: flex !important;
}

.loading-card {
    width: min(90%, 340px);
    background: #fff;
    border-radius: 16px;
    padding: 1.15rem 1rem;
    text-align: center;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.25);
}

.loading-text {
    margin: 0.7rem 0 0;
    color: #374151;
    font-weight: 600;
}

@media (max-width: 768px) {
    .navbar-title {
        font-size: 1rem;
        gap: 0.45rem;
    }

    .brand-mark {
        width: 30px;
        height: 30px;
    }

    .brand-main {
        font-size: 0.92rem;
    }

    .brand-sub {
        font-size: 0.58rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .hero-panel,
    .results-panel {
        padding: 0.8rem;
        max-width: 100%;
    }

    .result-box {
        font-size: 1rem;
    }

    .results-card .table th {
        width: 40%;
    }

    .results-inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .results-inline-form .form-control {
        width: 100%;
    }

    .results-actions {
        margin-top: 1rem;
        margin-bottom: 2.25rem;
        padding: 0.25rem 0;
    }

    .results-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1160px;
    }
}
