/**
 * Image Picker - Modern Override
 *
 * Overrides the default image-picker plugin styles with
 * a modern TikTok-inspired card grid design.
 *
 * @package WooTikTokProduct
 * @since   1.0.0
 */

/* =====================================================
   GRID LAYOUT - CSS Grid replaces float-based layout
   ===================================================== */
ul.thumbnails.image_picker_selector {
    overflow: visible;
    list-style: none;
    padding: 2px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

ul.thumbnails.image_picker_selector ul {
    overflow: visible;
    list-style: none;
    padding: 0;
    margin: 0;
}

ul.thumbnails.image_picker_selector li.group {
    width: 100%;
}

ul.thumbnails.image_picker_selector li.group_title {
    float: none;
}

ul.thumbnails.image_picker_selector li {
    margin: 0;
    float: none;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

ul.thumbnails.image_picker_selector li:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* =====================================================
   THUMBNAIL CARD
   ===================================================== */
ul.thumbnails.image_picker_selector li .thumbnail {
    padding: 0;
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: pointer;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: border-color 0.25s ease, opacity 0.25s ease;
    background: #f5f5f5;
}

ul.thumbnails.image_picker_selector li .thumbnail img {
    -webkit-user-drag: none;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    border-radius: 9px;
    transition: filter 0.25s ease;
}

/* =====================================================
   SELECTED STATE - Blue border + overlay badge
   ===================================================== */
ul.thumbnails.image_picker_selector li .thumbnail.selected {
    background: transparent;
    opacity: 1;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

ul.thumbnails.image_picker_selector li .thumbnail.selected img {
    filter: brightness(0.85);
}

/* =====================================================
   METRIC BADGE (likes/views count below each image)
   ===================================================== */
.thumbnail p {
    margin: 0;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    color: #333;
    background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
    border-radius: 9px;
    position: absolute;
    bottom: 3px;
    left: 3px;
    right: 3px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: background 0.25s ease, color 0.25s ease;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Heart icon for likes (default) */
.thumbnail p::before {
    content: "\2665";
    font-size: 10px;
    color: #e53935;
    flex-shrink: 0;
}

/* Eye/play icon for video products */
.wooins-video-product .thumbnail p::before {
    content: "\25B6";
    font-size: 9px;
    color: #555;
}

/* Selected badge style: switch to blue */
.thumbnail.selected p {
    background: linear-gradient(247deg, #2c3ccb 0%, #235fd6 100%);
    color: #fff;
}

.thumbnail.selected p::before {
    content: "\2661";
    color: #fff;
}

/* Video selected: play icon stays */
.wooins-video-product .thumbnail.selected p::before {
    content: "\25B6";
    color: #fff;
}

/* Append span (per-post count when selected) */
.thumbnail p .append_span {
    display: none;
    flex-shrink: 0;
}

.thumbnail.selected p .append_span {
    display: inline !important;
    font-weight: 700;
}

/* =====================================================
   FORM ELEMENTS
   ===================================================== */
label.form-control-label,
.ppom-input-red select {
    width: 100%;
}

div.form-group {
    margin: 20px;
}

/* =====================================================
   RESPONSIVE - 3 columns on tablet, 2 on small mobile
   ===================================================== */
@media only screen and (max-width: 459px) {
    ul.thumbnails.image_picker_selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .thumbnail p {
        font-size: 13px;
        padding: 4px 2px;
        gap: 2px;
    }
}

@media only screen and (min-width: 460px) and (max-width: 649px) {
    ul.thumbnails.image_picker_selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .thumbnail p {
        font-size: 10px;
    }
}
