/* certificates.css (re-implemented to match projects.css) */
#certificates-section {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
}

.certificates-container {
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    height: 85dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 35px;
    margin-top: calc(1dvh - 37px);
    position: relative;
}

/* Carousel Tabs */
.certificates-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px 20px 5px;
    width: 100%;
    align-items: center;
    justify-content: center;
    scrollbar-width: none;
    /* Firefox */
}

.certificates-carousel::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.certificate-tab {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 120px;
    /* same as projects */
    height: 80px;
    /* same as projects */
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

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

.certificate-tab:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.certificate-tab.active {
    border-color: var(--text-color);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
    transform: scale(1.15);
    z-index: 5;
}

/* Wrapper for Slideshow and Cat */
.certificates-slideshow-wrapper {
    position: relative;
    width: 100%;
    flex-grow: 1;
    min-height: 0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.sertificate-cat {
    position: absolute;
    top: -110px;
    right: 20px;
    width: 200px;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
}

/* Slideshow Container */
.certificates-slideshow-container {
    position: relative;
    width: 100%;
    flex-grow: 1;
    min-height: 0;
    border-radius: 20px;
    overflow: hidden;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.certificates-slideshow-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease;
    opacity: 0;
}

.certificates-slideshow-img.fade-in {
    opacity: 1;
}

/* Navigation Arrows */
.certificates-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    z-index: 40001;
}

.certificates-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.certificates-prev-btn {
    left: 20px;
}

.certificates-next-btn {
    right: 20px;
}

/* Progress Bar */
.certificates-progress-container {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 150px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    z-index: 10;
}

.certificates-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--text-color);
    transition: width linear;
}

/* Wrapper for slideshow images */
.certificates-run-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.certificates-run-wrapper.fade-in {
    opacity: 1;
}

.certificates-run-img {
    position: relative !important;
    height: 100% !important;
    flex: 1;
    min-height: 0;
    opacity: 1 !important;
    object-fit: contain;
    /* ensures full cert is visible */
}

/* ========================================= */
/* Mobile Responsive                         */
/* ========================================= */
@media (max-width: 768px) {
    .certificates-container {
        justify-content: flex-start;
        padding-top: 10vh;
        padding-top: 10dvh;
        gap: 45px;
        /* 3 times the previous 15px gap */
    }

    .certificates-carousel {
        padding: 5px;
        transform: translateY(-4vh);
        transform: translateY(-4dvh);
    }

    .certificate-tab {
        width: 80px;
        height: 60px;
        /* Match project tab size for consistency */
    }

    .certificates-slideshow-wrapper {
        margin-bottom: 25px;
        transform: translateY(-2.8vh);
        transform: translateY(-2.8dvh);
        flex-grow: 0;
    }

    .sertificate-cat {
        width: 130px;
        top: -72px;
        right: -15px;
    }

    .certificates-slideshow-container {
        border: none;
        box-shadow: none;
        overflow: visible;
        aspect-ratio: 1.41;
        /* Tightly wrap A4 landscape certificates */
        width: 100%;
        height: auto;
    }

    .certificates-run-img,
    .certificates-slideshow-img {
        border: 3px solid #fff;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }

    /* Move progress bar to the bottom center, with spacing from images */
    .certificates-progress-container {
        bottom: -35px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 180px;
    }

    /* Move arrows to the bottom like in projects */
    #certificates-prev-btn,
    #certificates-next-btn {
        top: auto;
        bottom: -53px;
        /* Vertically align with the progress bar's center */
        transform: none;
        background: transparent;
        backdrop-filter: none;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 0;
        opacity: 0.7;
    }

    #certificates-prev-btn:hover,
    #certificates-next-btn:hover {
        background: transparent;
        transform: scale(1.2);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
        opacity: 1;
    }

    #certificates-prev-btn {
        left: calc(50% - 140px);
        /* Positioned to the left of the progress bar */
    }

    #certificates-next-btn {
        right: auto;
        left: calc(50% + 100px);
        /* Positioned to the right of the progress bar */
    }
}