/* =============================================================================
   Shop-specific styles — Internet-магазин тренажера Samson-fit
   =============================================================================
   Requires: Bootstrap 4, Bootstrap Icons
   Theme: Supports data-theme="dark" and data-theme="light"
   ============================================================================= */

/* ── CSS Custom Properties (Theme tokens) ─────────────────────────────── */
:root {
    --shop-primary: #2563eb;
    --shop-primary-hover: #1d4ed8;
    --shop-success: #22c55e;
    --shop-danger: #ef4444;
    --shop-warning: #f59e0b;
    --shop-info: #3b82f6;
    --shop-sidebar-width: 260px;
    --shop-card-radius: 0.5rem;
    --shop-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shop-card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shop-transition-speed: 0.25s;
}

/* ── Dark theme overrides ─────────────────────────────────────────────── */
[data-theme="dark"] {
    --shop-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shop-card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* =============================================================================
   SHOP LAYOUT — Sidebar + Main
   ============================================================================= */

.shop-wrapper {
    min-height: calc(100vh - 200px);
}

.shop-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid #e5e7eb;
}

[data-theme="dark"] .shop-sidebar {
    border-right-color: #374151;
}

.shop-main {
    padding-left: 1.5rem;
}

.sidebar-heading {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .sidebar-heading {
    color: #9ca3af;
}

.sidebar-section {
    margin-bottom: 1rem;
}

.sidebar-link {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    color: #4b5563;
    border-radius: 0.25rem;
    transition:
        background-color var(--shop-transition-speed),
        color var(--shop-transition-speed);
}

.sidebar-link:hover,
.sidebar-link.active {
    background-color: #eff6ff;
    color: var(--shop-primary);
    font-weight: 600;
}

[data-theme="dark"] .sidebar-link {
    color: #d1d5db;
}

[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .sidebar-link.active {
    background-color: #1e3a5f;
    color: #93c5fd;
}

.sidebar-divider {
    border-top: 1px solid #e5e7eb;
    margin: 1rem 0;
}

[data-theme="dark"] .sidebar-divider {
    border-top-color: #374151;
}

/* ── Cart widget in sidebar ───────────────────────────────────────────── */
.cart-widget {
    font-size: 0.9rem;
}

.cart-widget-link {
    color: inherit;
    font-weight: 600;
}

.cart-widget-link:hover {
    text-decoration: none;
    color: var(--shop-primary);
}

.cart-badge {
    font-size: 0.7rem;
    vertical-align: top;
}

/* =============================================================================
   PRODUCT CARDS
   ============================================================================= */

.product-card {
    transition:
        transform var(--shop-transition-speed),
        box-shadow var(--shop-transition-speed);
    border-radius: var(--shop-card-radius);
    box-shadow: var(--shop-card-shadow);
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shop-card-shadow-hover);
}

.product-card-link {
    color: inherit;
}

.product-card-link:hover {
    text-decoration: none;
}

/* ── Product image area ────────────────────────────────────────────────── */
.product-card-img-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #f9fafb;
    aspect-ratio: 1 / 1;
}

[data-theme="dark"] .product-card-img-wrapper {
    background-color: #1f2937;
}

.product-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-card-img {
    transform: scale(1.05);
}

.product-card-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #f3f4f6;
}

[data-theme="dark"] .product-card-img-placeholder {
    background-color: #374151;
}

/* ── Badges on product cards ───────────────────────────────────────────── */
.product-badge-featured {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
}

.product-badge-type {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 3px;
}

.product-badge-promo {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}

/* ── Product card body ─────────────────────────────────────────────────── */
.product-card-title {
    font-size: 0.9rem;
    line-height: 1.3;
    color: #1f2937;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

[data-theme="dark"] .product-card-title {
    color: #e5e7eb;
}

.product-card-sku {
    font-size: 0.75rem;
}

.product-card-stock {
    font-size: 0.8rem;
}

.product-card-price .price-current {
    font-size: 1.1rem;
}

.product-card-price .price-old {
    font-size: 0.85rem;
}

.product-card-cart-form .btn {
    transition: background-color var(--shop-transition-speed);
}

/* ── Featured card highlight ───────────────────────────────────────────── */
.product-card-featured {
    border: 2px solid #f59e0b;
}

[data-theme="dark"] .product-card-featured {
    border-color: #d97706;
}

/* =============================================================================
   PRODUCT DETAIL — Gallery
   ============================================================================= */

.product-gallery {
    margin-bottom: 1.5rem;
}

.product-main-img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 0.5rem;
}

.product-main-img-placeholder {
    width: 100%;
    min-height: 350px;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

[data-theme="dark"] .product-main-img-placeholder {
    background-color: #1f2937;
}

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

.product-thumb-btn {
    cursor: pointer;
    transition:
        border-color var(--shop-transition-speed),
        opacity var(--shop-transition-speed);
    background: none;
    padding: 2px;
    border: 2px solid #e5e7eb;
    border-radius: 0.25rem;
}

[data-theme="dark"] .product-thumb-btn {
    border-color: #4b5563;
}

.product-thumb-btn:hover,
.product-thumb-btn:focus {
    border-color: var(--shop-primary);
    opacity: 0.85;
}

.product-thumb-btn.border-primary {
    border-color: var(--shop-primary) !important;
}

/* ── Product prices block ──────────────────────────────────────────────── */
.product-prices {
    position: relative;
}

/* ── Specifications table ──────────────────────────────────────────────── */
.product-specifications table th {
    font-weight: 600;
    width: 40%;
}

/* ── Peculiarity / legal disclaimer ────────────────────────────────────── */
.product-peculiarity {
    font-size: 0.85rem;
}

/* =============================================================================
   CART PAGE
   ============================================================================= */

.cart-item-row td {
    vertical-align: middle;
}

.cart-qty-btn {
    min-width: 32px;
    text-decoration: none !important;
}

.cart-qty-input {
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =============================================================================
   ORDER / CHECKOUT
   ============================================================================= */

.order-summary-card {
    position: sticky;
    top: 80px;
}

.order-summary-card .list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.5rem 1rem;
}

.delivery-method-option {
    transition:
        border-color var(--shop-transition-speed),
        background-color var(--shop-transition-speed);
    cursor: pointer;
}

.delivery-method-option:hover {
    background-color: #f9fafb;
}

[data-theme="dark"] .delivery-method-option:hover {
    background-color: #374151;
}

.delivery-method-option:has(input:checked) {
    border-color: var(--shop-primary) !important;
    background-color: #eff6ff;
}

[data-theme="dark"] .delivery-method-option:has(input:checked) {
    background-color: #1e3a5f;
}

/* =============================================================================
   ORDER DETAIL / TRACKING
   ============================================================================= */

.tracking-timeline .tracking-item {
    position: relative;
}

.tracking-timeline .tracking-icon {
    position: relative;
}

.tracking-timeline .tracking-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    width: 2px;
    height: 24px;
    background-color: #d1d5db;
}

[data-theme="dark"] .tracking-timeline .tracking-icon::after {
    background-color: #4b5563;
}

.tracking-timeline .tracking-item:last-child .tracking-icon::after {
    display: none;
}

/* ── Status-specific colours ───────────────────────────────────────────── */
.status-badge-pending {
    background-color: #fef3c7;
    color: #92400e;
}
.status-badge-paid {
    background-color: #dbeafe;
    color: #1e40af;
}
.status-badge-processing {
    background-color: #e0e7ff;
    color: #3730a3;
}
.status-badge-assembling {
    background-color: #e0e7ff;
    color: #3730a3;
}
.status-badge-shipped {
    background-color: #d1fae5;
    color: #065f46;
}
.status-badge-in-transit {
    background-color: #d1fae5;
    color: #065f46;
}
.status-badge-delivered {
    background-color: #dcfce7;
    color: #166534;
}
.status-badge-cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}
.status-badge-refunded {
    background-color: #f3f4f6;
    color: #374151;
}

[data-theme="dark"] .status-badge-pending {
    background-color: #78350f;
    color: #fef3c7;
}
[data-theme="dark"] .status-badge-paid {
    background-color: #1e3a5f;
    color: #93c5fd;
}
[data-theme="dark"] .status-badge-processing {
    background-color: #312e81;
    color: #c7d2fe;
}
[data-theme="dark"] .status-badge-assembling {
    background-color: #312e81;
    color: #c7d2fe;
}
[data-theme="dark"] .status-badge-shipped {
    background-color: #064e3b;
    color: #a7f3d0;
}
[data-theme="dark"] .status-badge-in-transit {
    background-color: #064e3b;
    color: #a7f3d0;
}
[data-theme="dark"] .status-badge-delivered {
    background-color: #14532d;
    color: #bbf7d0;
}
[data-theme="dark"] .status-badge-cancelled {
    background-color: #7f1d1d;
    color: #fecaca;
}
[data-theme="dark"] .status-badge-refunded {
    background-color: #374151;
    color: #e5e7eb;
}

/* =============================================================================
   PAYMENT PAGES
   ============================================================================= */

.payment-method-option {
    transition: border-color var(--shop-transition-speed);
}

.payment-method-option:has(input:checked) {
    border-color: var(--shop-primary) !important;
    background-color: #eff6ff;
}

[data-theme="dark"] .payment-method-option:has(input:checked) {
    background-color: #1e3a5f;
}

/* =============================================================================
   LEGAL PAGES
   ============================================================================= */

.legal-document {
    line-height: 1.7;
}

.legal-clause-list {
    padding-left: 1.5rem;
}

.legal-clause-list li {
    margin-bottom: 0.5rem;
    text-align: justify;
}

.legal-clause-list ul {
    padding-left: 1.25rem;
    list-style-type: disc;
}

.legal-section h2 {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

[data-theme="dark"] .legal-section h2 {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* =============================================================================
   SEARCH PAGE
   ============================================================================= */

.shop-product-search .input-group-lg .form-control {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* =============================================================================
   PROMO BANNER
   ============================================================================= */

.promo-card {
    transition: transform var(--shop-transition-speed);
}

.promo-card:hover {
    transform: translateY(-2px);
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 991.98px) {
    .shop-sidebar {
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }

    [data-theme="dark"] .shop-sidebar {
        border-bottom-color: #374151;
    }

    .shop-main {
        padding-left: 0;
    }

    .order-summary-card {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .product-card-title {
        font-size: 0.85rem;
    }

    .product-card-price .price-current {
        font-size: 1rem;
    }

    .product-badge-type {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .product-badge-featured {
        font-size: 0.6rem;
        padding: 2px 8px;
    }

    .product-badge-promo {
        font-size: 0.65rem;
        padding: 2px 8px;
    }
}

@media (max-width: 575.98px) {
    .product-card-body {
        padding: 0.75rem;
    }

    .product-card-img-wrapper {
        aspect-ratio: 4 / 3;
    }

    .product-main-img {
        max-height: 280px;
    }

    .product-gallery-thumbs {
        justify-content: center;
    }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    .shop-sidebar,
    .shop-product-search form,
    .product-card-cart-form,
    .cart-widget,
    .btn,
    .pagination {
        display: none !important;
    }

    .shop-main {
        padding-left: 0;
        width: 100%;
    }

    .product-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .product-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

@keyframes shopFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-product-list .col,
.shop-product-search .col {
    animation: shopFadeIn 0.3s ease-out;
    animation-fill-mode: both;
}

.shop-product-list .col:nth-child(1) {
    animation-delay: 0.05s;
}
.shop-product-list .col:nth-child(2) {
    animation-delay: 0.1s;
}
.shop-product-list .col:nth-child(3) {
    animation-delay: 0.15s;
}
.shop-product-list .col:nth-child(4) {
    animation-delay: 0.2s;
}
.shop-product-list .col:nth-child(5) {
    animation-delay: 0.25s;
}
.shop-product-list .col:nth-child(6) {
    animation-delay: 0.3s;
}

.shop-product-search .col:nth-child(1) {
    animation-delay: 0.05s;
}
.shop-product-search .col:nth-child(2) {
    animation-delay: 0.1s;
}
.shop-product-search .col:nth-child(3) {
    animation-delay: 0.15s;
}
.shop-product-search .col:nth-child(4) {
    animation-delay: 0.2s;
}
.shop-product-search .col:nth-child(5) {
    animation-delay: 0.25s;
}
.shop-product-search .col:nth-child(6) {
    animation-delay: 0.3s;
}

/* ── Spinner for payment processing ────────────────────────────────────── */
#payment-loading .spinner-border {
    animation-duration: 1.2s;
}

/* ── Form validation styles ────────────────────────────────────────────── */
#order-create-form .form-control:invalid:focus {
    border-color: var(--shop-danger);
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.25);
}

#order-create-form .form-control:valid:focus {
    border-color: var(--shop-success);
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.25);
}

/* ── Currency switcher ─────────────────────────────────────────────────── */
.shop-currency-active {
    font-weight: 700;
}

/* ── Cup Rating System (5-level trophy cups) ─────────────────── */
.cup-rating-select {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.cup-rating-select label {
    cursor: pointer;
    text-align: center;
}
.cup-rating-select input[type="radio"] {
    display: none;
}
.cup-rating-select .cup-label {
    font-size: 2rem;
    opacity: 0.3;
    transition:
        opacity 0.2s,
        transform 0.2s;
    display: inline-block;
}
.cup-rating-select input[type="radio"]:checked + .cup-label {
    opacity: 1;
    transform: scale(1.2);
}
.cup-rating-select .cup-label:hover {
    opacity: 0.8;
}
.cup-bronze {
    color: #cd7f32;
}
.cup-silver {
    color: #c0c0c0;
}
.cup-gold {
    color: #ffd700;
}
.cup-platinum {
    color: #e5e4e2;
}
.cup-diamond {
    color: #b9f2ff;
}
.cup-empty {
    color: #dee2e6;
}
.cup-bronze-bg {
    background-color: #cd7f32;
}
.cup-silver-bg {
    background-color: #c0c0c0;
}
.cup-gold-bg {
    background-color: #ffd700;
}
.cup-platinum-bg {
    background-color: #e5e4e2;
}
.cup-diamond-bg {
    background-color: #b9f2ff;
}
[data-theme="dark"] .cup-empty {
    color: #495057;
}
[data-theme="dark"] .cup-bronze {
    color: #cd7f32;
}
[data-theme="dark"] .cup-silver {
    color: #c0c0c0;
}
[data-theme="dark"] .cup-gold {
    color: #ffd700;
}
[data-theme="dark"] .cup-platinum {
    color: #e5e4e2;
}
[data-theme="dark"] .cup-diamond {
    color: #b9f2ff;
}

.rating-average {
    font-size: 2.5rem;
    font-weight: 700;
}
.rating-cups {
    font-size: 1.5rem;
}
.rating-bar {
    height: 0.75rem;
    border-radius: 0.375rem;
    background-color: #e9ecef;
    margin-top: 0.25rem;
}
.rating-bar-fill {
    height: 100%;
    border-radius: 0.375rem;
    transition: width 0.3s;
}
[data-theme="dark"] .rating-bar {
    background-color: #495057;
}

.review-item {
    border-bottom: 1px solid #dee2e6;
    padding: 1.5rem 0;
}
.review-item:last-child {
    border-bottom: none;
}
.review-cups {
    font-size: 1.25rem;
}
.review-helpful-btn {
    font-size: 0.875rem;
}
.product-reviews {
    border-top: 1px solid #dee2e6;
    padding-top: 1.5rem;
}
[data-theme="dark"] .product-reviews {
    border-top-color: #495057;
    /* Product description full width */
    .shop-main .product-description {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
}

.shop-main .product-description .text-muted {
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
	white-space: pre-wrap;
}
