/* Wrapper */
.mpl-wrapper {
    max-width: 96%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    /* Prevent footer jump on loading/empty pages */
    min-height: 80vh; 
}

/* Header Row (Stats & Search) */
.mpl-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.mpl-stats {
    font-weight: 600;
    color: #4b5563;
    font-size: 1.1rem;
}

/* Search */
.mpl-search-container {
    position: relative;
    /* Margin removed to fit in header row */
    margin-bottom: 0; 
    width: 100%;
    max-width: 400px;
}

#mpl-search-input {
    width: 100%;
    padding: 12px 20px 12px 45px; /* Slightly more compact */
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
    box-sizing: border-box; /* Ensure padding doesn't overflow width */
}

#mpl-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mpl-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Grid */
.mpl-grid {
    display: grid;
    /* grid-template-columns is set inline by PHP to match column count */
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .mpl-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .mpl-grid {
        grid-template-columns: 1fr !important;
    }
    .mpl-header-row {
        flex-direction: column;
        align-items: stretch;
    }
    .mpl-search-container {
        max-width: 100%;
    }
}

/* Column */
.mpl-column {
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mpl-column-header {
    background: #fff;
    padding: 20px;
    border-top: 4px solid #ccc; /* Overridden inline */
    border-bottom: 1px solid #e5e7eb;
}

.mpl-column-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.mpl-column-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.mpl-column-content {
    padding: 20px;
    flex: 1;
    min-height: 200px;
}

/* Items */
.mpl-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start; /* Align top for multiline */
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.mpl-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #d1d5db;
}

.mpl-item-icon {
    margin-right: 16px;
    flex-shrink: 0;
    line-height: 0;
}

.mpl-icon-svg {
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.2));
}

.mpl-item-content {
    flex: 1;
    min-width: 0; /* Fix flex child truncation issues */
}

.mpl-item-title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    line-height: 1.5;
    font-weight: 700;
    color: #1f2937;
    /* Force wrapping for long words/titles */
    word-wrap: break-word;
    overflow-wrap: break-word; 
    word-break: break-word;
    hyphens: auto;
}

/* Button Styling */
.mpl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem; /* Increased font size */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.mpl-btn-download {
    background-color: #eff6ff;
    color: #3b82f6;
    padding: 10px 20px; /* Increased padding */
    border-radius: 9999px; /* Pill shape */
    border: 1px solid transparent;
}

.mpl-btn-download:hover {
    background-color: #EF3738;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(239, 55, 56, 0.4);
}

.mpl-btn-download svg {
    transition: transform 0.2s;
}

.mpl-btn-download:hover svg {
    transform: translateY(2px);
}

.mpl-empty {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 20px 0;
}

.mpl-loading {
    text-align: center;
    color: #6b7280;
    padding: 20px;
}

/* Pagination */
.mpl-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.mpl-page-btn {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    transition: background 0.2s;
}

.mpl-page-btn:hover:not(:disabled) {
    background: #f3f4f6;
}

.mpl-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#mpl-page-indicator {
    font-weight: 600;
    color: #4b5563;
}
