.cpc_media_notice { margin: 8px 0; padding: 8px 10px; border-radius: 4px; }
.cpc_media_notice_success { background: #e7f7ed; color: #1f5f31; }
.cpc_media_notice_error { background: #fdecec; color: #7a1f1f; }

.cpc_media_profile_tab,
.cpc_media_group_tab {
    display: grid;
    gap: 18px;
}

.cpc_media_create_gallery_form {
    background: linear-gradient(180deg, #fbfcfd 0%, #f3f6f9 100%);
    border: 1px solid #d8e0e8;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(27, 39, 51, 0.05);
}

.cpc_media_create_gallery_toggle {
    display: grid;
    gap: 12px;
}

.cpc_media_create_gallery_summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    cursor: pointer;
}

.cpc_media_create_gallery_summary::-webkit-details-marker {
    display: none;
}

.cpc_media_create_gallery_toggle:not([open]) .cpc_media_create_gallery_form {
    display: none;
}

.cpc_media_form_grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
    gap: 18px;
}

.cpc_media_form_main label,
.cpc_media_form_side label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #233243;
}

.cpc_media_create_gallery_form input[type="text"],
.cpc_media_create_gallery_form textarea,
.cpc_media_create_gallery_form select,
.cpc_media_edit_gallery_form input[type="text"],
.cpc_media_edit_gallery_form textarea,
.cpc_media_edit_gallery_form select,
.cpc_media_edit_media_form input[type="text"],
.cpc_media_edit_media_form textarea {
    width: 100%;
    border: 1px solid #cfd9e2;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    box-sizing: border-box;
}

.cpc_media_form_spacer {
    height: 12px;
}

.cpc_media_form_submit {
    margin-top: 14px;
}

.cpc_media_primary_button {
    background: #1a6c8f;
    color: #fff;
}

.cpc_media_gallery_block {
    border: 1px solid #d9e2ea;
    margin: 12px 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(18, 33, 46, 0.06);
    overflow: hidden;
}

.cpc_media_gallery_shell {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.cpc_media_gallery_cover_wrap {
    background: linear-gradient(160deg, #e8eef4 0%, #cfdbe6 100%);
    padding: 14px;
}

.cpc_media_gallery_cover {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.5);
}

.cpc_media_gallery_cover img,
.cpc_media_gallery_preview_thumb img,
.cpc_gallery_list_cover img,
.cpc_gallery_item_preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.cpc_media_gallery_cover_empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #536578;
    font-weight: 600;
}

.cpc_media_gallery_preview_strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.cpc_media_gallery_preview_thumb {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #dfe8ef;
}

.cpc_media_gallery_body {
    padding: 18px;
}

.cpc_media_gallery_meta_top,
.cpc_gallery_list_badges,
.cpc_gallery_item_meta_top {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.cpc_media_gallery_badge,
.cpc_gallery_item_badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cpc_media_gallery_badge_type,
.cpc_gallery_item_badge {
    background: #e6f4f0;
    color: #0b6b56;
}

.cpc_media_gallery_badge_status {
    background: #edf1f6;
    color: #415466;
}

.cpc_media_gallery_title,
.cpc_gallery_list_title {
    margin: 10px 0 8px;
    font-size: 22px;
    line-height: 1.15;
}

.cpc_media_gallery_desc,
.cpc_gallery_list_excerpt {
    color: #526273;
    font-size: 14px;
}

.cpc_media_gallery_meta_bottom,
.cpc_gallery_list_meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: #607284;
    font-size: 13px;
    margin-top: 12px;
}

.cpc_media_gallery_actions { margin: 14px 0 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.cpc_media_dropzone {
    border: 2px dashed #aab4c4;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0 10px;
    text-align: center;
    cursor: pointer;
    background: #fafbfd;
}
.cpc_media_dropzone_over { border-color: #2a7db6; background: #eef7ff; }

.cpc_media_upload_progress {
    margin-top: 8px;
    height: 8px;
    border-radius: 4px;
    background: #eceff4;
    overflow: hidden;
}
.cpc_media_upload_progress_bar {
    display: block;
    width: 0;
    height: 100%;
    background: #2a7db6;
}
.cpc_media_upload_status { margin-top: 6px; font-size: 12px; }
.cpc_media_upload_status_error { color: #9b1c1c; }

.cpc_gallery_list {
    display: grid;
    gap: 16px;
}

.cpc_gallery_list_item {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    border: 1px solid #d9e2ea;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.cpc_gallery_list_cover {
    display: block;
    aspect-ratio: 1 / 1;
    background: #dfe8ef;
}

.cpc_gallery_list_body {
    padding: 14px 16px 14px 0;
}

.cpc_gallery_items.cpc_gallery_items_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}

/* Grid Column Variants */
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_1 { grid-template-columns: repeat(1, 1fr); }
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_2 { grid-template-columns: repeat(2, 1fr); }
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_3 { grid-template-columns: repeat(3, 1fr); }
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_4 { grid-template-columns: repeat(4, 1fr); }
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_5 { grid-template-columns: repeat(5, 1fr); }
.cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_6 { grid-template-columns: repeat(6, 1fr); }

.cpc_gallery_items.cpc_gallery_items_list {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.cpc_gallery_item {
    border: 1px solid #e1e8ef;
    border-radius: 14px;
    padding: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.cpc_gallery_item_preview {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #dfe8ef;
}

.cpc_gallery_items_list .cpc_gallery_item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.cpc_gallery_items_list .cpc_gallery_item_preview {
    aspect-ratio: 1 / 1;
}

.cpc_gallery_item_meta { margin-top: 10px; }
.cpc_gallery_item_date { color: #67798b; font-size: 12px; }
.cpc_gallery_item_title { font-weight: 700; font-size: 14px; margin-top: 6px; }
.cpc_gallery_item_desc { font-size: 12px; color: #555; margin-top: 4px; }
.cpc_gallery_item_actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.cpc_media_directory {
    display: grid;
    gap: 18px;
}

.cpc_media_directory_header {
    display: grid;
    gap: 14px;
    background: linear-gradient(180deg, #fbfcfd 0%, #f3f6f9 100%);
    border: 1px solid #d8e0e8;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(27, 39, 51, 0.05);
}

.cpc_media_directory_tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cpc_media_directory_tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #cfd9e2;
    background: #fff;
    color: #233243;
    text-decoration: none;
    font-weight: 700;
}

.cpc_media_directory_tab.active {
    background: #1a6c8f;
    border-color: #1a6c8f;
    color: #fff;
}

.cpc_media_directory_filters {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.cpc_media_directory_filter_field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #233243;
}

.cpc_media_directory_filter_field input,
.cpc_media_directory_filter_field select {
    width: 100%;
    border: 1px solid #cfd9e2;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    box-sizing: border-box;
}

.cpc_media_directory_filter_actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cpc_media_directory_pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.cpc_media_directory_page_label {
    color: #526273;
    font-weight: 600;
}

@media (max-width: 900px) {
    .cpc_media_form_grid,
    .cpc_media_gallery_shell,
    .cpc_gallery_list_item,
    .cpc_gallery_items_list .cpc_gallery_item,
    .cpc_media_directory_filters {
        grid-template-columns: 1fr;
    }

    .cpc_gallery_list_body {
        padding: 0 14px 14px;
    }
}

/**
 * ========== LIGHTBOX STYLING ==========
 */

/* Main Lightbox Popup Container */
.cpc-media-lightbox-popup.mpp-lightbox-popup {
    max-width: 900px;
}

.cpc-media-lightbox-popup.mpp-lightbox-popup .mfp-content {
    padding: 0;
}

/* Lightbox Entry (Main Content Area) */
.cpc_media_lightbox_entry {
    background: #fff;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 0;
    min-height: 400px;
    max-height: 80vh;
    overflow: hidden;
}

/* Media Display Area */
.cpc_media_lightbox_media {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    padding: 30px;
    overflow: auto;
    position: relative;
}

.cpc_media_lightbox_image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cpc_media_video_container,
.cpc_media_audio_container,
.cpc_media_file_container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpc_media_video_container video,
.cpc_media_audio_container audio {
    max-width: 100%;
}

.cpc_media_file_container {
    flex-direction: column;
    text-align: center;
    gap: 20px;
}

.cpc_media_file_icon {
    font-size: 60px;
    color: #cccccc;
}

.cpc_media_file_title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.cpc_media_file_download {
    padding: 10px 24px;
    font-size: 14px;
}

/* Lightbox Info Panel (Right Side) */
.cpc_media_lightbox_info {
    background: #fff;
    padding: 24px;
    overflow-y: auto;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.cpc_media_lightbox_title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.cpc_media_lightbox_description {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.cpc_media_lightbox_meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.cpc_media_lightbox_author {
    font-weight: 600;
    color: #333;
}

.cpc_media_lightbox_date {
    font-size: 11px;
}

.cpc_media_lightbox_gallery a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
}

.cpc_media_lightbox_gallery a:hover {
    text-decoration: underline;
}

.cpc_media_lightbox_actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.cpc_media_lightbox_edit,
.cpc_media_lightbox_delete {
    padding: 6px 12px;
    font-size: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    display: inline-block;
}

.cpc_media_lightbox_edit:hover {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.cpc_media_lightbox_delete:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Close Button */
.cpc_media_lightbox_close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 40px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.cpc_media_lightbox_close:hover {
    color: white;
}

/* Arrow Navigation */
.cpc-media-lightbox-popup .mfp-arrow-left::before,
.cpc-media-lightbox-popup .mfp-arrow-right::before {
    color: rgba(255, 255, 255, 0.8);
}

.cpc-media-lightbox-popup .mfp-arrow-left:hover::before,
.cpc-media-lightbox-popup .mfp-arrow-right:hover::before {
    color: white;
}

/**
 * COVER SELECTOR STYLING
 */

.cpc_media_cover_selector {
    padding: 14px 0;
}

.cpc_media_cover_options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cpc_media_cover_option {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s;
}

.cpc_media_cover_option input {
    display: none;
}

.cpc_media_cover_option img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cpc_media_cover_option:hover img {
    opacity: 0.9;
}

.cpc_media_cover_option.cpc_media_cover_selected img {
    opacity: 1;
    box-shadow: 0 0 0 3px #2271b1 inset;
}

/**
 * REORDER STYLING
 */

.cpc_gallery_item_drag_handle {
    cursor: grab;
    color: #999;
    padding: 4px 8px;
    font-size: 18px;
    display: inline-block;
    user-select: none;
    transition: color 0.2s;
}

.cpc_gallery_item_drag_handle:hover {
    color: #2271b1;
}

.cpc_gallery_item_drag_handle:active {
    cursor: grabbing;
}

.cpc_gallery_item_placeholder {
    opacity: 0.5;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    min-height: 100px;
}

/* Button Styles */
.cpc_media_gallery_actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.cpc_media_btn_primary,
.cpc_media_btn_secondary,
.cpc_media_btn_danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s;
}

.cpc_media_btn_primary {
    background: #0073aa;
    color: #fff;
    border-color: #005684;
}

.cpc_media_btn_primary:hover {
    background: #005684;
    border-color: #004a73;
}

.cpc_media_btn_primary:active,
.cpc_media_btn_primary:focus {
    background: #004a73;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.cpc_media_btn_secondary {
    background: #f7f7f7;
    color: #333;
    border-color: #ddd;
}

.cpc_media_btn_secondary:hover {
    background: #e5e5e5;
    border-color: #bbb;
    color: #000;
}

.cpc_media_btn_secondary:active,
.cpc_media_btn_secondary:focus {
    background: #d5d5d5;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.cpc_media_btn_danger {
    background: #f8f1f1;
    color: #a02f2f;
    border-color: #d4a4a4;
}

.cpc_media_btn_danger:hover {
    background: #f1dcdc;
    border-color: #c25454;
    color: #7a1f1f;
}

.cpc_media_btn_danger:active,
.cpc_media_btn_danger:focus {
    background: #e5c1c1;
    box-shadow: 0 0 0 2px rgba(160, 47, 47, 0.2);
}

.cpc_media_btn_primary .dashicons,
.cpc_media_btn_secondary .dashicons,
.cpc_media_btn_danger .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

/* Responsive Grid Breakpoints */
@media (max-width: 1200px) {
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_5,
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_3,
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_4,
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_5,
    .cpc_gallery_items.cpc_gallery_items_grid.cpc_gallery_cols_6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cpc_media_form_grid,
    .cpc_media_gallery_shell,
    .cpc_gallery_list_item,
    .cpc_gallery_items_list .cpc_gallery_item {
        grid-template-columns: 1fr;
    }

    .cpc_gallery_list_body {
        padding: 0 14px 14px;
    }
}

/* Responsive Lightbox */
@media (max-width: 900px) {
    .cpc_media_lightbox_entry {
        grid-template-columns: 1fr;
        min-height: auto;
        max-height: auto;
    }

    .cpc_media_lightbox_info {
        border-left: none;
        border-top: 1px solid #eee;
        max-height: 200px;
        overflow-y: auto;
    }

    .cpc_media_lightbox_media {
        min-height: 300px;
    }

    .cpc_media_cover_options {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .cpc_media_lightbox_entry {
        max-height: 100vh;
    }

    .cpc_media_lightbox_media {
        padding: 20px;
        min-height: 250px;
    }

    .cpc_media_lightbox_info {
        max-height: 30vh;
    }

    .cpc_media_cover_options {
        grid-template-columns: repeat(2, 1fr);
    }

    .cpc_media_lightbox_title {
        font-size: 16px;
    }
}
