/* =========================================================
   AuctionIQ - General Analysis
   ========================================================= */


/* ---------------------------------------------------------
   Analysis upload
   --------------------------------------------------------- */

.general-vision-upload {
    margin-top: 20px;
}

.general-vision-upload .form-group {
    margin-bottom: 24px;
}

.general-vision-upload input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.general-vision-upload .form-actions {
    margin-top: 24px;
}

.general-vision-upload .form-actions .button {
    min-height: 44px;
}


/* ---------------------------------------------------------
   Camera / gallery controls
   --------------------------------------------------------- */

.general-vision-camera-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.general-vision-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.general-vision-photo-status {
    margin-top: 10px;
    margin-bottom: 0;
}


/* Primary camera button */

.general-vision-camera-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 52px;
    padding: 12px 22px;

    background: #2563eb;
    border: 2px solid #1d4ed8;
    border-radius: 7px;

    color: #fff;

    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;

    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);

    cursor: pointer;
}

.general-vision-camera-button:hover {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #fff;
}

.general-vision-camera-button:active {
    background: #1e40af;
    transform: translateY(1px);
}

.general-vision-camera-icon {
    width: 25px;
    height: 25px;
    flex-shrink: 0;
}


/* Secondary gallery button */

.general-vision-gallery-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 52px;
    padding: 11px 20px;

    background: #fff;
    border: 2px solid #9ca3af;
    border-radius: 7px;

    color: #374151;

    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;

    cursor: pointer;
}

.general-vision-gallery-button:hover {
    background: #f3f4f6;
    border-color: #6b7280;
    color: #111827;
}

.general-vision-gallery-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}


/* ---------------------------------------------------------
   Selected photograph previews
   --------------------------------------------------------- */

.general-vision-photo-preview {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.general-vision-photo-preview-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1 / 1;
    background: #f3f3f3;
}

.general-vision-photo-preview-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.general-vision-photo-remove {
    position: absolute;
    top: 5px;
    right: 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    padding: 0;
    border: 0;
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.72);
    color: #fff;

    font-size: 22px;
    line-height: 1;

    cursor: pointer;
}


/* ---------------------------------------------------------
   Research actions
   --------------------------------------------------------- */

.general-research-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: stretch;
    margin-top: 1rem;
}

.general-research-form {
    margin: 0;
}

.general-research-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;
    padding: 0.7rem 1.1rem;

    text-decoration: none;
    cursor: pointer;
}


/* Research loading state */

.research-button-spinner {
    display: none;

    width: 16px;
    height: 16px;
    margin-right: 8px;

    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;

    animation: auctioniq-spin 0.7s linear infinite;
}

.js-research-action.is-loading .research-button-spinner {
    display: inline-block;
}

.js-research-action.is-loading {
    opacity: 0.75;
    cursor: wait;
    pointer-events: none;
}

@keyframes auctioniq-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ---------------------------------------------------------
   eBay research action
   --------------------------------------------------------- */

.ebay-research-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.ebay-button-logo {
    display: inline-flex;
    align-items: center;

    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.08em;
}

.ebay-button-logo span {
    display: inline-block;
}

.ebay-e {
    color: #e53238;
}

.ebay-b {
    color: #0064d2;
}

.ebay-a {
    color: #f5af02;
}

.ebay-y {
    color: #86b817;
}


/* ---------------------------------------------------------
   Retained research source photographs
   --------------------------------------------------------- */

.general-research-source-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.general-research-source-image {
    display: block;

    width: 180px;
    height: 180px;

    overflow: hidden;
    border-radius: 6px;

    background: #f3f4f6;
}

.general-research-source-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}


/* ---------------------------------------------------------
   Recent research
   --------------------------------------------------------- */

.recent-research-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.recent-research-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;
    padding: 1rem;

    border: 1px solid #ddd;
    border-radius: 8px;
}

.recent-research-details {
    min-width: 0;
}

.recent-research-details p {
    margin: 0.35rem 0 0;
}

.recent-research-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.recent-research-actions form {
    margin: 0;
}

.research-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 36px;
    padding: 7px 14px;
    margin: 0;

    white-space: nowrap;

    font-size: 0.9rem;
    line-height: 1.2;
    text-decoration: none;

    border-radius: 6px;

    cursor: pointer;
}

.research-delete-button {
    opacity: 0.8;
}

.research-delete-button:hover {
    opacity: 1;
}


/* ---------------------------------------------------------
   Research history accordions
   --------------------------------------------------------- */

.research-history-section {
    padding: 0;
    overflow: hidden;
}

.research-history-first {
    margin-top: 28px;
}

.research-history-section + .research-history-section {
    margin-top: 14px;
}

.research-history-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;
    padding: 18px 20px;

    cursor: pointer;
    user-select: none;

    font-size: 1rem;
}

.research-history-summary:hover {
    background: rgba(0, 0, 0, 0.025);
}

.research-history-title {
    font-weight: 700;
}

.research-history-count {
    flex-shrink: 0;

    font-size: 0.875rem;
    font-weight: 500;

    opacity: 0.65;
}

.research-history-content {
    padding: 0 20px 20px;
}

.research-history-content > .muted:first-child {
    margin-top: 0;
}

.research-history-section[open] .research-history-summary {
    margin-bottom: 4px;
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 640px) {

    .general-vision-upload .form-group {
        margin-bottom: 28px;
    }

    .general-vision-upload input[type="file"] {
        margin-top: 12px;
        margin-bottom: 20px;
    }

    .general-vision-upload .form-actions {
        margin-top: 28px;
    }

    .general-vision-upload .form-actions .button {
        display: block;
        width: 100%;
        min-height: 48px;
    }


    /* Camera / gallery */

    .general-vision-camera-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .general-vision-camera-actions .button {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .general-vision-camera-button {
        min-height: 62px;
        padding: 15px 20px;

        font-size: 1.15rem;
    }

    .general-vision-camera-icon {
        width: 29px;
        height: 29px;
    }

    .general-vision-gallery-button {
        min-height: 56px;
        padding: 13px 18px;

        font-size: 1.05rem;
    }

    .general-vision-gallery-icon {
        width: 27px;
        height: 27px;
    }


    /* Research source photographs */

    .general-research-source-image {
        width: 110px;
        height: 110px;
    }


    /* Recent research */

    .recent-research-item {
        align-items: stretch;
        flex-direction: column;
    }

    .recent-research-item .button {
        width: 100%;
        text-align: center;
    }


    /* Research history */

    .research-history-first {
        margin-top: 24px;
    }

    .research-history-summary {
        padding: 16px;
        gap: 10px;
    }

    .research-history-content {
        padding: 0 16px 16px;
    }

    .research-history-count {
        font-size: 0.8rem;
    }
}


@media (max-width: 600px) {

    .general-research-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .general-research-form {
        display: contents;
    }

    .general-research-button {
        width: 100%;
    }
}

/* =========================================================
   EBAY RESEARCH - EDIT / SEARCH AGAIN
   ========================================================= */

.research-history-section > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.7rem 1rem;

    border: 2px solid currentColor;
    border-radius: 6px;

    font-weight: 600;
    cursor: pointer;

    user-select: none;
}

.research-history-section > summary::-webkit-details-marker {
    display: none;
}

.research-history-section > summary::before {
    content: "\270E";
    font-size: 1rem;
}

.research-history-section[open] > summary {
    margin-bottom: 1rem;
}

.research-history-content {
    margin-top: 0.75rem;
}

/* =========================================================
   WEB RESEARCH - RESPONSIVE VISUAL REFERENCES
   ========================================================= */

/*
 * Desktop remains four columns.
 */
.web-research-visual-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/*
 * Tablet.
 */
@media (max-width: 900px) {

    .web-research-visual-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


/*
 * Phone.
 *
 * Large single-column visual references are much easier
 * to compare with the physical object while researching
 * in the field.
 */
@media (max-width: 600px) {

    .web-research-visual-grid {
        grid-template-columns: 1fr;
    }

    .web-research-visual-card {
        display: block;
        height: auto;
        overflow: visible;
    }

    .web-research-visual-image {
        display: block;
        width: 100%;
        height: auto;
        position: static;
    }

    .web-research-visual-image img {
        display: block;
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .web-research-visual-body {
        display: block;
        position: static;
        width: 100%;
        height: auto;
        padding: 1rem;
        box-sizing: border-box;
    }

    .web-research-visual-body h3 {
        margin-top: 0;
    }

}

/* =========================================================
   WEB RESEARCH - MARKET EVIDENCE
   ========================================================= */

.web-market-evidence-list {
    display: grid;
    gap: 0.75rem;
}

.web-market-evidence-item {
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
}

.web-market-evidence-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.web-market-evidence-type {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
}

.web-market-evidence-price {
    font-size: 1.25rem;
}

.web-market-evidence-item p {
    margin: 0.35rem 0 0;
}

.web-market-evidence-note {
    margin-top: 1rem;
}