/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #fcfbfa;
    color: #2c2520;
    padding: 1rem;
}

body.presenting {
    overflow: hidden;
}

.sales-app {
    max-width: 1400px;
    margin: 0 auto;
}

.sales-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.sales-header h1 {
    font-size: 1.75rem;
    color: #1a1412;
    margin-bottom: 0.25rem;
}

.sales-subtitle {
    color: #706259;
    font-size: 0.95rem;
}

.sales-status-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    max-width: 100%;
}

.mobile-url {
    font-size: 0.75rem;
    color: #50443c;
    background: #f0ece9;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    word-break: break-all;
    text-align: right;
}

.mobile-url a {
    color: #50443c;
    font-weight: 700;
}

.btn-install-app {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #50443c;
    background: #50443c;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-install-app:hover {
    background: #3a312b;
}

.sales-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
}

.sales-status--ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.sales-status--offline {
    background: #fff8e1;
    color: #f57f17;
}

.sales-status--error {
    background: #ffebee;
    color: #c62828;
}

.sales-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-toolbar {
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid #dcd5d0;
    background: #ffffff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-present {
    background: #50443c;
    color: #ffffff;
    border-color: #50443c;
}

.btn-present:hover {
    background: #3a312b;
}

.controls-bar.collapsed {
    display: none;
}

.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
}

.catalog-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.catalog-header h1 {
    font-size: 2.5rem;
    color: #1a1412;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.catalog-header p {
    color: #706259;
    font-size: 1.1rem;
}

.controls-bar {
    background-color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 1rem;
    border: 1px solid #f0ece9;
}

.search-hint {
    background-color: #50443c;
    color: #ffffff;
    text-align: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 0.6rem;
    letter-spacing: 0.2px;
}

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

.form-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.form-row.range-row {
    gap: 0.5rem;
}

.form-row label,
.form-row .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #50443c;
    white-space: nowrap;
}

.form-row.range-row label:first-of-type,
.cluster-row label {
    min-width: 72px;
    text-align: right;
}

.cluster {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.1rem 0;
}

.cluster-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cluster-row label {
    width: 108px;
    text-align: right;
}

.search-form input {
    padding: 0.35rem 0.45rem;
    border: 1px solid #dcd5d0;
    border-radius: 5px;
    font-size: 0.8rem;
    background-color: #faf9f8;
    color: #2c2520;
    transition: all 0.2s ease;
}

.search-form input:focus {
    outline: none;
    border-color: #8c7662;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(140, 118, 98, 0.12);
}

.field-num {
    width: 3.5rem;
    text-align: center;
}

.field-num::placeholder {
    color: #b0a8a0;
}

.field-sm {
    width: 4rem;
}

.field-md {
    width: 6.5rem;
}

.field-lg {
    width: 100%;
    max-width: 14rem;
}

.field-char {
    width: 2.25rem;
    text-align: center;
    text-transform: uppercase;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.45rem;
    border-top: 1px solid #f0ece9;
}

.btn-search,
.btn-reset {
    padding: 0.35rem 0.85rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.15s ease;
}

.btn-search {
    background-color: #8c7662;
    color: #ffffff;
}

.btn-search:hover {
    background-color: #6d5b4b;
}

.btn-reset {
    background-color: #f0ece9;
    color: #50443c;
}

.btn-reset:hover {
    background-color: #dcd5d0;
}

.results-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.95rem;
    color: #706259;
}

.no-results {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px dashed #dcd5d0;
    color: #706259;
}

.hidden {
    display: none !important;
}

/* Results workspace: list left, detail right */
.results-workspace {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 0;
    min-height: 560px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0ece9;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.results-list-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dcd5d0;
    background: #f5f2f0;
}

.list-header {
    background-color: #50443c;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}

.list-table-wrap {
    flex: 1;
    overflow-y: auto;
    max-height: 70vh;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.results-table thead {
    position: sticky;
    top: 0;
    background: #e8e2dd;
    z-index: 1;
}

.results-table th,
.results-table td {
    padding: 0.35rem 0.45rem;
    text-align: left;
    border-bottom: 1px solid #dcd5d0;
    white-space: nowrap;
}

.results-table .col-price {
    text-align: right;
    font-weight: 700;
}

.detail-price {
    font-size: 1.05rem;
    margin: 0.45rem 0;
}

.detail-price span {
    color: #50443c;
}

.results-table th {
    font-size: 0.72rem;
    font-weight: 700;
    color: #50443c;
    text-transform: uppercase;
}

.result-row {
    cursor: pointer;
    background: #faf9f8;
}

.result-row:hover {
    background: #efeae6;
}

.result-row.selected {
    background: #000080;
    color: #ffffff;
}

.result-row.selected td {
    border-bottom-color: #000060;
}

.detail-panel {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: #2c2520;
    min-height: 560px;
}

.detail-position {
    background: #50443c;
    color: #ffffff;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem 0;
    flex-wrap: wrap;
}

.detail-nav {
    display: flex;
    gap: 0.35rem;
}

.btn-nav {
    background: #f0ece9;
    color: #50443c;
    border: 1px solid #dcd5d0;
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
}

.btn-nav:hover {
    background: #e8e2dd;
}

.detail-info {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 0 0 auto;
}

.detail-gallery {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem 1rem;
    gap: 0.75rem;
    min-height: 280px;
    background: #f5f5f5;
}

.detail-photo {
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 120px;
    object-fit: contain;
    display: block;
    background: #ffffff;
}

.detail-image-cell {
    width: 200px;
    max-width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 140px;
    padding: 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-line {
    margin-bottom: 0.5rem;
}

.detail-banner {
    background: #f0ece9;
    color: #50443c;
    padding: 0.35rem 0.6rem;
    font-weight: 700;
    margin: 0.35rem 0;
    border-radius: 4px;
}

.detail-banner--footer {
    font-size: 0.85rem;
}

.detail-banner--price {
    font-size: 1.15rem;
    background: #50443c;
    color: #fff;
    margin-top: 0.55rem;
}

.detail-spec span {
    display: inline-block;
    min-width: 4.5rem;
    font-weight: 700;
}

.detail-main-image {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    overflow: hidden;
}

.detail-main-image--empty {
    color: #706259;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 2rem;
}

.detail-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 200px));
    gap: 0.75rem;
    align-content: start;
    overflow-y: auto;
    max-height: 65vh;
}

.detail-image-cell:hover {
    border-color: #8c7662;
}

.detail-image-cell.active {
    border-color: #50443c;
    box-shadow: 0 0 0 2px rgba(80, 68, 60, 0.2);
}

.detail-image-cell .detail-photo {
    width: 100%;
    height: auto;
    min-height: 120px;
    object-fit: contain;
}

.detail-image-cell--missing {
    opacity: 0.35;
}

.detail-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-thumb {
    width: 72px;
    height: 54px;
    padding: 0;
    border: 2px solid transparent;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.detail-thumb.active {
    border-color: #ffffff;
}

.detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-thumb--missing {
    opacity: 0.45;
}

/* Fullscreen presentation for customer viewing */
.presentation {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    color: #2c2520;
}

.presentation-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.btn-close-present {
    background: #50443c;
    color: #ffffff;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.presentation-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    padding: 0.5rem;
    background: #ffffff;
}

.presentation-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.present-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #50443c;
    border: 1px solid #dcd5d0;
    font-size: 2.5rem;
    width: 3rem;
    height: 4rem;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.present-arrow:hover {
    background: #ffffff;
}

.present-arrow--left { left: 0.5rem; }
.present-arrow--right { right: 0.5rem; }

.presentation-bottom {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.presentation-thumbs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.present-thumb {
    width: 64px;
    height: 48px;
    padding: 0;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.present-thumb.active {
    border-color: #50443c;
}

.present-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 900px) {
    .sales-header {
        flex-direction: column;
    }

    .sales-status-wrap {
        align-items: flex-start;
        width: 100%;
    }

    .mobile-url {
        text-align: left;
    }

    .btn-toolbar,
    .btn-search,
    .btn-reset,
    .btn-nav,
    .btn-close-present {
        min-height: 44px;
    }

    .present-arrow {
        width: 2.5rem;
        height: 3rem;
        font-size: 2rem;
    }

    .results-workspace {
        grid-template-columns: 1fr;
    }

    .results-list-panel {
        border-right: none;
        border-bottom: 1px solid #dcd5d0;
    }

    .list-table-wrap {
        max-height: 240px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem 0.75rem;
    }

    .cluster-row label {
        width: auto;
        text-align: left;
    }

    .field-lg {
        max-width: 100%;
    }
}
