/* Recommend Modal Styles (Linear Style) */
.wmmb-recommend-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Ignore clicks when hidden opacity 0 */
}

.wmmb-recommend-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.wmmb-recommend-container {
    background: #ffffff; /* fallback, overwritten by inline style */
    width: 90%;
    max-width: var(--wmmb-modal-width-pc, 800px);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    padding: 32px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: var(--wmmb-modal-height, 90vh);
    overflow-y: auto;
}

.wmmb-recommend-overlay.is-visible .wmmb-recommend-container {
    transform: scale(1);
}

.wmmb-recommend-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: #666;
}

.wmmb-recommend-close:hover {
    background: rgba(0,0,0,0.05);
}

/* Custom Scrollbar */
.wmmb-recommend-container::-webkit-scrollbar {
    width: 6px;
}
.wmmb-recommend-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.wmmb-recommend-container::-webkit-scrollbar-track {
    background: transparent;
}

.wmmb-recommend-header {
    text-align: center;
    margin-bottom: 24px;
}

.wmmb-recommend-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    /* color set inline */
}

.wmmb-recommend-desc {
    font-size: 15px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Grid Layout */
.wmmb-recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

/* Manga Card */
.wmmb-recommend-card {
    background: #f5f5f5; /* fallback */
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wmmb-recommend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wmmb-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 133%; /* 3:4 Aspect Ratio */
    background: #eee;
}

.wmmb-card-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wmmb-card-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wmmb-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: inherit;
}


.wmmb-card-tags {
    display: none; /* Hidden on PC by default, or show if needed. Let's hide on PC for now */
}

.wmmb-card-btn {
    margin-top: auto;
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: opacity 0.2s;
}

.wmmb-card-btn:hover {
    opacity: 0.9;
}

@media (max-width: 600px) {
    .wmmb-recommend-container {
        padding: 24px 20px 20px 20px; /* Top padding increased for header */
        width: var(--wmmb-modal-width-mobile, 90%);
        max-height: var(--wmmb-modal-height-mobile, 80vh);
    }
    .wmmb-recommend-close {
        top: 8px; /* Move up */
        right: 8px; /* Move right */
        background: rgba(0,0,0,0.05); /* Slight background to separate */
        width: 32px;
        height: 32px;
        padding: 0;
    }
    .wmmb-recommend-header {
        margin-top: 10px;
        margin-bottom: 20px;
        padding-right: 10px; /* Avoid text hitting close button if wrap */
    }
    .wmmb-recommend-header h2 {
        font-size: 20px;
    }

    .wmmb-recommend-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 12px;
    }
    .wmmb-recommend-card {
        flex-direction: row;
        align-items: flex-start; /* Prevent image stretching */
        background: transparent; 
        box-shadow: none; 
        border-bottom: 1px solid rgba(0,0,0,0.05); 
        border-radius: 0;
        padding-bottom: 0; /* Requested change */
        margin-bottom: 12px; /* Add margin instead of padding for spacing */
        position: relative;
        min-height: calc(var(--wmmb-mobile-img-width, 60px) * 1.35); /* Ensure minimum height matches image */
    }
    .wmmb-recommend-card:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    .wmmb-recommend-card:hover {
        transform: none;
        box-shadow: none;
    }

    .wmmb-card-thumb {
        width: var(--wmmb-mobile-img-width, 60px); 
        padding-top: 0;
        height: calc(var(--wmmb-mobile-img-width, 60px) * 1.35); 
        flex-shrink: 0;
        border-radius: 4px;
        overflow: hidden;
    }
    .wmmb-card-thumb img {
        height: 100%;
        width: 100%;
        position: static;
        object-fit: cover;
    }
    
    .wmmb-card-content {
        padding: 0 0 0 10px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* Stack from top, no spreading */
        align-items: flex-start;
        flex: 1;
        gap: 4px; /* Small consistent gap between elements */
    }
    
    .wmmb-card-title {
        font-size: 14px;
        margin: 0;
        line-height: 1.2;
        font-weight: 600;
        max-height: 2.4em; 
        overflow: hidden;
        width: 100%;
    }

    /* Mobile Tags - Colorful */
    .wmmb-card-tags {
        display: flex;
        flex-wrap: nowrap;
        overflow: hidden;
        gap: 4px;
        max-width: 100%;
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }
    .wmmb-tag {
        font-size: 9px;
        padding: 2px 6px;
        border-radius: 3px;
        white-space: nowrap;
        flex-shrink: 0;
        font-weight: 500;
    }
    /* Tag colors using nth-child */
    .wmmb-tag:nth-child(1) {
        background: #e3f2fd;
        color: #1565c0;
    }
    .wmmb-tag:nth-child(2) {
        background: #fce4ec;
        color: #c2185b;
    }
    .wmmb-tag:nth-child(3) {
        background: #e8f5e9;
        color: #2e7d32;
    }

    .wmmb-card-btn {
        margin-top: 2px;
        padding: 4px 10px;
        font-size: 11px;
        width: auto;
        display: inline-block;
        border-radius: 4px;
        line-height: 1;
        /* Static positioning - flows naturally after tags */
        position: static;
    }
}
