/* Product Page Styles */

.product-page {
    padding-top: 100px;
    /* Account for fixed navbar height */
    padding-bottom: 80px;
}

.breadcrumbs {
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
    /* align-items: start; Removed to allow height stretching */
}

/* Left Column */
.product-left {
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-width: 0;
}

.product-left>.product-title {
    margin-bottom: -16px;
    /* Reduce gap after title */
}

/* Gallery */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.main-image {
    width: 100%;
    background: #f0f0f0;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/3;
    position: relative;
}

/* Blurred background layer */
.main-image::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    right: -10%;
    bottom: -10%;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(20px) saturate(1.4);
    opacity: 0.8;
    z-index: 1;
    transform: scale(1.1);
}

/* Main image - scaled to fit, not cropped */
.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: flex-start;
}

.thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    flex: 0 0 auto;
}

.thumb.active {
    border-color: var(--primary-color);
}

.thumb--add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    background: #f6f8f3;
    border: 2px dashed #c9d5c2;
    color: #2C5F2D;
    padding: 0;
}

.thumb--add:hover {
    border-color: var(--primary-color);
    background: #eef4e8;
}

.thumb-add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.2rem;
}

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

.thumb-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 3;
}

.thumb-set-main {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #2C5F2D;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 3;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.thumb-set-main:hover {
    background: #fff;
    color: #1d421e;
}

.thumb-set-main.is-main {
    background: #2C5F2D;
    color: white;
}

.thumb-set-main:disabled {
    cursor: default;
    opacity: 1;
}

.thumb-delete:hover {
    background: #a52b2b;
}

.thumb-delete:disabled {
    opacity: 0.6;
    cursor: wait;
}

.thumbnails.is-admin-busy {
    opacity: 0.78;
}

/* Section Titles */
.section-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

/* Matches List */
.matches-section .carousel-container {
    padding: 0;
}

/* Companion cards */
.companion-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.companion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(44, 95, 45, 0.15);
}

.companion-reason {
    font-size: 11px;
    color: #6c757d;
    margin: 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
}

.companion-card .view-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #2C5F2D 0%, #1a3a1b 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.companion-card .view-btn:hover {
    opacity: 0.9;
}

/* Description */
.description-content {
    line-height: 1.8;
    color: var(--text-main);
    font-size: 1rem;
}

.description-content p {
    margin-bottom: 16px;
}

/* Markdown-rendered elements in descriptions */
.description-content h3,
.description-content h4,
.description-content h5 {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    margin: 24px 0 10px;
    line-height: 1.3;
}

.description-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.description-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.description-content h5 {
    font-size: 1rem;
    font-weight: 600;
}

.description-content ul,
.expert-notes-content ul {
    margin: 8px 0 16px;
    padding-left: 0;
    list-style: none;
}

.description-content ul li,
.expert-notes-content ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.description-content ul li::before,
.expert-notes-content ul li::before {
    content: '●';
    position: absolute;
    left: 0;
    color: #2C5F2D;
    font-size: 0.5em;
    top: 0.6em;
}

.description-content strong,
.expert-notes-content strong {
    font-weight: 600;
    color: #1a1a1a;
}

.description-content em,
.expert-notes-content em {
    font-style: italic;
    color: #444;
}

/* Reviews */
.rating-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 1.2rem;
    font-weight: 700;
}

.stars {
    color: #FFC107;
}

.review-item {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stars-small {
    color: #FFC107;
    font-size: 0.8rem;
}

/* Botanical Info */
.botanical-info {
    margin-top: 20px;
}

.section-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.section-header-collapsible .section-title {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    flex: 1;
}

.section-header-collapsible .collapse-icon {
    display: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 10px;
    margin-left: 10px;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

/* Always show collapse icon for Characteristics section (desktop + mobile) */
#characteristicsToggle {
    cursor: pointer;
}

#characteristicsToggle .collapse-icon {
    display: block;
}

#characteristicsToggle .section-title {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* On mobile, make the header clickable and collapse content */
@media (max-width: 768px) {
    .section-header-collapsible {
        cursor: pointer;
    }

    .section-header-collapsible .section-title {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .section-header-collapsible .collapse-icon {
        display: block;
        margin-bottom: 0;
    }

    .botanical-info {
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 16px;
    }

    .botanical-info-content {
        display: none;
        margin-top: 16px;
    }

    /* When active class is added via JS */
    .botanical-info.active .botanical-info-content {
        display: block;
    }

    .botanical-info.active .collapse-icon {
        transform: rotate(180deg);
    }
}

/* Right Column */
.product-right {
    position: relative;
}

.product-info-card {
    background: white;
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 100px;
    /* Below navbar */
}

.product-title {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 16px;
    color: #000000;
    height: auto;
    min-height: 0;
}

.product-price {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 16px;
}

.admin-price-editor {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 240px;
}

.admin-price-input {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #d7dece;
    border-radius: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #000;
    background: #fff;
}

.admin-price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.15);
}

.admin-price-input:disabled {
    background: #f3f5f1;
    color: #666;
}

.admin-price-currency {
    font-size: 1.05rem;
    font-weight: 600;
    color: #5f6b57;
}

.admin-price-readonly {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.admin-price-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #f1f4ef;
    color: #5f6b57;
    font-size: 0.9rem;
}

.admin-price-status {
    display: none;
    margin-top: -8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #5f6b57;
}

.admin-price-status.saving {
    color: #6b7280;
}

.admin-price-status.saved {
    color: #1f7a35;
}

.admin-price-status.error {
    color: #c0392b;
}

.admin-price-status.locked {
    color: #6b7280;
}

.variety-net-price {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

/* Variants */
.product-variants {
    margin-bottom: 32px;
}

.product-variants label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.variant-option {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.variant-option:hover {
    border-color: var(--primary-color);
    background: rgba(44, 95, 45, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.15);
}

.variant-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Actions */
.product-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 4px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-main);
    transition: color 0.2s;
}

.qty-btn:hover {
    color: var(--primary-color);
}

.qty-input {
    width: 50px;
    text-align: center;
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-add-cart {
    flex: 1;
    background: var(--gradient-primary);
    background-size: 200% 100%;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
}

.btn-add-cart:hover {
    background-position: 100% 0;
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.3);
}

.btn-buy-now {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    background-size: 200% 100%;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.btn-buy-now:hover {
    background-position: 100% 0;
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.3);
}

/* Delivery Info */
.delivery-info-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f0fff4;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    color: var(--primary-dark);
}

.delivery-info-box i {
    font-size: 1.5rem;
}

.delivery-info-box strong {
    display: block;
    margin-bottom: 4px;
}

.delivery-info-box span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.plant-passport {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid rgba(44, 95, 45, 0.16);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 249, 244, 0.98) 100%);
}

.plant-passport-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.plant-passport-logo {
    width: 40px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.plant-passport-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dark);
}

.plant-passport-grid {
    display: grid;
    gap: 8px;
}

.plant-passport-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-top: 1px solid rgba(44, 95, 45, 0.08);
}

.plant-passport-row:first-child {
    border-top: none;
    padding-top: 0;
}

.plant-passport-label {
    display: inline-block;
    color: #000;
    font-weight: 700;
    font-size: 0.9rem;
}

.plant-passport-value {
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-main);
    word-break: break-word;
}

.plant-passport-note {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid rgba(44, 95, 45, 0.08);
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* Loading and Error States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: var(--text-secondary);
}

.error-container i {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-container p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Enhanced Variant Options */
.variant-option {
    position: relative;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    text-align: center;
}

.variant-option:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(44, 95, 45, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.15);
}

.variant-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.variant-option.selected:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    transform: none;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.2);
}

.variant-option.selected .variant-price {
    color: rgba(255, 255, 255, 0.9);
}

.variant-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.variant-option.is-hidden {
    opacity: 0.65;
    border-style: dashed;
    background:
        repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.03),
            rgba(0, 0, 0, 0.03) 10px,
            transparent 10px,
            transparent 20px),
        #f8f8f8;
}

.variant-option.is-hidden.selected {
    background:
        repeating-linear-gradient(45deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.12) 10px,
            transparent 10px,
            transparent 20px),
        var(--primary-color);
}

.variant-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.variant-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.variant-unavailable {
    font-size: 0.75rem;
    color: #e74c3c;
    margin-top: 4px;
}

.variant-visibility-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: 1px solid #d8d8d8;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.variant-visibility-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.variant-visibility-toggle.is-hidden {
    color: #999;
    background: rgba(220, 220, 220, 0.95);
}

.variant-hidden-label {
    margin-top: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a7a7a;
}

/* Tags Container */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Disabled Buttons */
.btn-add-cart:disabled,
.btn-buy-now:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
}

.btn-add-cart:disabled:hover,
.btn-buy-now:disabled:hover {
    box-shadow: none;
}

/* Expert Notes (Notatki eksperckie) */
.expert-notes-section {
    margin: 10px 0 20px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1.5px solid #f4b860;
    border-radius: 12px;
}

.expert-notes-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #000000;
    margin-bottom: 10px;
}

.expert-notes-content {
    font-size: 0.92rem;
    line-height: 1.7;
    color: #000000;
}

.expert-notes-content p {
    margin-bottom: 10px;
}

.expert-notes-content p:last-child {
    margin-bottom: 0;
}

/* Quantity Threshold Tiers (Rabat hurtowy) */
.threshold-tiers {
    margin: 10px 0 14px;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid #a0c4e8;
    border-radius: 10px;
}

.threshold-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: #1a5276;
    margin-bottom: 6px;
}

.threshold-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.threshold-tier {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: transparent;
    border: 1.5px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
    font-size: 0.84rem;
}

.threshold-tier:hover {
    background: #f0f7ff;
}

.threshold-tier.active {
    background: linear-gradient(135deg, #1a73e8 0%, #1565c0 100%);
    border-color: #1565c0;
    color: white;
    box-shadow: 0 3px 12px rgba(26, 115, 232, 0.3);
    transform: scale(1.02);
}

.threshold-tier .tier-qty {
    font-weight: 600;
}

.threshold-tier .tier-price {
    font-weight: 700;
}

.threshold-tier .tier-badge {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(231, 76, 60, 0.12);
    color: #c0392b;
    font-weight: 600;
}

.threshold-tier.active .tier-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Price with discount display */
.product-price .original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1.3rem;
    font-weight: 400;
    margin-right: 10px;
}

.product-price .discounted-price {
    color: #1a73e8;
}

/* Responsive */
@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-info-card {
        position: static;
        margin-top: 0;
    }

    .product-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .product-actions {
        flex-direction: column;
    }

    .quantity-selector {
        justify-content: space-between;
    }

    .btn-add-cart {
        padding: 16px;
    }

    .variant-options {
        flex-direction: column;
    }

    .variant-option {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
}
