/**
 * Стили для страницы сертификатов
 */

/* Карточки сертификатов */
.certificate-card {
    border-radius: 16px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.certificate-image-wrapper {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    overflow: hidden;
}

/* Оптимизированные миниатюры */
.certificate-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Показываем полностью, не обрезаем */
    object-position: center;
}

/* На мобильных устройствах - еще более компактное отображение */
@media (max-width: 768px) {
    .certificate-image-wrapper {
        padding-top: 120% !important; /* Меньше высота на мобильных */
    }
    
    .certificate-thumb {
        object-fit: contain;
    }
}

.certificate-card:hover .certificate-thumb {
    transform: scale(1.05);
}

.certificate-info {
    background: white;
}

.certificate-title {
    color: #1F2933;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.certificate-institution {
    color: #666;
    font-size: 0.875rem;
}

/* Lightbox */
.certificate-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.certificate-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.certificate-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.certificate-lightbox-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.certificate-lightbox-image-wrapper img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.certificate-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.certificate-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.certificate-lightbox-prev,
.certificate-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.certificate-lightbox-prev {
    left: 1rem;
}

.certificate-lightbox-next {
    right: 1rem;
}

.certificate-lightbox-prev:hover,
.certificate-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.certificate-lightbox-info {
    text-align: center;
    color: white;
    max-width: 800px;
}

.certificate-lightbox-info h3 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.certificate-lightbox-info p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0.5rem 0 0 0;
}

.certificate-lightbox-info #lightboxCounter {
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1rem;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Специальные стили для проблемных сертификатов */
/* Исправление выравнивания для Letter of Authorisation (cert-05) */
.cert-fix-alignment {
    object-position: center center !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.certificate-card:hover .cert-fix-alignment {
    transform: translateX(-50%) scale(1.05) !important;
}

/* Поворот для альбомных сертификатов (Summer Camp и подобные) */
.cert-landscape-rotate {
    transform: rotate(-90deg) !important;
    width: auto !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: contain !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) rotate(-90deg) !important;
}

.certificate-card:hover .cert-landscape-rotate {
    transform: translate(-50%, -50%) rotate(-90deg) scale(1.05) !important;
}

/* В lightbox для альбомных сертификатов */
.lightbox-cert-image.cert-landscape-rotate {
    transform: rotate(-90deg) !important;
    max-width: 90vh !important;
    max-height: 90vw !important;
    width: auto !important;
    height: auto !important;
}

/* В lightbox для исправления выравнивания */
.lightbox-cert-image.cert-fix-alignment {
    object-position: center center !important;
    margin: 0 auto !important;
    display: block !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .certificate-lightbox-content {
        padding: 1rem;
    }
    
    .certificate-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .certificate-lightbox-prev,
    .certificate-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .certificate-lightbox-prev {
        left: 0.5rem;
    }
    
    .certificate-lightbox-next {
        right: 0.5rem;
    }
    
    .certificate-lightbox-image-wrapper {
        max-height: 70vh;
    }
    
    .certificate-lightbox-info h3 {
        font-size: 1.2rem;
    }
}
