/**
 * CV Culturist Media Styles
 * Version: 3.0 (Unified Versioning)
 */

/* Source Selection Modal */
.cv-source-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.cv-source-modal {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: cv-fade-in 0.2s ease-out;
}

@keyframes cv-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cv-source-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cv-source-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.cv-source-options {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cv-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.cv-option-btn:hover {
    border-color: #2271b1;
    background: #f0f6fc;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.cv-option-btn .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #2271b1;
}

.cv-option-btn span {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.cv-option-btn small {
    display: block;
    font-size: 13px;
    color: #646970;
}

/* Modal Styles */
.cv-media-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-media-modal {
    background: #fff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cv-media-header {
    padding: 16px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cv-media-header h3 {
    margin: 0;
    font-size: 18px;
}

.cv-close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.cv-media-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.cv-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

.cv-media-item {
    border: 2px solid transparent;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f0f0f0;
}

.cv-media-item:hover {
    border-color: #2271b1;
}

.cv-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Stock Library Badge - Ensure proper positioning within WordPress media grid */
.attachment-preview {
    position: relative;
}

.cv-stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f59e0b;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 20;
    pointer-events: none;
}

.cv-stock-badge .dashicons,
.cv-stock-badge .dashicons::before {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 1 !important;
    color: #fff !important;
}

/* Ensure badge stays visible on hover */
.attachment:hover .cv-stock-badge {
    opacity: 1;
}

/* Floating Bulk Action Toolbar */
/* Floating Bulk Action Toolbar */
.cv-floating-toolbar {
    position: fixed;
    top: auto;
    bottom: 40px;
    /* Default to bottom */
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999999;
    /* Max Z-Index */
    display: flex;
    gap: 12px;
    align-items: center;
    border: 2px solid #2271b1;
    /* Blue border to be obvious */
    transition: opacity 0.2s;
    /* Removed transform transition to avoid lag during drag */
    cursor: move;
    /* Indicate draggable */
    user-select: none;
}

.cv-floating-toolbar.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
    /* Force hide when hidden */
}

.cv-floating-toolbar button {
    border-radius: 20px !important;
    padding: 8px 20px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    cursor: pointer;
    /* Buttons should still look clickable */
}