/* Resource Library Widget Styles */
.resource-library {
    color: #F0F0E6;
    font-family: "Archivo Variable", Sans-serif;
    background-color: transparent !important;
}


#resource-library {
    /* Header Section */
    .resource-library-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 15px;
    }

    .search-section {
        display: flex;
        align-items: center; 
        gap: 10px;
        flex: 1;
        min-width: 300px;
    }

    .search-input-wrapper {
        position: relative;
        flex: 1;
        max-width: 400px;
    }

    .search-input-wrapper input {
        width: 100%;
        padding: 12px 40px 12px 0;
        background: transparent;
        border: none;
        color: #F0F0E6;
        font-size: 16px;
        outline: none;
    }

    .search-input-wrapper input::placeholder {
        color: #F0F0E6;
        font-style: italic;
        opacity: .5;
    }

    .search-icon {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #F0F0E6;
        font-size: 16px;
        background-image: url('/wp-content/plugins/cimulate-katie/assets/img/search-icon.svg');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        width: 16px;
        height: 16px;
    }

    .search-button {
        background-color: #F0F0E6;
        background-image: none;
        color: #1a1a2e;
        border: none;
        padding: 5px 12px;
        font-weight: bold;
        font-size: 12px;
        text-transform: uppercase;
        cursor: pointer;
        border-radius: 4px;
        transition: background-color 0.3s ease;
        &:hover {
            background-color: #FD6363;
        }
    }

    .search-button:hover {
        background-color: #f0f0f0;
    }

    .sort-section {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sort-label {
        color: #F0F0E6;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
    }

    .sort-select {
        background: transparent;
        color: #F0F0E6;
        border: 0px;
        padding: 8px 12px;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
        option {
            background-color: #0C142B;
            color: #F0F0E6;
            &:checked,&:invalid {
                background-color: #0C142B;
            }
        }
    }

    .sort-select:focus {
        outline: none;
        border-color: #ff6b35;
    }

    .view-toggle-section {
        display: flex;
        gap: 5px;
    }

    .view-toggle {
        background: transparent;
        border: 1px solid #F0F0E6;
        color: #F0F0E6;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 16px;
        transition: all 0.3s ease;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .view-icon {
        width: 18px;
        height: 18px;
        object-fit: contain;
    }

    .view-toggle.active {
        background-color: #ff6b35;
        border-color: #ff6b35;
    }

    .view-toggle:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .view-toggle.active:hover {
        background-color: #e55a2b;
    }

    /* Header Divider */
    .header-divider {
        height: 1px;
        background-color: #F0F0E6;
        margin-bottom: 20px;
    }

    .resource-list-header {
        display: flex;
        font-weight: normal;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .1em;
        color: rgba(255, 255, 255, 0.5);
        border-bottom: 1px solid #F0F0E6;
        padding-bottom: 10px;
    }

    .resource-name-header {
        flex: 2;
        padding-right: 20px;
        margin-left: 65px;
    }

    .categories-header {
        flex: 1;
        margin-left: -65px;
    }

    .resource-item {
        display: flex;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #ffffff;
        transition: background-color 0.3s ease;
        position: relative;
    }

    .featured-resource {
        background: linear-gradient(0deg, #f8f9fa 0%, #EECEAF 100%);
        border-radius: 0;
        margin: 20px 0 45px;
        padding: 0;
        position: relative;        

        .featured-content {
            display: flex;
            align-items: stretch;
            justify-content: stretch;
        }

         .featured-image-container {
             flex-shrink: 0;
             width: 50%;
             overflow: hidden;
         }

         .featured-image-container a {
             display: block;
             width: 100%;
             height: 100%;
             text-decoration: none;
         }

         .featured-image {
             width: 100%;
             height: 100%;
             object-fit: cover;
             display: block;
             transition: opacity 0.3s ease;
         }

         .featured-image-container a:hover .featured-image {
             opacity: 0.9;
         }

         .featured-text-content {
             flex: 1;
             display: flex;
             flex-direction: column;
             padding: 35px;
             justify-content: center;
         }

         .featured-header {
             display: flex;
             justify-content: flex-start;
             gap: 10px;
             align-items: center;
             margin-bottom: 10px;
         }

         .resource-type-label {
             display: flex;
             align-items: center;
             gap: 8px;
             color: #0C142B;
             font-family: "Archivo Variable", Sans-serif;
             font-weight: 600;
             text-transform: uppercase;
             font-size: 14px;
             letter-spacing: 0.5px;
         }

         .resource-type-icon {
             font-size: 16px;
             font-weight: bold;
             display: flex;
             align-items: center;
             justify-content: center;
         }

         .resource-type-icon img {
             width: 16px;
             height: 16px;
             object-fit: contain;
             filter: invert(1);
         }

         .resource-type-text {
             font-size: 14px;
         }

         .featured-badge {
             background-color: #ff6b35;
             color: #ffffff;
             font-size: 10px;
             text-transform: uppercase;
             letter-spacing: 1px;
             padding: 3px 8px;
             border-radius: 2px;
             font-family: "Archivo Variable", Sans-serif;
         }

         .featured-title a {
             font-weight: 700;
             color: #0C142B;
             font-family: "Archivo Variable", Sans-serif;
             text-decoration: none;
             line-height: 1em;
             margin: .3em 0;
             font-size: 32px;
             font-weight: 700;
             font-stretch: 125%;
             display: block;
         }

         .featured-title a:hover {
             color: #ff6b35;
         }

         .featured-excerpt {
             font-size: 15px;
             color: #0C142B;
             font-family: "Archivo Variable", Sans-serif;
             line-height: 1.4;
             margin: 0 0 1em;
         }

         .featured-categories {
             font-size: 10px;
             color: #0C142B;
             font-family: "Archivo Variable", Sans-serif;
             font-weight: 600;
             text-transform: uppercase;
             letter-spacing: 0.5px;
             line-height: 1.4;
         }
    }


    .resource-item:last-child {
        border-bottom: none;
    }

    .resource-name {
        flex: 2;
        display: flex;
        align-items: center;
        gap: 15px;
        padding-right: 20px;
    }

    .resource-icon {
        flex-shrink: 0;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 5px;
        img {
            width: 25px;
            height: 25px !important;
            object-fit: contain; 
        }
    }

    .resource-icon .default-icon {
        font-size: 20px;
        line-height: 1;
    }

    .resource-title {
        flex: 1;
    }

    .resource-title a {
        color: #F0F0E6;
        text-decoration: none;
        font-weight: 500;
        font-size: 16px;
        line-height: 1.1em;
        transition: color 0.3s ease;
        display: block;
    }

    .resource-title a:hover {
        color: #ff6b35;
    }

    .resource-categories {
        flex: 1;
        color: #F0F0E6;
        font-size: 10px;
        font-weight: 500;
        text-transform: uppercase;
        line-height: 1.4;
        letter-spacing: .1em;
    }

    /* No Resources Message */
    .no-resources {
        text-align: center;
        padding: 60px 40px;
        color: #F0F0E6;
        font-size: 18px;
        font-weight: 500;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin: 20px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .no-resources-message {
        margin: 0;
        font-size: 18px;
        font-weight: 500;
    }

    .no-resources-clear-button {
        background-color: #ff6b35;
        color: #ffffff;
        border: none;
        padding: 12px 24px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-family: "Archivo Variable", Sans-serif;
    }

    .no-resources-clear-button:hover {
        background-color: #e55a2b;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    }

    /* Loading State */
    .resource-list.loading {
        opacity: 0.6;
        pointer-events: none;
    }

    .resource-list.loading::after {
        content: 'Loading...';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #F0F0E6;
        font-size: 16px;
    }

    .loading-message {
        text-align: center;
        padding: 40px 20px;
        color: #F0F0E6;
        font-size: 16px;
        background-color: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        margin: 20px;
    }

    /* Responsive Design */
    @media (max-width: 768px) {
        .resource-library-header {
            flex-direction: column;
            align-items: stretch;
        }
        
        .search-section {
            min-width: auto;
        }
        
        .resource-item {
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }
        
        .resource-name {
            padding-right: 0;
        }
        
        .resource-categories {
            margin-top: 5px;
        }
    }

    /* Grid View Styles */
    &.grid-view .resource-list-header {
        display: none;
    }

    /* Apply saved view immediately to prevent FOUC */
    &.grid-view .resource-name {
        display: none !important;
    }

    &.grid-view .resource-name + .resource-categories {
        display: none !important;
    }

    &.grid-view .grid-view-elements {
        display: flex !important;
    }

    &.grid-view .resource-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 35px 20px;
        padding: 0;
    }

    &.grid-view .resource-item {
        background-color: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        overflow: hidden;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    &.grid-view .resource-item:hover {
        transform: translateY(-2px);
    }

    /* Grid View Elements */
    .grid-view-elements {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
    }

    /* Ensure grid view elements are visible in grid view */
    &.grid-view .grid-view-elements {
        display: flex !important;
    }

    .resource-image-container {
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 56.25%; /* 16:9 aspect ratio (9/16 = 0.5625) */
        overflow: hidden;
    }

    .resource-image-container a {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        text-decoration: none;
    }

    .resource-thumbnail {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: opacity 0.3s ease;
    }

    .resource-image-container:hover .resource-thumbnail {
        opacity: 0.8;
    }

    .resource-type-pill {
        position: absolute;
        top: 12px;
        right: 12px;
        background-color: #0C142B;
        color: #ffffff;
        padding: 6px;
        border-radius: 50%;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
        overflow: hidden;
        width: 32px;
        height: 32px;
    }

    .resource-type-pill .resource-type-icon {
        font-size: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .resource-type-pill .resource-type-icon img {
        width: 16px;
        height: 16px;
        object-fit: contain;
        filter: brightness(0) invert(1);
    }

    .resource-type-pill .resource-type-text {
        font-size: 11px;
        font-weight: 600;
        display: none;
        opacity: 0;
        transform: translateX(-10px);
        transition: all 0.3s ease;
        white-space: nowrap;
    }

    .resource-type-pill:hover {
        gap: 6px;
        padding: 4px 10px;
        border-radius: 20px;
        width: auto;
        height: auto;
    }

    .resource-type-pill:hover .resource-type-text {
        display: block;
        opacity: 1;
        transform: translateX(0);
    }

    .resource-content {
        padding: 10px 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .resource-content .resource-title {
        flex: 1;
    }

    .resource-content .resource-title a {
        color: #F0F0E6;
        text-decoration: none;
        font-weight: 600;
        line-height: 1.3;
        display: block;
        transition: color 0.3s ease;      
        font-family: "Archivo Variable", Sans-serif;
        text-decoration: none;
        line-height: 1em;
        margin: .3em 0 0;
        font-size: 18px;
        font-weight: 700;
        font-stretch: 125%;
        display: block;
        line-height: 1em;
    }

    .resource-content .resource-title a:hover {
        color: #ff6b35;
    }

    .resource-content .resource-categories {
        font-size: 10px;
        color: #F0F0E6;
        font-family: "Archivo Variable", Sans-serif;
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        line-height: 1.4;
        opacity: .5;
    }

    /* Grid View Responsive Design */
    @media (max-width: 1200px) {
        &.grid-view .resource-list {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (max-width: 768px) {
        &.grid-view .resource-list {
            grid-template-columns: 1fr;
        }
    }
}