/* TGPLibrary LookupApp Styles — amber accent for the valuation-lookup worker app.
   Shared entity/layout styles live in CommonApp's tgplibrary-default.css. */

/* Lookup color scheme + app identity mapping */
:root {
    --lookup-primary:       #d97706;
    --lookup-primary-dark:  #b45309;
    --lookup-primary-light: #fffbeb;
    --lookup-secondary:     #ea580c;

    /* Map app identity to lookup (amber) palette */
    --app-primary:          var(--lookup-primary);
    --app-primary-dark:     var(--lookup-primary-dark);
    --app-primary-light:    var(--lookup-primary-light);
    --app-accent:           var(--lookup-secondary);
    --app-focus-ring:       rgba(217, 119, 6, 0.25);
}

/* Header gradient — amber warm tone */
.lookup-header {
    position: relative;
    z-index: 1001;
    background: linear-gradient(90deg, #fffbeb 0%, #fed7aa 100%);
}

.lookup-header .header-user {
    margin-right: 0.75rem;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

@media (max-width: 767.98px) {
    .lookup-header .brand-name { display: none; }
}

/* Landing page */
.lookup-landing {
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.lookup-landing h1 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.lookup-landing-intro {
    color: var(--text-secondary);
    max-width: 60ch;
    margin-bottom: 1.5rem;
}

.lookup-flow-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .lookup-flow-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.lookup-flow-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
    box-shadow: var(--shadow-sm);
}

.lookup-flow-card:hover {
    border-color: var(--app-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.lookup-flow-icon {
    font-size: 2rem;
    color: var(--app-primary);
    flex-shrink: 0;
}

.lookup-flow-body h2 {
    margin: 0 0 0.25rem;
    font-size: var(--fs-lg);
    color: var(--text-primary);
}

.lookup-flow-body p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

/* Category lookup flow page (Phases 3–5): details panel + valuation form layout.
   Base .lookup-flow-page + .lookup-search-* + .lookup-alert* classes come from
   _content/TGPLibrary.WorkerApp.Client.UI/css/lookup-flows.css. */
.lookup-panel {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

.lookup-details-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lookup-details-collapse {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.lookup-details-collapse:hover {
    color: var(--app-primary-dark);
    background: var(--app-primary-light);
}

.lookup-details-panel.is-collapsed { padding: 0.5rem 1rem; }

.lookup-details-summary {
    padding-right: 2rem;
    color: var(--text-primary);
    font-size: var(--fs-base);
}

.lookup-details-image-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

@media (min-width: 640px) {
    .lookup-details-image-wrap {
        flex: 0 0 auto;
        align-items: center;
    }
}

.lookup-details-image {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.lookup-details-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lookup-details-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.lookup-details-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lookup-details-title-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.lookup-details-lookup-btn {
    align-self: flex-start;
}

.lookup-details-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    align-self: stretch;
    justify-content: center;
}

@media (min-width: 640px) {
    .lookup-details-link-chip { align-self: center; }
}

.lookup-details-link-unlink {
    border: 0;
    background: transparent;
    color: var(--app-primary-dark);
    cursor: pointer;
    font-weight: 600;
    padding: 0 0.125rem;
}

.lookup-details-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lookup-details-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lookup-details-field-grow {
    flex: 1;
    min-width: 0;
}

.lookup-details-field-compact input,
.lookup-details-field-compact select {
    max-width: 7rem;
}

.lookup-details-field label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.lookup-details-field input,
.lookup-details-field select {
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    background: var(--bg-white);
}

.lookup-valuation-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lookup-valuation-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.lookup-valuation-submit { align-self: flex-end; }
.lookup-valuation-submit > .btn-primary { min-width: 6rem; }

.lookup-valuation-ebay-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lookup-valuation-ebay-row > .lookup-search-field {
    flex: 0 0 auto;
}

@media (min-width: 640px) {
    .lookup-details-panel {
        flex-direction: row;
        align-items: flex-start;
    }

    .lookup-details-image {
        width: 160px;
        height: 160px;
        flex-shrink: 0;
    }

    .lookup-details-form {
        flex: 1;
    }

    .lookup-details-title-row {
        flex-direction: row;
        align-items: flex-end;
    }

    .lookup-details-lookup-btn {
        align-self: auto;
    }

    .lookup-details-row {
        flex-direction: row;
        gap: 0.75rem;
    }

    .lookup-details-row > .lookup-details-field {
        flex: 1;
    }

    .lookup-details-row > .lookup-details-field-compact {
        flex: 0 0 auto;
    }

    .lookup-valuation-ebay-row {
        flex-direction: row;
        align-items: flex-end;
    }

    .lookup-valuation-ebay-row > .lookup-search-field {
        flex: 1;
    }

    .lookup-valuation-ebay-row > .lookup-search-field-compact {
        flex: 0 0 auto;
    }
}

/* Catalogue lookup dialogs (Phase 2): three-section picker used by BGG and Rebrickable. */
.lookup-dialog {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.lookup-dialog-detail {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: var(--space-4);
    align-items: start;
}

.lookup-dialog-detail-image,
.lookup-dialog-detail-placeholder {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    object-fit: contain;
    display: block;
}

.lookup-dialog-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.lookup-dialog-detail-body h3 {
    margin: 0 0 0.25rem;
    font-size: var(--fs-lg);
    color: var(--text-primary);
}

.lookup-dialog-detail-body p {
    margin: 0 0 0.25rem;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.lookup-dialog-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.lookup-dialog-detail-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    font-size: var(--fs-xs);
    font-weight: 500;
}

.lookup-dialog-search {
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lookup-dialog-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.lookup-dialog-search label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.lookup-dialog-search input[type="text"],
.lookup-dialog-search input[type="search"],
.lookup-dialog-search input[type="number"] {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
}

.lookup-dialog-search input[type="number"] {
    width: 6rem;
}

.lookup-dialog-candidates {
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-4);
    max-height: 40vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lookup-dialog-candidate {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
}

.lookup-dialog-candidate:hover {
    background: var(--app-primary-light);
    border-color: var(--app-primary);
}

.lookup-dialog-candidate.is-selected {
    background: var(--app-primary-light);
    border-color: var(--app-primary);
    font-weight: 500;
}

.lookup-dialog-candidate-name {
    font-size: var(--fs-base);
}

.lookup-dialog-candidate-meta {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.lookup-dialog-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.lookup-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-4);
}

@media (min-width: 640px) {
    .lookup-dialog-detail {
        grid-template-columns: 160px 1fr;
    }

    .lookup-dialog-detail-image,
    .lookup-dialog-detail-placeholder {
        width: 160px;
        height: 160px;
    }
}

/* Stub pages (Phases 3–5 replace the content) */
.lookup-stub-page {
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.lookup-stub-page h1 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.lookup-stub-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--app-primary-light);
    border: 1px dashed var(--app-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
}

.lookup-stub-icon {
    font-size: 1.75rem;
    color: var(--app-primary);
}

/* ---------- Hero landing redesign (Phase 4) ---------- */

.lookup-landing-hero {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0 1.5rem;
}

.lookup-landing-hero h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.lookup-landing-tagline {
    margin: 0;
    color: var(--text-secondary);
    max-width: 60ch;
}

.lookup-landing-quicklinks {
    margin-top: 1rem;
}

.lookup-landing-quicklinks-heading {
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem;
}

.lookup-landing-quicklink-primary,
.lookup-landing-quicklink {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    min-height: 44px;
}

.lookup-landing-quicklink-primary:hover,
.lookup-landing-quicklink:hover,
.lookup-landing-quicklink-primary:focus-visible,
.lookup-landing-quicklink:focus-visible {
    border-color: var(--app-primary);
    box-shadow: var(--shadow-sm);
    outline: none;
}

.lookup-landing-quicklink-primary {
    background: var(--app-primary-light);
    border-color: var(--app-primary);
    color: var(--app-primary-dark);
    font-weight: 600;
    width: 100%;
    justify-content: center;
}

.lookup-landing-quicklink-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .lookup-landing-quicklink-primary { width: auto; }
    .lookup-landing-quicklink-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ---------- Lookup search/details page wrapper ---------- */

.lookup-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 1rem;
    padding: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Inner-scroll pattern: page fills .main-content's height; only the results
   list scrolls, so the search bar and filters stay anchored at the top.
   Applied at all viewport widths — on mobile this overrides the default
   "main-content scrolls naturally" behavior so the lookup page behaves the
   same on phones and desktops. */
.lookup-page > .lookup-results {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* The CommonApp default sets .main-content { overflow-y: auto } on mobile so
   long pages (forms, wizards) scroll naturally. The lookup page wants the
   inner-scroll pattern instead — pin .main-content's overflow when a lookup
   page is the active route. */
.main-content:has(> .lookup-page) {
    overflow: hidden;
}

.lookup-page-header h1 {
    margin: 0 0 0.25rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.lookup-page-header p {
    margin: 0;
    color: var(--text-secondary);
}

.lookup-details-back {
    margin: 0;
}

.lookup-details-back a {
    color: var(--app-primary-dark);
    text-decoration: none;
}

.lookup-details-back a:hover {
    text-decoration: underline;
}

/* ---------- Sidebar group label (Phase 4) ---------- */

.sidebar-group-label {
    margin: 1rem 0.75rem 0.25rem;
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.nav-link.nav-sub {
    padding-left: 2rem;
}

/* ---------- Valuation: Other page (Phase 5) ---------- */

.other-search-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.other-search-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.other-search-field label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.other-search-field textarea,
.other-search-field input,
.other-search-field select {
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px; /* prevents iOS zoom on focus */
    background: var(--bg-white);
    color: var(--text-primary);
    width: 100%;
}

.other-search-field textarea {
    min-height: 80px;
    resize: vertical;
}

.other-search-field-grow { flex: 1; min-width: 0; }
.other-search-field-compact { flex: 0 0 auto; }
.other-search-field-compact select { max-width: 7rem; }

.other-search-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.other-search-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.other-search-actions .btn-primary {
    min-height: 44px;
    width: 100%;
}

@media (min-width: 480px) {
    .other-search-row {
        flex-direction: row;
        align-items: flex-end;
    }
    .other-search-actions {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
    }
    .other-search-actions .btn-primary { width: auto; }
}
