/**
 * Working Papers Display Styles
 * WDM Working Paper Library
 */

/* Working Papers Container */
.wdm-working-papers-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    position: relative; /* Required for loading spinner positioning */
}

.wdm-working-papers {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Featured Work Section - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-featured-section {
    background: #fff;
    padding: 30px 20px;
    border-bottom: 1px solid #e9ecef;
}

.wdm-working-papers-wrap .wdm-featured-title {
    font-size: 24px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 20px 0;
}

.wdm-working-papers-wrap .wdm-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Featured Paper Card - Yellowish Background - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-working-paper-card.featured {
    background: #fef9e7; /* Yellowish background for featured items */
    border: 1px solid #f4d03f;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wdm-working-papers-wrap .wdm-working-paper-card.featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(244, 208, 63, 0.2);
    border-color: #f39c12;
}


/* Working Papers Controls - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-working-papers-controls {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Single Row Layout - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-controls-single-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

/* Desktop: Use flex-grow with proper box-sizing and reduced min-widths - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-controls-search,
.wdm-working-papers-wrap .wdm-controls-categories,
.wdm-working-papers-wrap .wdm-controls-tags,
.wdm-working-papers-wrap .wdm-controls-submit {
    box-sizing: border-box;
    flex-shrink: 1; /* Allow shrinking below min-width when necessary */
}

.wdm-working-papers-wrap .wdm-controls-search {
    flex: 2; /* Takes 2 parts of available space */
    min-width: 150px; /* Reduced from 200px */
    max-width: 350px; /* Reduced from 400px */
}

.wdm-working-papers-wrap .wdm-controls-categories {
    flex: 1; /* Takes 1 part of available space */
    min-width: 80px; /* Reduced from 120px */
}

.wdm-working-papers-wrap .wdm-controls-tags {
    flex: 1; /* Takes 1 part of available space */
    min-width: 80px; /* Reduced from 120px */
}

.wdm-working-papers-wrap .wdm-controls-submit {
    flex: 1; /* Takes 1 part of available space */
    display: flex;
    justify-content: flex-end;
    min-width: 80px; /* Reduced from 120px */
}

/* Tablet: Allow wrapping with better proportions - Scoped to Working Papers */
@media (max-width: 1024px) {
    .wdm-working-papers-wrap .wdm-controls-single-row {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .wdm-working-papers-wrap .wdm-controls-search {
        flex: 0 0 100%;
        margin-bottom: 10px;
        min-width: unset;
        max-width: unset;
    }
    
    .wdm-working-papers-wrap .wdm-controls-categories,
    .wdm-working-papers-wrap .wdm-controls-tags,
    .wdm-working-papers-wrap .wdm-controls-submit {
        flex: 0 0 calc(33.333% - 7px); /* Account for gaps */
        min-width: 100px;
    }
}

/* Mobile: Stack all controls vertically - Scoped to Working Papers */
@media (max-width: 768px) {
    .wdm-working-papers-wrap .wdm-controls-single-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .wdm-working-papers-wrap .wdm-controls-search,
    .wdm-working-papers-wrap .wdm-controls-categories,
    .wdm-working-papers-wrap .wdm-controls-tags,
    .wdm-working-papers-wrap .wdm-controls-submit {
        flex: none;
        width: 100%;
        min-width: unset;
        max-width: unset;
    }
    
    .wdm-working-papers-wrap .wdm-controls-submit {
        justify-content: center;
    }
}

/* Legacy row styles for backward compatibility - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.wdm-working-papers-wrap .wdm-controls-row:last-child {
    margin-bottom: 0;
}

/* Row 1: Search and Submit Button - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-controls-row-1 {
    justify-content: space-between;
}

.wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-left {
    flex: 0 0 400px;
    min-width: 300px;
}

.wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-right {
    flex: 0 0 auto;
    justify-content: flex-end;
}

/* Row 2: Filters - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-controls-row-2 {
    justify-content: flex-start;
}

.wdm-working-papers-wrap .wdm-controls-row-2 .wdm-filter-controls {
    width: 100%;
    justify-content: flex-start;
}

.wdm-working-papers-wrap .wdm-controls-left {
    flex: 0 0 280px;
    min-width: 280px;
}

.wdm-working-papers-wrap .wdm-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    justify-content: flex-end;
}

/* Search Box - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-search-box {
    position: relative;
    width: 100%;
}

.wdm-working-papers-wrap .wdm-search-input {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    background: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* Explicit font stack */
}

.wdm-working-papers-wrap .wdm-search-input::placeholder {
    color: #999;
}

.wdm-working-papers-wrap .wdm-search-input:focus {
    outline: none;
    border-color: #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
}

/* Filter Controls - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.wdm-working-papers-wrap .wdm-status-filter {
    height: 42px;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 180px;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .wdm-status-filter:focus {
    outline: none;
    border-color: #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
}




/* Working Papers Grid - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-working-papers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
}

/* Working Paper Card - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-working-paper-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.wdm-working-papers-wrap .wdm-working-paper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #fd7e14;
}

/* Paper Meta Header - Type and Year side by side - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Paper Type Label - Purple - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-type {
    display: inline-block;
    background: var(--ast-global-color-0);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Paper Year - Light Gray - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-year {
    color: #6c757d;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
}

/* Paper Header - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

/* Custom title class to override theme styles - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-working-paper-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0;
    line-height: 1.4;
    flex: 1;
    font-family: inherit;
    text-decoration: none;
}


/* Paper Content - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-content {
    margin-bottom: 20px;
    flex: 1;
}

.wdm-working-papers-wrap .wdm-paper-abstract {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.wdm-working-papers-wrap .wdm-paper-meta {
    margin-bottom: 15px;
}

.wdm-working-papers-wrap .wdm-paper-authors {
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
}

/* Author link styles - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-author-link {
    color: #fd7e14;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.wdm-working-papers-wrap .wdm-author-link:hover {
    color: #e55a00;
    text-decoration: underline;
}

/* Tags Display - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.wdm-working-papers-wrap .wdm-paper-tag {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.3s ease;
}

.wdm-working-papers-wrap .wdm-paper-tag-more {
    display: inline-block;
    background: #6c757d;
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.3s ease;
}

/* Paper Actions - Full width at bottom - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-actions {
    margin-top: auto;
    padding-top: 15px;
}

.wdm-working-papers-wrap .wdm-paper-view {
    display: block;
    width: 100%;
    text-align: center;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fd7e14;
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.wdm-working-papers-wrap .wdm-paper-view:hover {
    background: #e55a00;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3);
}

.wdm-working-papers-wrap .wdm-paper-view .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Tags Dropdown Container - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-tags-dropdown-container {
    position: relative;
    min-width: 200px;
}

.wdm-working-papers-wrap .wdm-tags-filter-select {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .wdm-tags-filter-select:focus {
    outline: none;
    border-color: #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
}

.wdm-working-papers-wrap .wdm-tags-filter-select option {
    padding: 8px 12px;
}

/* Select2 Customization for Tags Filter - Scoped to Working Papers */
.wdm-working-papers-wrap .select2-container {
    width: 100%;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--single {
    border: 1px solid #ced4da;
    border-radius: 6px;
    height: 42px;
    line-height: 42px;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding: 7px 12px;
    padding-right: 32px;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 8px;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 25px;
    color: #6c757d;
}

.wdm-working-papers-wrap .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dropdown positioning for multiple selection */
.wdm-working-papers-wrap .select2-dropdown--below {
    margin-top: 8px;
}

.wdm-working-papers-wrap .select2-dropdown--above {
    margin-bottom: 8px;
}

.wdm-working-papers-wrap .select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
}

.wdm-working-papers-wrap .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #fd7e14;
}

.wdm-working-papers-wrap .select2-container--default .select2-results > .select2-results__options {
    font-size: 14px;
}

/* No Papers Message - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-no-papers {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.wdm-working-papers-wrap .wdm-no-papers p {
    font-size: 16px;
    margin: 0;
}

/* Pagination - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-pagination {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.wdm-working-papers-wrap .wdm-pagination-info {
    color: #6c757d;
    font-size: 14px;
}

.wdm-working-papers-wrap .wdm-pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wdm-working-papers-wrap .wdm-prev-page,
.wdm-working-papers-wrap .wdm-next-page {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wdm-working-papers-wrap .wdm-prev-page:hover:not(:disabled),
.wdm-working-papers-wrap .wdm-next-page:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    text-decoration: none;
}

.wdm-working-papers-wrap .wdm-prev-page:disabled,
.wdm-working-papers-wrap .wdm-next-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wdm-working-papers-wrap .wdm-page-info {
    color: #6c757d;
    font-size: 14px;
}

.wdm-working-papers-wrap .wdm-current-page {
    font-weight: 600;
    color: #fd7e14;
}

/* Modal Styles - Global positioning for proper display */
.wdm-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Prevent body scroll when modal is open - Scoped to Working Papers */
body.wdm-modal-open {
    overflow: hidden;
}

.wdm-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: fit-content;
    min-width: 65vw;
    max-height: 80vh;
    overflow: visible; /* Allow content to be visible */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: wdm-modal-slide-in 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* Ensure proper positioning */
}

@keyframes wdm-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wdm-modal-header {
    background: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px;
}

.wdm-modal-title {
    margin: auto;
}

.wdm-modal-close {
    font-size: 24px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.wdm-modal-close:hover {
    color: #dc3545;
}

.wdm-modal-body {
    padding-inline: 20px;
    max-height: calc(80vh - 60px); /* Account for header and footer */
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    /* Improve scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Ensure proper scrolling behavior */
    overscroll-behavior: contain;
}

.wdm-modal-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
}

/* Responsive adjustments for controls - Scoped to Working Papers */
@media (max-width: 1200px) {
    .wdm-working-papers-wrap .wdm-controls-row-1 {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-left {
        flex: 0 0 auto;
        min-width: auto;
        width: 100%;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-right {
        flex: 0 0 auto;
        justify-content: center;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-2 .wdm-filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .wdm-working-papers-wrap .wdm-working-papers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .wdm-working-papers-wrap {
        padding: 10px;
    }
    
    .wdm-working-papers-wrap .wdm-working-papers-controls {
        padding: 15px;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row {
        margin-bottom: 10px;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-left {
        width: 100%;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-1 .wdm-controls-right {
        width: 100%;
        justify-content: center;
    }
    
    .wdm-working-papers-wrap .wdm-controls-row-2 .wdm-filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .wdm-working-papers-wrap .wdm-featured-grid,
    .wdm-working-papers-wrap .wdm-working-papers-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-actions {
        flex-direction: column;
    }
    
    .wdm-working-papers-wrap .wdm-pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .wdm-modal-content {
        width: 95%;
        margin: 5% auto; /* Reduced margin for better mobile fit */
        max-height: 90vh; /* Use more screen space on mobile */
        /* Prevent modal from closing on mobile when interacting with form elements */
        touch-action: manipulation;
    }
    
    .wdm-modal-body {
        max-height: calc(90vh - 100px); /* Adjust for mobile */
        padding: 15px; /* Slightly reduced padding for mobile */
    }
    
    /* Prevent modal backdrop clicks on mobile when interacting with form elements */
    .wdm-modal {
        /* Ensure proper touch handling on mobile */
        -webkit-overflow-scrolling: touch;
        /* Prevent body scroll when modal is open */
        overflow: hidden;
    }
    
    /* Improve form element interaction on mobile */
    .wdm-modal-content select,
    .wdm-modal-content input,
    .wdm-modal-content textarea {
        /* Prevent zoom on focus for better mobile UX */
        font-size: 16px;
        /* Ensure proper touch targets */
        min-height: 44px;
        /* Prevent form elements from triggering modal close */
        touch-action: manipulation;
    }
    
    /* Ensure select dropdowns work properly on mobile */
    .wdm-modal-content select {
        /* Allow native mobile select behavior */
        -webkit-appearance: menulist;
        -moz-appearance: menulist;
        appearance: menulist;
    }
    
    .wdm-working-papers-wrap .wdm-paper-meta-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-year {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .wdm-working-papers-wrap .wdm-featured-grid,
    .wdm-working-papers-wrap .wdm-working-papers-grid {
        padding: 10px 0;
    }
    
    .wdm-working-papers-wrap .wdm-working-paper-card {
        padding: 15px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-title {
        font-size: 16px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-abstract {
        font-size: 13px;
    }
    
    .wdm-working-papers-wrap .wdm-paper-meta {
        font-size: 12px;
    }
}

/* Loading State - Scoped to Working Papers */
.wdm-working-papers-wrap.wdm-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wdm-working-papers-wrap.wdm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #fd7e14;
    border-radius: 50%;
    animation: wdm-spin 1s linear infinite;
}

@keyframes wdm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Tags Dropdown - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-tags-dropdown-container {
    position: relative;
    min-width: 0; /* Remove fixed min-width to allow flex shrinking */
}

/* Select2 Multiple Selection Styles for Tags Filter - Scoped to Working Papers */
.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple {
    border: 1px solid #ced4da;
    border-radius: 6px;
    min-height: 43px;
    padding: 10px 40px 10px 12px; /* Extra right padding for clear button */
    background: #fff;
    cursor: text;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
    outline: none;
}

.wdm-working-papers-wrap .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
    outline: none;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #999;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-search--inline {
    display: inline-block;
    width: auto;
    min-width: 150px;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-search__field {
    width: 100%;
    min-width: 150px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    line-height: 1.5;
    box-sizing: border-box;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-search__field:focus {
    outline: none;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: #999;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #fd7e14;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 4px 10px;
    margin: 2px 4px 2px 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    padding-left: 7px;
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    margin-right: 6px; /* Gap between × and option name */
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 2px 4px; /* Padding around × button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    order: -1; /* Ensure × appears before text */
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

/* Clear All button for multiple selection */
.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__clear {
    color: #495057;
    font-size: 18px;
    font-weight: bold;
    margin-right: 8px;
    cursor: pointer;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wdm-working-papers-wrap .select2-container--default .select2-selection--multiple .select2-selection__clear:hover {
    color: #dc3545;
}

/* Loading state for tags filter */
.wdm-working-papers-wrap .select2-container--default.select2-container--disabled .select2-selection--multiple {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.7;
}


/* Smooth transitions for filter changes */
.wdm-working-papers-grid {
    transition: opacity 0.3s ease-in-out;
    will-change: opacity;
}

/* Accessibility */
.wdm-working-paper-card:focus-within {
    outline: 2px solid #fd7e14;
    outline-offset: 2px;
}

.wdm-working-papers-wrap .wdm-search-input:focus,
.wdm-working-papers-wrap .wdm-status-filter:focus {
    outline: 2px solid #fd7e14;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wdm-working-paper-card {
        border: 2px solid #000;
    }
    
    .wdm-paper-download,
    .wdm-paper-view {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wdm-working-paper-card,
    .wdm-paper-download,
    .wdm-paper-view,
    .wdm-prev-page,
    .wdm-next-page {
        transition: none;
    }
    
    .wdm-modal-content {
        animation: none;
    }
}

/* Edit and Delete Buttons for Author Actions - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-author-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
}

.wdm-working-papers-wrap .wdm-edit-paper-btn,
.wdm-working-papers-wrap .wdm-delete-paper-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    flex: 1; /* Take equal width */
}

.wdm-working-papers-wrap .wdm-edit-paper-btn {
    background: #007cba;
    color: #fff;
}

.wdm-working-papers-wrap .wdm-edit-paper-btn:hover {
    background: #005a87;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.wdm-working-papers-wrap .wdm-delete-paper-btn {
    background: #dc3545;
    color: #fff;
}

.wdm-working-papers-wrap .wdm-delete-paper-btn:hover {
    background: #c82333;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.wdm-working-papers-wrap .wdm-edit-paper-btn .dashicons,
.wdm-working-papers-wrap .wdm-delete-paper-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Paper Type with Icon - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-type {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wdm-working-papers-wrap .wdm-paper-type .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #fff;
}

/* Paper Tags with Bold and Capsule Styling - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-tag {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px 4px 2px 0;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 12px;
    background: #f9fafb;
    color: #374151;
}

.wdm-working-papers-wrap .wdm-paper-tag-bold {
    font-weight: 600;
}

.wdm-working-papers-wrap .wdm-paper-tag-more {
    font-weight: normal;
    color: #6b7280;
}

/* Paper Actions - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-paper-actions {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wdm-working-papers-wrap .wdm-paper-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--ast-global-color-8);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    justify-content: center;
}

.wdm-working-papers-wrap .wdm-paper-view:hover {
    background: var(--ast-global-color-8);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3);
}

.wdm-working-papers-wrap .wdm-paper-view .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Submit Work Button - Scoped to Working Papers */
.wdm-working-papers-wrap .wdm-submit-work-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 10px 16px;
    background: var(--ast-global-color-8);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    min-width: 0; /* Allow button to shrink */
    box-sizing: border-box;
}

.wdm-working-papers-wrap .wdm-submit-work-btn:hover {
    background: var(--ast-global-color-8);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3);
}

.wdm-working-papers-wrap .wdm-submit-work-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Responsive button text - Scoped to Working Papers */
@media (max-width: 1200px) {
    .wdm-working-papers-wrap .wdm-submit-work-btn {
        padding: 10px 12px;
        font-size: 12px;
        gap: 4px;
    }
}

@media (max-width: 1000px) {
    .wdm-working-papers-wrap .wdm-submit-work-btn {
        padding: 8px 10px;
        font-size: 11px;
    }
}
