/**
 * PEIBWA Resources — Frontend Styles
 *
 * @package PEIBWA_Member_Portal
 * @since   1.9.0
 */

/* ======================================
   Resources Container
   ====================================== */
.peibwa-resources {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    font-family: 'Muli', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--portal-gray-800, #272F38);
}

/* ======================================
   Header
   ====================================== */
.peibwa-resources-header {
    text-align: center;
    margin-bottom: 32px;
}

.peibwa-resources-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--portal-primary, #093A80);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
}

.peibwa-resources-header p {
    font-size: 16px;
    color: var(--portal-gray-500, #6b7280);
    margin: 0;
    max-width: 600px;
    margin-inline: auto;
}

/* ======================================
   Toolbar — Search + Filters
   ====================================== */
.peibwa-resources-toolbar {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.peibwa-resources-search {
    flex: 1 1 320px;
    position: relative;
}

.peibwa-resources-search .dashicons {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--portal-gray-400, #9ca3af);
    font-size: 18px;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.peibwa-resources-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px 10px 42px;
    border: 1.5px solid var(--portal-gray-200, #e5e7eb);
    border-radius: var(--portal-radius, 8px);
    font-size: 15px;
    background: #fff;
    transition: border-color var(--portal-transition, 0.2s ease), box-shadow var(--portal-transition, 0.2s ease);
    outline: none;
    height: 44px;
}

.peibwa-resources-search input:focus {
    border-color: var(--portal-primary, #093A80);
    box-shadow: 0 0 0 3px rgba(9, 58, 128, 0.1);
}

.peibwa-resources-filters {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.peibwa-resources-filters select {
    height: 44px;
    padding: 0 36px 0 14px;
    border: 1.5px solid var(--portal-gray-200, #e5e7eb);
    border-radius: var(--portal-radius, 8px);
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.825a.7.7 0 0 1-.5-.2L1.7 4.825a.7.7 0 1 1 1-1l3.3 3.3 3.3-3.3a.7.7 0 1 1 1 1L6.5 8.625a.7.7 0 0 1-.5.2Z'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    color: var(--portal-gray-700, #374151);
    min-width: 150px;
    transition: border-color var(--portal-transition, 0.2s ease);
    outline: none;
}

.peibwa-resources-filters select:focus {
    border-color: var(--portal-primary, #093A80);
    box-shadow: 0 0 0 3px rgba(9, 58, 128, 0.1);
}

/* ======================================
   Active Filters
   ====================================== */
.peibwa-resources-active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.peibwa-resources-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--portal-primary-light, #9BBEF2);
    color: var(--portal-primary-dark, #062654);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.peibwa-resources-filter-tag .remove-filter {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.peibwa-resources-filter-tag .remove-filter:hover {
    opacity: 1;
}

.peibwa-resources-clear-filters {
    background: none;
    border: none;
    color: var(--portal-gray-500, #6b7280);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}

.peibwa-resources-clear-filters:hover {
    color: var(--portal-danger, #ef4444);
}

/* ======================================
   Results Count
   ====================================== */
.peibwa-resources-count {
    font-size: 14px;
    color: var(--portal-gray-500, #6b7280);
    margin-bottom: 20px;
}

/* ======================================
   Resource Grid
   ====================================== */
.peibwa-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ======================================
   Resource Card
   ====================================== */
.peibwa-resource-card {
    background: #fff;
    border: 1px solid var(--portal-gray-200, #e5e7eb);
    border-radius: var(--portal-radius-lg, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.peibwa-resource-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.peibwa-resource-card.is-featured {
    border-color: var(--portal-secondary, #6F5EAE);
    box-shadow: 0 0 0 1px var(--portal-secondary, #6F5EAE);
}

/* Featured badge */
.peibwa-resource-badge.featured {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    background: var(--portal-secondary, #6F5EAE);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.peibwa-resource-badge.featured .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    line-height: 12px;
}

/* Thumbnail area */
.peibwa-resource-thumb {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--portal-gray-100, #f3f4f6);
}

.peibwa-resource-thumb--icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.peibwa-resource-thumb--icon .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--portal-gray-300, #d1d5db);
}

/* Card body */
.peibwa-resource-body {
    padding: 16px 20px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.peibwa-resource-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

/* Type badge */
.peibwa-resource-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.peibwa-resource-type-badge.type-link {
    background: #dbeafe;
    color: #1e40af;
}

.peibwa-resource-type-badge.type-pdf {
    background: #fee2e2;
    color: #991b1b;
}

.peibwa-resource-type-badge.type-video {
    background: #ede9fe;
    color: #5b21b6;
}

.peibwa-resource-type-badge.type-document {
    background: #fef3c7;
    color: #92400e;
}

.peibwa-resource-type-badge.type-template {
    background: #d1fae5;
    color: #065f46;
}

.peibwa-resource-type-badge.type-tool {
    background: #e0f2fe;
    color: #0c4a6e;
}

.peibwa-resource-date {
    font-size: 12px;
    color: var(--portal-gray-400, #9ca3af);
    white-space: nowrap;
}

/* Title */
.peibwa-resource-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--portal-gray-800, #272F38);
    line-height: 1.35;
}

/* Excerpt */
.peibwa-resource-excerpt {
    font-size: 14px;
    color: var(--portal-gray-500, #6b7280);
    line-height: 1.5;
    margin: 0 0 10px;
    flex: 1;
}

/* Category tags */
.peibwa-resource-cats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.peibwa-resource-cat-tag {
    padding: 2px 8px;
    background: var(--portal-gray-100, #f3f4f6);
    color: var(--portal-gray-600, #4b5563);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* Card footer — CTA link */
.peibwa-resource-footer {
    border-top: 1px solid var(--portal-gray-100, #f3f4f6);
    padding: 12px 20px;
}

.peibwa-resource-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--portal-primary, #093A80);
    text-decoration: none;
    transition: color 0.15s, gap 0.15s;
}

.peibwa-resource-link:hover {
    color: var(--portal-secondary, #6F5EAE);
    gap: 10px;
}

.peibwa-resource-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

/* ======================================
   Empty State
   ====================================== */
.peibwa-resources-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--portal-gray-400, #9ca3af);
}

.peibwa-resources-empty .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.peibwa-resources-empty p {
    font-size: 16px;
    margin: 0;
}

/* ======================================
   Load More
   ====================================== */
.peibwa-resources-load-more {
    text-align: center;
    margin-top: 36px;
}

/* Button styles */
.peibwa-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--portal-radius, 8px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.peibwa-btn-outline {
    background: #fff;
    color: var(--portal-primary, #093A80);
    border: 1.5px solid var(--portal-primary, #093A80);
}

.peibwa-btn-outline:hover {
    background: var(--portal-primary, #093A80);
    color: #fff;
}

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

/* ======================================
   Loading Spinner
   ====================================== */
.peibwa-resources-loading {
    text-align: center;
    padding: 40px 0;
}

.peibwa-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--portal-gray-200, #e5e7eb);
    border-top-color: var(--portal-primary, #093A80);
    border-radius: 50%;
    animation: peibwa-spin 0.7s linear infinite;
}

@keyframes peibwa-spin {
    to { transform: rotate(360deg); }
}

/* ======================================
   Responsive
   ====================================== */
@media (max-width: 768px) {
    .peibwa-resources {
        padding: 24px 16px 40px;
    }

    .peibwa-resources-header h2 {
        font-size: 24px;
    }

    .peibwa-resources-toolbar {
        flex-direction: column;
    }

    .peibwa-resources-search {
        flex: 1 1 100%;
    }

    .peibwa-resources-filters {
        flex: 1 1 100%;
    }

    .peibwa-resources-filters select {
        flex: 1;
        min-width: 0;
    }

    .peibwa-resources-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .peibwa-resources-filters {
        flex-direction: column;
    }

    .peibwa-resource-thumb {
        height: 120px;
    }
}
