/* =========================================
   PRODUCT.CSS - ПРЕМИУМ ИЗГЛЕД (По снимките)
   ========================================= */

.product-page { padding: 0 0 100px; background: #fbf9ff; color: var(--color-text); }

/* ГЛАВНА МРЕЖА (Разпределение) */
.product-main-layout { 
    display: grid; 
    grid-template-columns: 1fr 1fr; /* Две равни колони */
    gap: 50px; 
    align-items: start;
    margin-bottom: 80px;
}

/* =========================================
   ЛЯВА КОЛОНА: ГАЛЕРИЯ
   ========================================= */
.product-gallery-card {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =========================================
   ГАЛЕРИЯ И ЗУУМ
   ========================================= */
.main-frame { 
    width: 100%; 
    border-radius: 12px; 
    overflow: hidden; 
    position: relative; 
    cursor: crosshair; /* По-професионален курсор за зуум */
    background: #fafafa;
}

.main-frame img { 
    width: 100%; 
    aspect-ratio: 3/4; 
    object-fit: cover; 
    display: block; 
    transform-origin: center center; 
    transition: transform 0.2s ease-out; 
}

/* МАГИЯТА ЗА ЗУУМА (За Десктоп) */
@media (min-width: 993px) {
    .main-frame:hover img { 
        transform: scale(2.5); 
    }
}

/* КРАСИВ БУТОН ЗА ЦЯЛ ЕКРАН */
.btn-expand-image {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px); /* Стъклен ефект */
    border: 1px solid rgba(0, 139, 139, 0.15);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.btn-expand-image:hover {
    background: var(--color-primary);
    color: #fff;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 20px rgba(0, 139, 139, 0.3);
}

/* Малките снимки отдолу */
.bottom-thumbs { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }
.side-img { 
    width: 90px; 
    height: 120px; 
    object-fit: cover; 
    border-radius: 10px; /* Леко заоблени ъгли и тук */
    cursor: pointer; 
    opacity: 0.6; 
    transition: 0.3s; 
    border: 2px solid transparent; 
}
.side-img:hover { opacity: 1; }
.side-img.active { opacity: 1; border-color: var(--color-primary); box-shadow: 0 5px 15px rgba(0,139,139,0.2); }
/* =========================================
   ДЯСНА КОЛОНА: ИНФОРМАЦИЯ
   ========================================= */
.product-category-label { font-size: 0.85rem; font-weight: 800; color: var(--color-secondary); letter-spacing: 1px; display: block; margin-bottom: 10px; }
.prod-title { font-family: var(--font-heading); font-size: 2.8rem; margin-bottom: 15px; line-height: 1.2; color: #1a2b3c; }

.main-rating { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; }
.stars-outer { display: inline-block; position: relative; font-family: "Font Awesome 5 Free"; font-weight: 900; color: #eee; font-size: 1.1rem; }
.stars-outer::before { content: "\f005 \f005 \f005 \f005 \f005"; }
.stars-inner { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; color: #ffbb00; }
.stars-inner::before { content: "\f005 \f005 \f005 \f005 \f005"; }
.rev-link { color: #D2691E; font-size: 0.95rem; cursor: pointer; }
.rev-link:hover { color: #943b00; text-decoration: underline; }

/* ЦЕНА В КАРТИЧКА */
.price-display-card { 
    background: #fff; padding: 20px 30px; border-radius: 15px; 
    display: inline-flex; flex-direction: column; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.03); margin-bottom: 30px; 
}
.price-display-card .eur { font-size: 2.5rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.price-display-card .bgn { font-size: 1rem; color: #888; font-weight: 600; text-align: right; margin-top: 5px; }

/* ФОРМА И БУТОНИ */
.btn-materials-modal { width: 100%; padding: 15px; border-radius: 12px; border: 2px dashed var(--color-secondary); background: rgba(147, 112, 219, 0.05); color: var(--color-secondary); font-weight: 700; font-size: 1rem; cursor: pointer; transition: 0.3s; margin-bottom: 25px; }
.btn-materials-modal:hover { background: var(--color-secondary); color: #fff; }

.requirement-box { margin-bottom: 25px; }
.requirement-box label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 10px; color: #333; }
.requirement-box .required { color: #e74c3c; }
.requirement-box textarea { width: 100%; min-height: 100px; padding: 15px; border: 2px solid #eee; border-radius: 12px; font-family: var(--font-body); resize: vertical; transition: 0.3s; background: #fff; }
.requirement-box textarea:focus { border-color: var(--color-primary); outline: none; color: var(--color-secondary);}

.buy-row { display: flex; gap: 15px; margin-bottom: 40px; height: 50px; }
.qty-selector { display: flex; border: 2px solid #eee; border-radius: 12px; width: 120px; justify-content: space-between; align-items: center; background: #fff; }
.btn-qty { width: 40px; height: 100%; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--color-accent); }
.btn-qty:hover { background: #f5f5f5; color: #943b00;}
#qty-input { width: 40px; text-align: center; border: none; font-weight: bold; font-size: 1.1rem; pointer-events: none; color: #333; }

.btn-add-cart { flex: 1; background: var(--color-primary); color: #fff; border: none; border-radius: 12px; font-weight: 800; font-size: 1.05rem; cursor: pointer; transition: 0.3s; box-shadow: 0 8px 15px rgba(0,139,139,0.2); }
.btn-add-cart:hover { background: #007373; transform: translateY(-2px); box-shadow: 0 12px 20px rgba(0,139,139,0.3); }

/* АКОРДЕОНИ */
.product-accordion { border-top: 1px solid #eee; padding-top: 15px; }
.acc-item { border-bottom: 1px solid #eee; }
.acc-btn { width: 100%; text-align: left; padding: 20px 0; background: none; border: none; font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: #333; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: 0.3s; }
.acc-btn:hover { color: var(--color-primary); }
.acc-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; color: #666; font-size: 0.95rem; line-height: 1.6; }
.acc-item.active .acc-content { max-height: 800px; padding-bottom: 20px; }

/* =========================================
   ПОДОБНИ ПРОДУКТИ
   ========================================= */
.section-title { font-family: var(--font-heading); font-size: 2.2rem; text-align: center; margin-bottom: 40px; color: #1a2b3c; }

/* Променена мрежа: Твърда ширина за картите и центриране, когато са малко */
.similar-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, 260px); 
    justify-content: center; 
    gap: 30px; 
    margin-bottom: 80px; 
}

.sim-card { 
    background: #fff; border-radius: 20px; overflow: hidden; 
    text-decoration: none; color: var(--color-text); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.03); transition: 0.3s; 
    display: block; border: 1px solid transparent; 
}

.sim-card:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(0,0,0,0.08); border-color: #eee; }

/* Снимките на подобните продукти също стават 3:4 */
.sim-card img { 
    width: 100%; 
    aspect-ratio: 3/4; 
    object-fit: cover; 
    display: block;
}

.sim-card-body { padding: 20px; text-align: center; }
.sim-card h4 { font-size: 1.1rem; margin-bottom: 10px; font-family: var(--font-heading); color: #333; }
.sim-price .eur { font-weight: 800; color: var(--color-primary); font-size: 1.2rem; }
/* =========================================
   ОТЗИВИ (В КАРТИЧКА)
   ========================================= */
.reviews-container-card { background: #fff; padding: 40px; border-radius: 25px; box-shadow: 0 10px 40px rgba(0,0,0,0.03); max-width: 900px; margin: 0 auto; }

/* Формата */
.review-form-box { background: #fbf9ff; padding: 30px; border-radius: 15px; margin-bottom: 40px; border: 2px dashed #eee; }
.star-rating-input { display: inline-flex; flex-direction: row-reverse; gap: 5px; font-size: 1.8rem; margin-bottom: 15px; }
.star-rating-input input { display: none; }
.star-rating-input label { color: #e4e4e4; cursor: pointer; transition: 0.2s; }
.star-rating-input label:hover, .star-rating-input label:hover ~ label, .star-rating-input input:checked ~ label { color: #ffbb00; }
.review-form-box textarea { width: 100%; min-height: 90px; padding: 15px; border: 2px solid #eee; border-radius: 12px; margin-bottom: 15px; font-family: var(--font-body); resize: vertical; }
.review-form-box textarea:focus { border-color: var(--color-secondary); outline: none; color: var(--color-primary);}
.btn-submit-review { background: var(--color-secondary); color: #fff; border: none; padding: 12px 30px; border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.btn-submit-review:hover { background: #7a52c7; transform: translateY(-2px); }

/* Списък с отзиви */
.review-item { padding: 30px 0; border-bottom: 1px solid #eee; }
.review-item:last-child { border-bottom: none; padding-bottom: 0; }
.hidden-review { display: none; }

.rev-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.rev-author { display: flex; align-items: center; gap: 10px; }
.rev-author i { font-size: 1.8rem; color: #ccc; }
.rev-author strong { font-size: 1.1rem; color: #333; }
.admin-badge { font-size: 0.7rem; background: var(--color-primary); color: #fff; padding: 3px 8px; border-radius: 12px; font-weight: bold; }

.rev-text { color: #555; line-height: 1.6; margin-bottom: 15px; font-size: 0.95rem; }

.rev-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.rev-date { color: #999; }
.btn-delete-review { background: none; border: none; color: #e74c3c; cursor: pointer; opacity: 0.7; transition: 0.2s; display: flex; align-items: center; gap: 5px; }
.btn-delete-review:hover { opacity: 1; text-decoration: underline; }

.btn-show-all-reviews { display: block; width: 100%; padding: 15px; margin-top: 30px; background: none; border: 2px solid #eee; border-radius: 12px; color: #555; font-weight: bold; cursor: pointer; transition: 0.3s; text-align: center; }
.btn-show-all-reviews:hover { border-color: var(--color-primary); color: var(--color-primary); background: #fafafa; }
.login-msg { text-align: center; color: #666; margin-bottom: 30px; font-style: italic; }
.no-reviews { text-align: center; color: #888; padding: 30px 0; }
/* =========================================
   КЪСТЪМ МОДАЛ ЗА ИЗТРИВАНЕ
   ========================================= */
.custom-modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); z-index: 99999; align-items: center; justify-content: center; 
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.custom-modal-overlay.show { display: flex; animation: fadeInModal 0.2s ease-in-out forwards; }

.custom-modal-box { 
    background: #fff; padding: 35px 30px; border-radius: 20px; 
    width: 90%; max-width: 400px; text-align: center; 
    box-shadow: 0 15px 50px rgba(0,0,0,0.15); animation: scaleUpModal 0.3s ease-in-out forwards; 
}

.modal-icon.warning { font-size: 3.5rem; color: #e74c3c; margin-bottom: 15px; }
.custom-modal-box h3 { font-family: var(--font-heading); font-size: 1.6rem; color: #333; margin-bottom: 10px; }
.custom-modal-box p { color: #666; font-size: 0.95rem; margin-bottom: 30px; line-height: 1.5; }

.modal-buttons { display: flex; gap: 15px; justify-content: center; }
.modal-buttons button { flex: 1; padding: 12px; border-radius: 12px; font-weight: bold; border: none; cursor: pointer; transition: 0.2s; font-size: 1rem; }
.btn-cancel { background: #f1f1f1; color: #555; }
.btn-cancel:hover { background: #e4e4e4; color: #333; }
.btn-confirm-delete { background: #e74c3c; color: #fff; box-shadow: 0 5px 15px rgba(231, 76, 60, 0.2); }
.btn-confirm-delete:hover { background: #c0392b; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3); }
/* БУТОНИ В ОТЗИВИТЕ (Редактирай и Изтрий) */
.rev-actions { display: flex; gap: 15px; }
.btn-edit-review { background: none; border: none; color: #D2691E; cursor: pointer; opacity: 0.7; transition: 0.2s; display: flex; align-items: center; gap: 5px; }
.btn-edit-review:hover { opacity: 1; text-decoration: underline; color: #943b00; }
/* =========================================
   ИЗБРАНИ МАТЕРИАЛИ (ТАГОВЕ)
   ========================================= */
.selected-materials-container { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.material-tag { 
    background: rgba(0, 139, 139, 0.08); color: var(--color-primary); 
    padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; font-weight: 600; 
    display: flex; align-items: center; gap: 10px; 
    border: 1px solid rgba(0, 139, 139, 0.2); animation: fadeIn 0.3s ease; 
}
.material-tag i { cursor: pointer; color: #e74c3c; font-size: 1rem; transition: 0.2s; padding: 2px; }
.material-tag i:hover { transform: scale(1.2) rotate(90deg); }
.clear-all-mats { 
    background: none; border: none; color: #e74c3c; font-size: 0.85rem; 
    cursor: pointer; text-decoration: underline; font-weight: 600; padding: 8px; transition: 0.2s; 
}
.clear-all-mats:hover { color: #c0392b; }
/* ЗАГЛАВИЕ НА МОДАЛА ЗА РЕДАКТИРАНЕ */
.modal-header-edit { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header-edit h3 { margin: 0; font-family: var(--font-heading); font-size: 1.5rem; color: #333; }
.modal-header-edit .close-modal-btn { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.05); border: none; font-size: 1.5rem; color: #888; cursor: pointer; transition: 0.3s; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-header-edit .close-modal-btn:hover { background: #e74c3c; color: #fff; transform: rotate(90deg) scale(1.05); }
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUpModal { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =========================================
   МОДАЛ ЗА МАТЕРИАЛИ (РАЗДЕЛЕН ИЗГЛЕД)
   ========================================= */
.materials-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 99999; display: none; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 20px; opacity: 0; transition: 0.3s; }
.materials-modal-overlay.show { opacity: 1; }
.materials-modal-box { max-width: 850px; width: 100%; background: #fff; border-radius: 20px; display: flex; flex-direction: column; position: relative; margin: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.2); transform: translateY(20px); transition: 0.3s; }
.materials-modal-overlay.show .materials-modal-box { transform: translateY(0); }
.close-modal-btn {
    position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.05); border: none;
    font-size: 1.1rem; color: #888; cursor: pointer; transition: 0.3s;
    width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; z-index: 10; }
.close-modal-btn:hover { background: #e74c3c; color: #fff; transform: rotate(90deg) scale(1.05); }

.modal-header { padding: 30px 40px 15px; border-bottom: 1px solid #eee; text-align: center; }
.modal-header h3 { font-family: var(--font-heading); font-size: 2rem; color: var(--color-primary); margin-bottom: 5px; }
.modal-header p { color: #888; }
.modal-body { padding: 30px 40px; }

.material-group-section { margin-bottom: 40px; }
.material-group-section:last-child { margin-bottom: 0; }
.group-title { font-family: var(--font-heading); font-size: 1.4rem; margin-bottom: 20px; color: #333; border-left: 4px solid var(--color-secondary); padding-left: 12px; }

.material-split-view { display: flex; gap: 30px; align-items: stretch; }
/* КРАСИВА И АДАПТИВНА РАМКА ЗА СНИМКИТЕ В МОДАЛА */
.material-image-col { 
    flex: 1; border-radius: 15px; background: #fdfdfd; 
    display: flex; align-items: center; justify-content: center; 
    padding: 15px; border: 1px solid #eee; box-shadow: 0 10px 20px rgba(0,0,0,0.03); 
}
.material-image-col img { 
    width: 100%; max-height: 400px; object-fit: contain; display: block; 
}
.material-options-col { flex: 1.2; display: flex; flex-direction: column; gap: 12px; justify-content: center; }

/* Красивите Радио Бутони */
.custom-radio-label { display: flex; align-items: center; gap: 15px; padding: 15px 20px; border: 2px solid #eee; border-radius: 12px; cursor: pointer; transition: 0.3s; background: #fafafa; }
.custom-radio-label:hover { border-color: var(--color-primary); background: #fff; transform: translateX(5px); }
.custom-radio-label input { display: none; }
.radio-custom { width: 22px; height: 22px; border: 2px solid #ccc; border-radius: 50%; position: relative; transition: 0.3s; flex-shrink: 0; }
.custom-radio-label input:checked + .radio-custom { border-color: var(--color-primary); }
.custom-radio-label input:checked + .radio-custom::after { content: ''; width: 12px; height: 12px; background: var(--color-primary); border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.custom-radio-label input:checked ~ .radio-text { font-weight: 700; color: var(--color-primary); }
.radio-text { font-size: 1rem; color: #555; }

.modal-footer { padding: 20px 40px; border-top: 1px solid #eee; }
.btn-confirm-materials { width: 100%; padding: 16px; background: var(--color-primary); color: #fff; border: none; border-radius: 12px; font-weight: 800; font-size: 1.1rem; cursor: pointer; transition: 0.3s; box-shadow: 0 5px 15px rgba(0,139,139,0.2); }
.btn-confirm-materials:hover { background: #007777; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,139,139,0.3); }

@media (max-width: 768px) {
    .material-split-view { flex-direction: column; }
    .material-image-col img { max-height: 350px; }
    .materials-modal-box { padding: 0; }
    .modal-header, .modal-body, .modal-footer { padding: 20px; }
}
.color-disclaimer {
    display: flex; align-items: flex-start; gap: 20px; background: white; transition: transform 0.6s ease;
    padding: 20px; border-radius: 20px; box-shadow: 0 5px 20px rgba(0,0,0,0.04); border-left: 5px solid var(--color-accent);
}

.color-disclaimer .disclaimer-icon {
    font-size: 1.4rem;
    color: var(--color-accent);
    margin-top: 2px;
}

.color-disclaimer .disclaimer-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color); /* Или #555, ако нямаш променлива */
}

.color-disclaimer .disclaimer-text strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 600;
}
/* =========================================
   РЕСПОНСИВ (Таблет и Смартфон)
   ========================================= */

/* --- ТАБЛЕТИ (от 600px до 900px) --- */
@media (max-width: 900px) and (min-width: 600px) {
    .product-main-layout { 
        display: grid;
        grid-template-columns: 1fr 1.2fr; 
        gap: 15px 30px; 
        align-items: start;
    }
    
    /* Разграждаме контейнера, за да управляваме елементите вътре свободно */
    .product-details {
        display: contents; 
    }
    
    /* Снимката заема лявата колона и се разтяга надолу */
    .product-gallery-card { 
        grid-column: 1 / 2;
        grid-row: 1 / 6; 
        padding: 15px; 
    }
    
    /* --- ДЯСНА КОЛОНА (Основно инфо) --- */
    .product-category-label {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        align-self: end;
        margin-bottom: 0;
        padding-top: 15px; 
    }
    
    .prod-title {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        font-size: 2.2rem;
        margin-bottom: 0;
    }

    .main-rating {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
        margin-bottom: 0;
    }

    .price-display-card {
        grid-column: 2 / 3;
        grid-row: 4 / 5;
        margin-bottom: 0;
        align-self: start;
    }
    
    /* --- ДОЛНА ЧАСТ (На пълна ширина) --- */
    /* Всички останали елементи заемат и двете колони отдолу */
    .product-details > *:not(.product-category-label):not(.prod-title):not(.main-rating):not(.price-display-card) {
        grid-column: 1 / -1;
    }

    .btn-materials-modal, #addToCartForm {
        margin-top: 20px;
    }

    /* Настройки за малките елементи */
    .bottom-thumbs { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 10px; }
    .side-img { width: 70px; height: 70px; flex-shrink: 0; }
    .reviews-container-card { padding: 30px; }
}

/* --- СМАРТФОНИ (Под 600px - всичко в 1 колона) --- */
@media (max-width: 599px) {
    .product-main-layout { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 30px; 
    }
    
    .product-details {
        display: block; /* Връщаме нормалното поведение */
    }
    
    .product-gallery-card { 
        padding: 15px; 
    }
    
    .bottom-thumbs { 
        justify-content: flex-start; 
        overflow-x: auto; 
        flex-wrap: nowrap; 
        padding-bottom: 10px; 
    }
    
    .side-img { 
        width: 70px; 
        height: 70px; 
        flex-shrink: 0; 
    }
    
    .prod-title { 
        font-size: 2rem; 
    }
    
    .reviews-container-card { 
        padding: 25px 15px; 
    }
}
/* СПИРА ОТВАРЯНЕТО НА СНИМКАТА НА МОБИЛЕН */
@media (max-width: 992px) {
    /* Този селектор хваща всеки линк, който обгражда картинка вътре в галерията */
    .product-gallery a {
        pointer-events: none !important;
        cursor: default !important;
    }
}