/**
 * Mythos Pages Frontend Styles
 */

/* Wrapper */
.mythos-pages-wrapper {
    width: 100%;
    margin: 2rem auto;
}

/* Search Filter */
.mythos-pages-search {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    max-width: 500px;
}

.mythos-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.mythos-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

.mythos-search-button {
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.mythos-search-button:hover {
    background: #005177;
}

.mythos-search-button .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Grid Layout */
.mythos-pages-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Dynamic column setup based on data attributes */
.mythos-pages-grid[data-columns-desktop="1"] {
    grid-template-columns: repeat(1, 1fr);
}

.mythos-pages-grid[data-columns-desktop="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.mythos-pages-grid[data-columns-desktop="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.mythos-pages-grid[data-columns-desktop="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.mythos-pages-grid[data-columns-desktop="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.mythos-pages-grid[data-columns-desktop="6"] {
    grid-template-columns: repeat(6, 1fr);
}

/* Page Item */
.mythos-pages-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mythos-pages-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.mythos-page-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mythos-page-link:hover {
    text-decoration: none;
}

/* Thumbnail */
.mythos-page-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.mythos-page-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mythos-pages-item:hover .mythos-page-thumbnail img {
    transform: scale(1.05);
}

.mythos-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e5e5;
    color: #999;
}

.mythos-no-image .dashicons {
    width: 60px;
    height: 60px;
    font-size: 60px;
}

/* Content */
.mythos-page-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mythos-page-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    transition: color 0.3s ease;
}

.mythos-pages-item:hover .mythos-page-title {
    color: #0073aa;
}

.mythos-page-excerpt {
    margin: 0 0 1rem 0;
    color: #666;
    line-height: 1.6;
    flex: 1;
}

.mythos-read-more {
    display: inline-block;
    color: #0073aa;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mythos-read-more:hover {
    color: #005177;
    text-decoration: none;
}

/* Load More Button */
.mythos-pages-loadmore {
    text-align: center;
    margin: 2rem 0;
}

.mythos-loadmore-button {
    padding: 14px 32px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.mythos-loadmore-button:hover {
    background: #005177;
    transform: translateY(-2px);
}

.mythos-loadmore-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Infinite Scroll Loader */
.mythos-pages-loader {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.mythos-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: mythos-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes mythos-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.mythos-pages-no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .mythos-pages-grid[data-columns-desktop="4"],
    .mythos-pages-grid[data-columns-desktop="5"],
    .mythos-pages-grid[data-columns-desktop="6"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .mythos-pages-grid[data-columns-desktop="3"],
    .mythos-pages-grid[data-columns-desktop="4"],
    .mythos-pages-grid[data-columns-desktop="5"],
    .mythos-pages-grid[data-columns-desktop="6"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .mythos-pages-grid {
        gap: 1.5rem;
    }

    .mythos-page-content {
        padding: 1.25rem;
    }

    .mythos-page-title {
        font-size: 1.1rem;
    }
}

@media screen and (max-width: 600px) {
    /* Apply mobile columns setting */
    .mythos-pages-grid[data-columns-mobile="1"] {
        grid-template-columns: repeat(1, 1fr);
    }

    .mythos-pages-grid[data-columns-mobile="2"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .mythos-pages-grid[data-columns-mobile="3"] {
        grid-template-columns: repeat(3, 1fr);
    }

    .mythos-pages-grid {
        gap: 1rem;
    }

    .mythos-page-content {
        padding: 1rem;
    }

    .mythos-page-title {
        font-size: 1rem;
    }

    .mythos-search-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    .mythos-search-button {
        padding: 10px 16px;
    }
}

/* Fade-in animation for new items */
@keyframes mythos-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mythos-pages-item.mythos-new-item {
    animation: mythos-fade-in 0.5s ease forwards;
}

