/* Certificates Tabs Styling */
.certificate-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

.row-equal-height {
    display: flex;
    flex-wrap: wrap;
}

.row-equal-height > [class*='col-'] {
    display: flex;
    flex-direction: column;
}
.certificates-container {
    background-color: #1a1a1a;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 30px;
}

.certificates-tabs {
    border-bottom: 1px solid #333;
    background-color: #222;
    padding: 0 10px;
    display: flex;
    justify-content: center;
}

.certificates-tabs .nav-link {
    color: #ccc;
    font-weight: 500;
    padding: 12px 15px;
    border: none;
    border-radius: 0;
    margin-right: 2px;
    transition: all 0.3s ease;
}

.certificates-tabs .nav-link:hover {
    color: #ce1c1c;
    background-color: rgba(206, 28, 28, 0.1);
}

.certificates-tabs .nav-link.active {
    color: #ce1c1c;
    background-color: #1a1a1a;
    border-top: 2px solid #ce1c1c;
    border-radius: 0;
    font-weight: 600;
}

.certificates-tab-content {
    background-color: #1a1a1a;
    padding: 20px;
}

.certificate-item {
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.certificate-item h5 {
    margin-bottom: 10px;
    font-weight: 600;
    color: #e0e0e0;
    min-height: 24px;
}

.certificate-thumbnail {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 0.707 / 1; /* PDF aspect ratio (A4) */
    object-fit: contain;
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 0 auto;
    display: block;
    border: 2px solid #ce1c1c;
    padding: 4px;
    flex-grow: 1;
}

.certificate-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(206, 28, 28, 0.3);
    border-color: rgba(206, 28, 28, 0.5);
}

/* Modal styling for certificate viewer */
#certificateViewerModal .modal-content {
    background-color: #222;
    border: 1px solid #444;
}

#certificateViewerModal .modal-header {
    background-color: #222;
    border-bottom: none;
    padding: 5px;
}

#certificateViewerModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    font-size: 1.5rem;
    opacity: 0.8;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    margin: 0;
    z-index: 1060;
}

#certificateViewerModal .btn-close:hover {
    opacity: 1;
    background-color: #ce1c1c;
}

#certificateViewerModal .modal-body {
    padding: 0;
    background-color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

#certificateViewer {
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
    border: none;
    background-color: #333;
    display: block;
    margin: 10px auto 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Mobile-friendly close button styling */
.mobile-close-btn {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid #ce1c1c;
    font-weight: bold;
    border-radius: 8px;
    padding: 8px 20px;
    margin-top: 10px;
}

.mobile-close-btn:hover {
    background-color: #ce1c1c;
    color: white;
}

@media (max-width: 767.98px) {
    .certificates-tabs .nav-link {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    /* Mobile layout: 2 certificates per row */
    .tab-content .row {
        display: flex;
        flex-wrap: wrap;
        margin-right: -5px;
        margin-left: -5px;
    }
    
    .tab-content .col-md-6 {
        width: 50%;  /* Set to 50% for 2 items per row */
        padding-right: 5px;
        padding-left: 5px;
    }
    
    .certificate-thumbnail {
        max-width: 100%;
        height: auto;
    }
    
    .certificate-item h5 {
        font-size: 14px;
        min-height: 40px; /* Keep titles consistent height */
    }
    
    #certificateViewer {
        max-height: 65vh;
        width: auto;
        margin: 20px auto 0;
    }
    
    #certificateViewerModal .modal-dialog {
        margin: 0.5rem;
        max-width: 95vw;
        width: 95vw;
    }
    
    #certificateViewerModal .modal-content {
        max-height: 90vh;
    }
    
    #certificateViewerModal .modal-body {
        padding: 0;
    }
    
    #certificateViewerModal .btn-close {
        width: 40px;
        height: 40px;
        padding: 8px;
        background-color: rgba(0, 0, 0, 0.7);
        right: 5px;
        top: 5px;
    }
}