/* Pricelist Search — custom polish on top of Bootstrap 5.3 */

:root {
    --brand: #0d6efd;
    --brand-dark: #0a58ca;
    --bg: #f4f6fb;
    --card-radius: 14px;
}

html, body {
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    padding-bottom: 90px; /* room for mobile FAB */
}

/* Navbar */
.app-navbar {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(13, 110, 253, .25);
}
.app-navbar .navbar-brand { color: #fff; font-weight: 600; letter-spacing: .2px; }
.app-navbar .badge { font-weight: 500; }

/* Search hero */
.search-hero {
    border-radius: var(--card-radius);
}
.search-hero .input-group-text,
.search-hero .form-control {
    border-radius: 12px;
}
.search-hero .input-group .form-control {
    box-shadow: none;
}
.search-hero .input-group-text {
    border-color: #ced4da;
}
.search-hero .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .15rem rgba(13, 110, 253, .12);
}

.quick-search {
    background: #eef2ff;
    color: var(--brand-dark);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
}
.quick-search:hover { background: #dbe4ff; }

/* Two-step search */
.search-step {
    position: relative;
    transition: opacity .3s ease;
}
.search-step-disabled {
    opacity: .45;
    pointer-events: none;
}
.search-step-disabled.search-step-enabled {
    opacity: 1;
    pointer-events: auto;
}
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.step-number-dim {
    background: #c8cdd3;
}
.search-step-enabled .step-number-dim {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}
.item-active-tag {
    font-size: .7rem;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
    background: #e8f0fe;
    color: #1967d2;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-step .input-group { transition: box-shadow .2s ease; }
.search-step .input-group:focus-within {
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
    border-radius: 12px;
}
.desc-hint {
    font-size: .72rem;
    font-style: italic;
}

/* Autocomplete suggestions dropdown */
.search-wrapper { position: relative; }
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.suggest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background .15s ease;
    font-size: .9rem;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover,
.suggest-item.active {
    background: #eef2ff;
}
.suggest-item .suggest-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.suggest-item .suggest-text .match {
    background: #fff3cd;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
}
.suggest-item .suggest-badge {
    font-size: .65rem;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    flex-shrink: 0;
}
.suggest-badge.badge-item {
    background: #e8f0fe;
    color: #1967d2;
}
.suggest-badge.badge-igrade {
    background: #e6f4ea;
    color: #137333;
}
.suggest-badge.badge-partno {
    background: #fef7e0;
    color: #b06000;
}
.suggest-footer {
    padding: 6px 14px;
    font-size: .75rem;
    color: #adb5bd;
    text-align: center;
    background: #fafbfd;
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
}

/* Table polish */
#resultsTable thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
}
#resultsTable tbody td { vertical-align: middle; }
#resultsTable .partno { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
#resultsTable .rate-cell { font-variant-numeric: tabular-nums; }
.row-actions .btn { padding: .15rem .45rem; }

/* Highlight matched substring */
.match { background: #fff3cd; border-radius: 3px; padding: 0 2px; }

/* Mobile cards */
.result-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.result-card .rc-title {
    font-weight: 600;
    color: #212529;
    line-height: 1.25;
    margin-bottom: 4px;
    font-size: .95rem;
}
.result-card .rc-meta {
    font-size: .8rem;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 8px;
}
.result-card .rc-meta .rc-tag { background:#eef2ff; color:var(--brand-dark); padding:1px 8px; border-radius:999px; }
.result-card .rc-partno { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; }
.result-card .rc-rates {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px dashed #e9ecef;
    margin-top: 6px;
    padding-top: 8px;
}
.result-card .rc-rates strong { font-variant-numeric: tabular-nums; }
.result-card .rc-rates .rc-srate { color: #198754; font-weight: 600; }
.result-card .rc-rates .rc-prate { color: #6c757d; font-size: .85rem; }
.result-card .rc-actions { display:flex; gap:6px; }
.result-card .rc-actions .btn { flex: 1; }

/* Floating action button */
.fab-add {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 56px;
    height: 56px;
    box-shadow: 0 8px 20px rgba(25,135,84,.4);
    font-size: 1.4rem;
    line-height: 1;
    z-index: 1030;
}

/* Toasts */
.toast { min-width: 240px; }

/* Tiny screen tweaks */
@media (max-width: 575.98px) {
    .app-navbar .navbar-brand span { font-size: .95rem; }
    .search-hero .form-control { font-size: 1rem; }
    main.container { padding-left: .75rem; padding-right: .75rem; }
}
