/*
 * The front of the shop (Eshop module pages). Bootstrap 4.6.2 does the layout; this file only adds what the shop needs beyond it
 * and makes the Bootstrap widgets that the site theme (common/css/theme-v002.css) does not restyle follow the theme colors, so the
 * shop looks right in the light and in the dark mode. Everything is scoped below .eshop.
 */

.eshop {
    color: var(--foreground, inherit);
}

/* ---- Toolbar ---- */

.eshop-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border, #dee2e6);
    border-radius: var(--radius, 1rem);
    background-color: var(--card, #fff);
}

.eshop-toolbar-search {
    flex: 1 1 14rem;
    min-width: 12rem;
    margin: 0;
}

.eshop-toolbar-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.eshop-toolbar-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.7rem;
    border-radius: 9999px;
    color: var(--foreground, inherit);
    text-decoration: none;
    white-space: nowrap;
}

.eshop-toolbar-links a:hover,
.eshop-toolbar-links a:focus {
    background-color: var(--muted, #f1f3f5);
    color: var(--primary, inherit);
}

.eshop-toolbar-links .badge {
    margin-left: 0.35rem;
}

/* ---- Form controls, tables, badges (not covered by the site theme outside .user-settings) ---- */

.eshop .form-control,
.eshop .custom-select {
    background-color: var(--card, #fff);
    border-color: var(--border, #ced4da);
    color: var(--foreground, inherit);
}

.eshop .form-control:focus,
.eshop .custom-select:focus {
    border-color: var(--primary, #80bdff);
    box-shadow: 0 0 0 0.15rem var(--accent, rgba(0, 123, 255, 0.25));
}

.eshop .form-control::placeholder {
    color: var(--muted-foreground, #6c757d);
}

.eshop .form-control:disabled,
.eshop .form-control[readonly] {
    background-color: var(--muted, #e9ecef);
}

.eshop .table {
    color: var(--foreground, inherit);
}

.eshop .table th,
.eshop .table td {
    border-color: var(--border, #dee2e6);
}

.eshop .table thead th {
    border-bottom-color: var(--border, #dee2e6);
    color: var(--muted-foreground, #6c757d);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.eshop .list-group-item {
    background-color: var(--card, #fff);
    border-color: var(--border, rgba(0, 0, 0, 0.125));
    color: var(--foreground, inherit);
}

.eshop .breadcrumb {
    padding: 0;
    background: none;
    font-size: 0.9rem;
}

.eshop .breadcrumb-item + .breadcrumb-item::before {
    color: var(--muted-foreground, #6c757d);
}

.eshop .page-link {
    background-color: var(--card, #fff);
    border-color: var(--border, #dee2e6);
    color: var(--primary, #007bff);
}

.eshop .page-item.active .page-link {
    background-color: var(--primary, #007bff);
    border-color: var(--primary, #007bff);
    color: var(--primary-foreground, #fff);
}

.eshop .page-item.disabled .page-link {
    background-color: var(--muted, #fff);
    color: var(--muted-foreground, #6c757d);
}

.eshop .badge-success { background-color: var(--primary, #28a745); color: var(--primary-foreground, #fff); }
.eshop .badge-warning { background-color: var(--gold, #ffc107); color: #2c2610; }
.eshop .badge-danger { background-color: var(--destructive, #dc3545); color: var(--destructive-foreground, #fff); }
.eshop .badge-secondary { background-color: var(--muted, #6c757d); color: var(--muted-foreground, #fff); }
.eshop .badge-light { background-color: var(--muted, #f8f9fa); color: var(--foreground, #212529); }

/* ---- Product listing ---- */

.eshop-listing-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.eshop-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.eshop-sort .custom-select {
    width: auto;
}

.eshop-listing-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.eshop-product-card {
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.eshop-product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
}

.eshop-card-image {
    display: block;
    aspect-ratio: 4 / 3;
    background-color: var(--muted, #f1f3f5);
    overflow: hidden;
}

.eshop-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.eshop-card-image-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground, #adb5bd);
    font-size: 2.5rem;
}

.eshop-card-title {
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
    line-height: 1.3;
}

.eshop-card-title a {
    color: var(--foreground, inherit);
    text-decoration: none;
}

.eshop-card-title a:hover {
    color: var(--primary, inherit);
}

.eshop-card-text {
    color: var(--muted-foreground, #6c757d);
    font-size: 0.9rem;
}

.eshop-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.eshop-category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border, #dee2e6);
    border-radius: 9999px;
    background-color: var(--card, #fff);
    color: var(--foreground, inherit);
    text-decoration: none;
    font-size: 0.9rem;
}

.eshop-category-chip:hover,
.eshop-category-chip:focus {
    border-color: var(--primary, #007bff);
    color: var(--primary, #007bff);
    text-decoration: none;
}

/* ---- Prices and availability ---- */

.eshop-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--foreground, inherit);
}

.eshop-price-old {
    margin-left: 0.4rem;
    color: var(--muted-foreground, #6c757d);
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: line-through;
}

.eshop-price-from {
    margin-right: 0.25rem;
    color: var(--muted-foreground, #6c757d);
    font-size: 0.8rem;
    font-weight: 400;
}

.eshop-price-note {
    display: block;
    color: var(--muted-foreground, #6c757d);
    font-size: 0.75rem;
    font-weight: 400;
}

.eshop-price-large {
    font-size: 1.7rem;
}

/* ---- Product detail ---- */

.eshop-gallery-main {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border, #dee2e6);
    border-radius: var(--radius, 1rem);
    background-color: var(--muted, #f1f3f5);
    overflow: hidden;
}

.eshop-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.eshop-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.eshop-gallery-thumb {
    width: 4.5rem;
    height: 4.5rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.6rem;
    background: var(--muted, #f1f3f5);
    overflow: hidden;
    cursor: pointer;
}

.eshop-gallery-thumb.active,
.eshop-gallery-thumb:hover {
    border-color: var(--primary, #007bff);
}

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

.eshop-buy-box {
    padding: 1.25rem;
    border: 1px solid var(--border, #dee2e6);
    border-radius: var(--radius, 1rem);
    background-color: var(--card, #fff);
}

.eshop-quantity {
    width: 5.5rem;
}

.eshop-description {
    margin-top: 2rem;
}

/* ---- Cart, checkout, order ---- */

.eshop-cart-image {
    width: 4rem;
    height: 4rem;
    border-radius: 0.5rem;
    object-fit: cover;
    background-color: var(--muted, #f1f3f5);
}

.eshop-cart-line-problem td {
    background-color: var(--muted, #fff3cd);
}

.eshop-summary {
    padding: 1.25rem;
    border: 1px solid var(--border, #dee2e6);
    border-radius: var(--radius, 1rem);
    background-color: var(--card, #fff);
}

.eshop-summary dl {
    margin-bottom: 0;
}

.eshop-summary .eshop-summary-total {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, #dee2e6);
    font-size: 1.15rem;
    font-weight: 700;
}

@media (min-width: 992px) {
    .eshop-summary-sticky {
        position: sticky;
        top: 6rem;
    }
}

.eshop-option {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border, #dee2e6);
    border-radius: 0.75rem;
    background-color: var(--card, #fff);
    cursor: pointer;
}

.eshop-option:hover,
.eshop-option.selected {
    border-color: var(--primary, #007bff);
}

.eshop-option.selected {
    box-shadow: 0 0 0 1px var(--primary, #007bff);
}

.eshop-option input {
    margin-top: 0.3rem;
}

.eshop-option-body {
    flex: 1 1 auto;
}

.eshop-option-price {
    white-space: nowrap;
    font-weight: 600;
}

.eshop-qr {
    max-width: 16rem;
    border-radius: 0.5rem;
    background: #fff;
}

.eshop-compare-table th {
    width: 9rem;
    white-space: nowrap;
}

.eshop-compare-table td {
    min-width: 11rem;
    vertical-align: top;
}

.eshop .is-invalid ~ .invalid-feedback {
    display: block;
}
