/**
 * Strona produktu (public_html/p/index.php)
 * Nagłówek, warianty, autor, modal kontaktu, pasek „Kup teraz”.
 * Stopka .product-footer jest w style.css (wspólna z order).
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body { background: #f6f8f4; }

.product-page {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.product-header {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.product-header-top {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.product-lang-switcher {
    display: flex;
    align-items: center;
    gap: 5px;
}
.product-lang-switcher .lang-label { margin-right: 5px; font-size: 1rem; }
.product-lang-switcher .lang-btn {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: #5c6b54;
    background: #f0f4ed;
    transition: all 0.2s;
}
.product-lang-switcher .lang-btn:hover {
    background: #dce3d6;
    color: #1a2612;
}
.product-lang-switcher .lang-btn.active {
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    color: #fff;
}

.product-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
}
.product-type-badge svg { width: 24px; height: 24px; }
.product-type-badge img { width: 24px; height: 24px; object-fit: contain; }

.product-header h1 {
    margin: 0 0 15px 0;
    font-size: 2rem;
    color: #1a2612;
}

.product-meta {
    color: #5c6b54;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.product-description { color: #4a5a42; line-height: 1.7; }
.product-description p { margin: 0 0 1em 0; }
.product-description h1, .product-description h2, .product-description h3,
.product-description h4, .product-description h5, .product-description h6 {
    color: #1a2612;
    margin: 1.5em 0 0.5em 0;
}
.product-description ul, .product-description ol { margin: 0 0 1em 1.5em; padding: 0; }
.product-description li { margin-bottom: 0.5em; }
.product-description img { max-width: 100%; height: auto; border-radius: 8px; margin: 1em 0; }
.product-description a { color: #3d6b1e; }
.product-description blockquote {
    border-left: 4px solid #3d6b1e;
    margin: 1em 0;
    padding: 0.5em 1em;
    background: #f6f8f4;
    color: #5c6b54;
}
.product-description table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.product-description th, .product-description td {
    border: 1px solid #dce3d6;
    padding: 8px 12px;
    text-align: left;
}
.product-description th { background: #f6f8f4; }

.seller-section {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.seller-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    color: #1a2612;
}
.seller-section .seller-info {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}
.seller-section .seller-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.seller-section .seller-avatar img { width: 100%; height: 100%; object-fit: cover; }
.seller-section .seller-details { flex: 1; }
.seller-section .seller-name {
    font-weight: 700;
    color: #1a2612;
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.seller-section .seller-bio {
    color: #5c6b54;
    font-size: 0.9rem;
    line-height: 1.6;
}
.seller-section .seller-bio p { margin: 0 0 0.5em 0; }
.seller-section .seller-bio p:last-child { margin-bottom: 0; }

.btn-contact-seller {
    margin-top: 15px;
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(61, 107, 30, 0.3);
}
.btn-contact-seller:hover {
    background: linear-gradient(135deg, #2d5016 0%, #581c87 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 107, 30, 0.4);
}

.seller-name a.link-author-page {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}
.seller-name a.link-author-page:hover {
    color: #3d6b1e;
    text-decoration: underline;
}

.contact-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.contact-modal.show { display: flex; }
.contact-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.contact-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.contact-modal-header h3 { margin: 0; font-size: 1.2rem; color: #1a2612; }
.contact-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #8a9a7e;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.contact-modal-close:hover { color: #5c6b54; }
.contact-modal .form-group { margin-bottom: 15px; }
.contact-modal label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #4a5a42;
    font-weight: 500;
}
.contact-modal input,
.contact-modal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce3d6;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.contact-modal input:focus,
.contact-modal textarea:focus {
    outline: none;
    border-color: #3d6b1e;
    box-shadow: 0 0 0 3px rgba(61, 107, 30, 0.15);
}
.contact-modal textarea { resize: vertical; min-height: 100px; }
.contact-modal .btn-send {
    width: 100%;
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.contact-modal .btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 107, 30, 0.4);
}
.contact-modal .btn-send:disabled {
    background: #8a9a7e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.alert-success-global {
    background: #dcfce7;
    color: #166534;
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
}
.alert-error-contact {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.variants-section { margin-bottom: 30px; }
.variants-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #1a2612;
}
.variants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.variant-card {
    background: #fff;
    border: 2px solid #dce3d6;
    border-radius: 12px;
    padding: 25px;
    transition: all 0.2s;
}
.variant-card:hover {
    border-color: #3d6b1e;
    box-shadow: 0 4px 15px rgba(61,107,30,0.2);
}
.variant-card.featured {
    border-color: #3d6b1e;
    background: linear-gradient(to bottom, #f0f4ff 0%, #fff 100%);
}
.variant-card.featured::before {
    content: 'Polecany';
    display: inline-block;
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.variant-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a2612;
    margin-bottom: 5px;
}
.variant-desc {
    color: #5c6b54;
    font-size: 0.9rem;
    margin-bottom: 15px;
}
.variant-desc p { margin: 0 0 0.5em 0; }
.variant-desc p:last-child { margin-bottom: 0; }
.variant-desc ul, .variant-desc ol { margin: 0 0 0.5em 1.2em; padding: 0; }
.variant-desc img { max-width: 100%; height: auto; border-radius: 4px; }

.variant-price {
    font-size: 2rem;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 15px;
}
.variant-price small { font-size: 1rem; color: #5c6b54; }

.variant-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}
.variant-features li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f4ed;
    color: #4a5a42;
    font-size: 0.95rem;
}
.variant-features li:last-child { border-bottom: none; }
.variant-features li::before {
    content: '✓';
    color: #16a34a;
    margin-right: 10px;
    font-weight: bold;
}

.product-page .btn-buy {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3d6b1e 0%, #6b21a8 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(61, 107, 30, 0.3);
}
.product-page .btn-buy:hover {
    background: linear-gradient(135deg, #2d5016 0%, #581c87 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 107, 30, 0.4);
}

.no-variants-message {
    background: #fff;
    color: #5c6b54;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}

.product-float-buy {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    padding: 10px 24px;
    background: linear-gradient(135deg, #3d6b1e 0%, #2d5016 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 999px;
    border: none;
    box-shadow: 0 4px 20px rgba(61, 107, 30, 0.4);
    cursor: pointer;
    transition: opacity 0.25s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.product-float-buy:hover {
    transform: translateX(-50%) scale(1.03);
    box-shadow: 0 6px 24px rgba(61, 107, 30, 0.5);
    color: #fff;
}
.product-float-buy.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 600px) {
    .seller-section .seller-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .contact-modal-content { padding: 20px; }
}

/* Dark mode – product page */
[data-theme="dark"] body { background: #0d0d0d; }
[data-theme="dark"] .product-page { background: #0d0d0d; }
[data-theme="dark"] .product-header {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
}
[data-theme="dark"] .product-title { color: #ffffff; }
[data-theme="dark"] .product-description { color: #b0b0b0; }
[data-theme="dark"] .product-description h1,
[data-theme="dark"] .product-description h2,
[data-theme="dark"] .product-description h3,
[data-theme="dark"] .product-description h4,
[data-theme="dark"] .product-description h5,
[data-theme="dark"] .product-description h6 {
    color: #ffffff;
}
[data-theme="dark"] .product-description blockquote {
    background: #253318;
    color: #e0e8dc;
    border-left-color: #4a8c1e;
}
[data-theme="dark"] .variants-section h2 { color: #e8e8e8; }
[data-theme="dark"] .product-sidebar {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
}
[data-theme="dark"] .variant-card {
    background: #141414;
    border: 1px solid #2a2a2a;
}
[data-theme="dark"] .variant-card:hover { border-color: #3d6b1e; }
[data-theme="dark"] .variant-name { color: #ffffff; }
[data-theme="dark"] .variant-desc { color: #b0b0b0; }
[data-theme="dark"] .seller-section,
[data-theme="dark"] .seller-section .seller-info {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
}
[data-theme="dark"] .seller-section h3 { color: #ffffff; }
[data-theme="dark"] .seller-section .seller-name { color: #ffffff; }
[data-theme="dark"] .seller-section .seller-bio { color: #b0b0b0; }
[data-theme="dark"] .product-page .btn-buy,
[data-theme="dark"] .product-float-buy { color: #ffffff !important; }
[data-theme="dark"] .product-page .btn-buy:hover,
[data-theme="dark"] .product-float-buy:hover { color: #ffffff !important; }
[data-theme="dark"] .product-lang-switcher .lang-btn {
    background: #1a1a1a;
    border-color: #333333;
    color: #b0b0b0;
}
[data-theme="dark"] .product-lang-switcher .lang-btn:hover {
    border-color: #3d6b1e;
    color: #4a8c1f;
}
[data-theme="dark"] .no-variants-message {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #b0b0b0;
}
[data-theme="dark"] .product-float-buy {
    background: linear-gradient(135deg, #4a8c1f 0%, #3d6b1e 100%);
    box-shadow: 0 4px 20px rgba(74, 140, 31, 0.4);
    color: #ffffff !important;
}
