.ucat-wrapper {
    margin-bottom: 20px;
    padding: 10px;
    background: #fff;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
}

.ucat-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Ensure the table looks clean in admin */
.wp-list-table.widefat .ucat-wrapper {
    border: none;
    padding: 0;
    background: transparent;
}

.ucat-item {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid #dfe4ea;
    background: #f9fafb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ucat-item:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.15);
}

.ucat-item-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ucat-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.ucat-item:hover .ucat-item-image img {
    transform: scale(1.08);
}

/* Action Buttons within Card */
.ucat-action-btn {
    position: absolute;
    top: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0;
    z-index: 10;
}

.ucat-item:hover .ucat-action-btn {
    opacity: 1;
}

.ucat-action-btn.ucat-remove {
    right: 4px;
}

.ucat-action-btn.ucat-download {
    right: 36px;
}

.ucat-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ucat-action-btn.ucat-download:hover {
    background: #16a34a; /* green */
    color: #fff;
    transform: scale(1.1);
}

.ucat-action-btn.ucat-remove:hover {
    background: #ef4444; /* red */
    color: #fff;
    transform: scale(1.1);
}


/* Lightbox Modal */
#ucat-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    /* Higher than any WP admin element */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

#ucat-lightbox img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 5px solid #fff;
}

#ucat-lightbox .close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}


/* ======================================
   Course Certificates Wrapper
   ====================================== */

.course-certificates-wrapper {
    background-image: radial-gradient(ellipse at 0% 0%, #2271b1 0%, #2b5c85 100%);
    border: 1px solid #c3d4e4;
    border-radius: 24px;
    padding: 24px;
    margin-top: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* --- Header --- */

.course-certificates-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #6196cb;
}

.course-certificates-header .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #fff;
}

.course-certificates-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.3em;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.course-certificates-badge {
    display: inline-flex;
    align-items: center;
    background: #d6eaf9;
    color: #2271b1;
    font-size: 14px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* --- Empty State --- */

.course-certificates-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #fff;
    border: 1px dashed #c3d4e4;
    border-radius: 8px;
    color: #646970;
    font-size: 14px;
}

.course-certificates-empty .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #a7aaad;
}

.course-certificates-empty p {
    margin: 0;
}

/* --- Course Grid & Cards --- */

.course-certificates-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.course-certificate-card {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.course-certificate-card .card-header {
    background: #f8fafc;
    padding: 24px 20px;
    border-right: 1px solid #e2e8ef;
    display: flex;
    align-items: flex-start;
    width: 250px;
    flex-shrink: 0;
}

.course-certificate-card .card-body {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

@media (max-width: 782px) {
    .course-certificate-card {
        flex-direction: column;
    }
    .course-certificate-card .card-header {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8ef;
        padding: 16px 20px;
    }
    .course-certificate-card .card-body {
        padding: 20px;
    }
}

/* --- Course Name Cell --- */

.course-name-cell {
    display: flex;
    align-items: start;
    gap: 12px;
}

.course-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(2, 132, 199, 0.2);
}

.course-name-cell strong {
    font-size: 16px;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 4px;
}

/* --- Uploader Inside Card --- */

.course-certificate-card .ucat-wrapper {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    flex-grow: 1;
    display: flex;
    gap: 12px;
}

.course-certificate-card .ucat-preview {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(100px, 100px));
    gap: 12px;
}

.course-certificate-card .ucat-item {
    aspect-ratio: 1;
}

.course-certificate-card .ucat-wrapper p {
    margin-top: auto;
    margin-bottom: 0;
}

.course-certificate-card .ucat-upload-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    border: 1px dashed #0284c7;
    border-radius: 8px;
    color: #0284c7;
    background: rgba(2, 132, 199, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    justify-content: center;
    aspect-ratio: 1;
    order: 1;
}

.course-certificate-card .ucat-upload-btn:hover {
    background: #0284c7;
    color: #fff;
    border-style: solid;
}

.course-certificate-card .ucat-upload-btn::before {
    content: "\f132";
    font-family: dashicons;
    font-size: 18px;
    line-height: 1;
}

/* --- Download All Button --- */

.course-certificate-card .ucat-download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #16a34a;
    border-radius: 8px;
    color: #16a34a;
    background: rgba(22, 163, 74, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    width: fit-content;
    justify-content: center;
    margin-top: 10px;
    margin-left: 0;
}

.course-certificate-card .ucat-download-all-btn:hover {
    background: #16a34a;
    color: #fff;
}