/* css/pages/model.css */

:root {
    --color-primary: #C22225;
    --color-secondary: #1D3557;
    --color-dark: #232020;
    --color-light: #F8F8F8;
    --color-gray: #4D4D4D;
    --color-success: #27ae60;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

.model-detail {
    padding: 40px 0;
}

.model-detail__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 40px;
}

/* Хлібні крихти */
.breadcrumbs {
    padding: 20px 0;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

body.dark-theme .breadcrumbs {
    background: var(--color-dark);
    border-bottom-color: rgba(255,255,255,0.1);
}

.breadcrumbs__list {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
}

.breadcrumbs__item:not(:last-child)::after {
    content: '/';
    margin: 0 10px;
    color: var(--color-gray);
}

.breadcrumbs__link {
    color: var(--color-gray);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumbs__link:hover {
    color: var(--color-primary);
}

.breadcrumbs__item.active {
    color: var(--color-dark);
    font-weight: 500;
}

body.dark-theme .breadcrumbs__item.active {
    color: var(--color-light);
}

/* Галерея */
.model-gallery {
    position: relative;
}

.main-image {
    width: 100%;
    height: 450px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    background: #f5f5f5;
    border: 1px solid #e9ecef;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-grid {
    display: grid;
    /* Авто: до 6 мініатюр, мінімум 60px кожна */
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.thumbnail {
    height: 90px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border: 2px solid transparent;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
    border-color: var(--color-primary);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Інформація про модель */
.model-info {
    padding: 0;
}

.model-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.model-series-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-primary);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.brand-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.brand-link:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

.model-title {
    font-size: 2.2rem;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.2;
}

body.dark-theme .model-title {
    color: var(--color-light);
}

/* Статус та ціна (як на Rozetka) */
.model-status-price {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

body.dark-theme .model-status-price {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.status-row {
    margin-bottom: 15px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
}

.status-badge.in-stock {
    background: rgba(39, 174, 96, 0.1);
    color: var(--color-success);
}

.status-badge i {
    font-size: 1rem;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
}

.old-price {
    color: var(--color-gray);
    text-decoration: line-through;
    font-size: 1.2rem;
}

.current-price {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Блок оплати/гарантії/доставки (як на Rozetka) */
.model-purchase-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.info-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

body.dark-theme .info-section {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.info-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-theme .info-title {
    color: var(--color-light);
}

.info-list {
    list-style: none;
}

.info-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--color-gray);
}

.info-list li i {
    color: var(--color-success);
    font-size: 0.8rem;
}

/* Короткі характеристики */
.model-specs-short {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

body.dark-theme .model-specs-short {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.model-specs-short .spec-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

body.dark-theme .model-specs-short .spec-item {
    border-bottom-color: rgba(255,255,255,0.1);
}

.model-specs-short .spec-item:last-child {
    border-bottom: none;
}

.model-specs-short .spec-item span {
    color: var(--color-gray);
}

.model-specs-short .spec-item strong {
    color: var(--color-dark);
    font-weight: 600;
}

body.dark-theme .model-specs-short .spec-item strong {
    color: var(--color-light);
}

/* Кнопки дій */
.model-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.model-actions .btn {
    padding: 14px 25px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
    flex: 1;
    min-width: 180px;
}

.model-actions .btn i {
    font-size: 1.1rem;
}

.btn-3d {
    background: var(--color-secondary);
    color: white;
}

.btn-3d:hover {
    background: #142a44;
    transform: translateY(-2px);
}

.btn-download {
    background: var(--color-gray);
    color: white;
}

.btn-download:hover {
    background: #333;
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #9e1b1f;
    transform: translateY(-2px);
}

/* Вкладки (як на Rozetka) */
.model-tabs {
    margin: 40px 0;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    gap: 5px;
}

body.dark-theme .tabs-header {
    border-bottom-color: rgba(255,255,255,0.1);
}

.tab-btn {
    padding: 15px 30px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--color-dark);
}

body.dark-theme .tab-btn:hover {
    color: var(--color-light);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
}

.reviews-count {
    margin-left: 5px;
    font-size: 0.8rem;
    color: var(--color-gray);
}

.tabs-content {
    padding: 30px 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Опис */
.model-description {
    line-height: 1.8;
    color: var(--color-dark);
}

body.dark-theme .model-description {
    color: var(--color-light);
}

.model-description p {
    margin-bottom: 15px;
}

.model-features {
    margin-top: 25px;
}

.model-features h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--color-dark);
}

body.dark-theme .model-features h3 {
    color: var(--color-light);
}

.features-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

body.dark-theme .features-list li {
    background: rgba(255,255,255,0.05);
}

.features-list li::before {
    content: '✓';
    color: var(--color-primary);
    font-weight: 700;
}

/* Таблиця характеристик */
.model-specs {
    overflow-x: auto;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

body.dark-theme .specs-table {
    background: rgba(255,255,255,0.05);
}

.specs-table tr {
    border-bottom: 1px solid #e9ecef;
}

body.dark-theme .specs-table tr {
    border-bottom-color: rgba(255,255,255,0.1);
}

.specs-table td {
    padding: 15px 20px;
}

.specs-table td:first-child {
    font-weight: 500;
    color: var(--color-gray);
    width: 40%;
}

.specs-table td:last-child {
    font-weight: 600;
    color: var(--color-dark);
}

body.dark-theme .specs-table td:last-child {
    color: var(--color-light);
}

/* Відгуки */
.model-reviews {
    max-width: 800px;
    margin: 0 auto;
}

.no-reviews {
    text-align: center;
    padding: 40px;
    color: var(--color-gray);
    font-style: italic;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.review-item {
    padding: 25px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

body.dark-theme .review-item {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.review-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.review-author {
    font-weight: 600;
    color: var(--color-dark);
}

body.dark-theme .review-author {
    color: var(--color-light);
}

.review-date {
    color: var(--color-gray);
    font-size: 0.85rem;
}

.review-rating {
    display: flex;
    gap: 2px;
}

.review-rating i {
    color: #ddd;
}

.review-rating i.active {
    color: #f1c40f;
}

.review-text {
    line-height: 1.7;
    margin-bottom: 15px;
    color: var(--color-dark);
}

body.dark-theme .review-text {
    color: var(--color-light);
}

.review-footer {
    font-size: 0.85rem;
    color: var(--color-gray);
}

/* Схожі моделі */
.similar-models {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #e9ecef;
}

body.dark-theme .similar-models {
    border-top-color: rgba(255,255,255,0.1);
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
    color: var(--color-dark);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: var(--color-primary);
    margin: 15px auto 0;
}

body.dark-theme .section-title,
body.dark-theme .similar-models .section-title,
body.dark-theme section.similar-models h2.section-title {
    color: var(--color-light) !important;
    opacity: 1 !important;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.similar-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: var(--transition);
}

body.dark-theme .similar-card {
    background: rgba(255,255,255,0.05);
}

.similar-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.similar-card__link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.similar-card__image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.similar-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.similar-card:hover .similar-card__image img {
    transform: scale(1.05);
}

/* Бейдж серії поверх фото — showing на карточці, до якої серії належить модель.
   Окремий колір для моделі з іншої серії, ніж та, яку зараз переглядають,
   щоб було одразу видно: це не пряма "рідна" модель, а аналог за потужністю. */
.similar-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: var(--color-primary);
    letter-spacing: 0.02em;
}

.similar-card__badge--alt {
    background: rgba(30, 30, 30, 0.75);
}

.similar-card__content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.similar-card__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-dark);
    line-height: 1.3;
}

body.dark-theme .similar-card__title {
    color: var(--color-light);
}

.similar-card__power {
    color: var(--color-gray);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.similar-card__power i {
    color: var(--color-primary);
    margin-right: 4px;
}

.similar-card__price-row {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.similar-card__old-price {
    color: var(--color-gray);
    text-decoration: line-through;
    font-size: 0.9rem;
}

.similar-card__price {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.2rem;
}

/* Адаптивність */
@media (max-width: 1200px) {
    .similar-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .model-detail__grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .main-image {
        height: 400px;
    }
    
    .model-purchase-info {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .model-purchase-info {
        grid-template-columns: 1fr;
    }
    
    .model-actions {
        flex-direction: column;
    }
    
    .model-actions .btn {
        width: 100%;
    }
    
    .features-list {
        grid-template-columns: 1fr;
    }
    
    .similar-grid {
        grid-template-columns: 1fr;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .thumbnail {
        height: 70px;
    }
    
    .tabs-header {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .model-title {
        font-size: 1.8rem;
    }
    
    .current-price {
        font-size: 1.8rem;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .thumbnail {
        height: 60px;
    }
    
    .brand-link {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════
   ГАЛЕРЕЯ: стрілки, лічильник, кнопка зуму
   ═══════════════════════════════════════════════════════ */

/* .main-image вже є в CSS — розширюємо його */
.main-image {
    position: relative;  /* потрібно для абсолютних елементів всередині */
    cursor: zoom-in;
}

.main-image img {
    transition: opacity 0.2s ease;
}

.main-image img.gallery-fading {
    opacity: 0;
}

/* Стрілки */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    cursor: pointer;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: background 0.2s, opacity 0.2s;
    user-select: none;
}
.main-image:hover .gallery-arrow {
    opacity: 1;
}
.gallery-arrow:hover {
    background: rgba(194, 34, 37, 0.85);
}
.gallery-arrow--prev { left: 12px; }
.gallery-arrow--next { right: 12px; }
.gallery-arrow:disabled {
    opacity: 0 !important;
    pointer-events: none;
}

/* Лічильник "1 / 3" */
.gallery-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    pointer-events: none;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

/* Кнопка зуму */
.gallery-zoom-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.main-image:hover .gallery-zoom-btn {
    opacity: 1;
}
.gallery-zoom-btn:hover {
    background: rgba(194, 34, 37, 0.85);
}

/* ═══════════════════════════════════════════════════════
   МОДАЛЬНЕ ВІКНО ПЕРЕГЛЯДУ ФОТО
   ═══════════════════════════════════════════════════════ */
.photo-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.93);
    align-items: center;
    justify-content: center;
}
.photo-modal-overlay.active {
    display: flex;
    animation: pmFadeIn 0.2s ease;
}
@keyframes pmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.photo-modal__img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 88vh;
}
.photo-modal__img-wrap img {
    max-width: 88vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: 6px;
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.photo-modal__img-wrap img.gallery-fading {
    opacity: 0;
}

.photo-modal__close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    font-size: 30px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.photo-modal__close:hover {
    background: rgba(194, 34, 37, 0.85);
}

.photo-modal__arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    font-size: 46px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    user-select: none;
}
.photo-modal__arrow:hover {
    background: rgba(194, 34, 37, 0.85);
}
.photo-modal__arrow--prev { left: 14px; }
.photo-modal__arrow--next { right: 14px; }
.photo-modal__arrow:disabled {
    opacity: 0.2;
    cursor: default;
}

.photo-modal__counter {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    background: rgba(0, 0, 0, 0.45);
    padding: 4px 14px;
    border-radius: 20px;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   КНОПКА "Всі характеристики"
   ═══════════════════════════════════════════════════════ */
.btn-specs-link {
    background: transparent;
    border: 2px solid var(--color-secondary, #1D3557);
    color: var(--color-secondary, #1D3557);
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
    flex: 1;
    min-width: 180px;
    justify-content: center;
}
.btn-specs-link:hover {
    background: var(--color-secondary, #1D3557);
    color: #fff;
}

/* Адаптив для модального на мобільному */
@media (max-width: 600px) {
    .photo-modal__arrow {
        width: 44px;
        height: 44px;
        font-size: 34px;
    }
    .photo-modal__arrow--prev { left: 6px; }
    .photo-modal__arrow--next { right: 6px; }
}


/* ═══════════════════════════════════════════════════════
   ВКЛАДКА "ТЕХНІЧНИЙ ПАСПОРТ"
   ═══════════════════════════════════════════════════════ */
.passport-tab {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.passport-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.passport-viewer {
    width: 100%;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f5f5f5;
}

body.dark-theme .passport-viewer {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
}

.passport-iframe {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}

/* Заглушка якщо паспорту немає */
.passport-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray);
}

.passport-empty__icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

body.dark-theme .passport-empty__icon {
    color: rgba(255,255,255,0.2);
}

.passport-empty p {
    margin-bottom: 10px;
    font-size: 1rem;
    line-height: 1.6;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
}
.btn-link:hover {
    color: #9e1b1f;
}

@media (max-width: 768px) {
    .passport-iframe {
        height: 480px;
    }
    .passport-actions {
        flex-direction: column;
    }
    .passport-actions .btn {
        width: 100%;
        justify-content: center;
    }
}