/**
 * WordPress Contributors Gallery Styles
 */

.wpcg-contributors-wrap {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
}

.wpcg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.wpcg-header-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 280px;
    text-align: center;
}

.wpcg-header-controls {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media screen and (max-width: 600px) {
    .wpcg-header {
        flex-direction: column;
        align-items: stretch;
    }

    .wpcg-header-title {
        justify-content: center;
        margin-bottom: 1rem;
    }

    .wpcg-header-controls {
        width: 100%;
    }

    .wpcg-version-select {
        width: 100%;
    }
}

.wpcg-header-controls {
    margin-left: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: auto;
}

.wpcg-version-dropdown {
    position: relative;
    min-width: 200px;
}

.wpcg-header-controls .wpcg-version-input {
    width: 100%;
    padding: 0.75rem 2rem 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    font-size: 1rem;
    color: #2d3748;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    transition: all 0.2s ease;
}

.wpcg-header-controls .wpcg-version-input:hover,
.wpcg-header-controls .wpcg-version-input:focus {
    border-color: #abc6f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.wpcg-header-controls .wpcg-version-list,
.bsingle__content .wpcg-header-controls .wpcg-version-list,
.pages-content .wpcg-header-controls .wpcg-version-list,
.single-content .wpcg-header-controls .wpcg-version-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0.5rem 0 0;
    padding: 0.5rem 0;
    list-style: none !important;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.wpcg-version-list .wpcg-version-item,
.tag-markup-2 .wpcg-version-list li,
.comment-text .wpcg-version-list li,
.pages-content .wpcg-version-list li,
.page ul.wpcg-version-list li:last-child {
    list-style: none !important;
    margin-top: 0;
    margin-bottom: 0;
}

.wpcg-version-dropdown.active .wpcg-version-list {
    display: block;
}

.wpcg-version-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wpcg-version-item:hover,
.wpcg-version-item.active {
    background-color: #f7fafc;
    color: #2d3748;
}

.wpcg-contributors-wrap h2,
.pages-content .wpcg-contributors-wrap h2 {
    margin: 0;
}

.wpcg-section {
    margin-bottom: 2rem;
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wpcg-section.wpcg-noteworthy .wpcg-contributor-item {
    text-decoration: none;
}

.wpcg-section.wpcg-core .wpcg-contributors-inline a {
    text-decoration: none;
}

.wpcg-section.wpcg-core .wpcg-contributors-inline a:hover {
    text-decoration: underline;
}

.wpcg-section h3 {
    margin: 0 0 1.25rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #eee;
    color: #23282d;
    font-size: 1.25rem;
}

.wpcg-contributor-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

@media screen and (max-width: 782px) {
    .wpcg-version-select {
        position: static;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .wpcg-contributors-wrap h2 {
        margin-top: 1rem;
    }
}

@media screen and (max-width: 480px) {
    .wpcg-contributor-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

@media screen and (max-width: 480px) {
    .wpcg-contributor-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

.wpcg-contributor-item,
.entry-content .wpcg-contributor-item,
.page-content .wpcg-contributor-item,
.post-content .wpcg-contributor-item {
    text-align: center;
    padding: 1rem;
    background: #ffffff;
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.wpcg-contributor-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.wpcg-avatar,
.entry-content .wpcg-avatar,
.page-content .wpcg-avatar,
.post-content .wpcg-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 0.625rem;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: block;
}

.wpcg-contributor-item h4,
.entry-content .wpcg-contributor-item h4,
.page-content .wpcg-contributor-item h4,
.post-content .wpcg-contributor-item h4 {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: #333;
    line-height: 1.4;
    text-align: center;
    width: 100%;
}

.wpcg-contributor-item h4 a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wpcg-contributor-item h4 a:hover {
    color: #135e96;
    text-decoration: underline;
}

.wpcg-role,
.entry-content .wpcg-role,
.page-content .wpcg-role,
.post-content .wpcg-role {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3125rem;
    text-align: center;
    width: 100%;
}

.wpcg-contributors-inline {
    line-height: 1.8;
    font-size: 0.875rem;
    word-wrap: break-word;
}

.wpcg-contributors-inline a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wpcg-contributors-inline a:hover {
    color: #135e96;
    text-decoration: underline;
}

.wpcg-contributors-wrap {
    position: relative;
}

.wpcg-loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    padding-top: 2rem;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
}

.wpcg-loading-overlay img {
    width: 150px;
    height: 150px;
}

.wpcg-contributors-wrap.loading .wpcg-loading-overlay {
    display: flex;
}

.wpcg-contributors-wrap.loading > *:not(.wpcg-loading-overlay):not(.wpcg-version-select) {
    opacity: 0.5;
}

.wpcg-loading-overlay.active {
    display: flex;
}

.wpcg-loading-overlay img {
    width: 150px;
    height: 150px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
