/* Tile Builder Pro - Frontend Styles */

/* ==========================================================================
   GENERAL STYLES
   ========================================================================== */

/* Clickable tile styles */
.mf-tile-clickable {
    cursor: pointer;
}

.mf-tile-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.mf-tile-link:hover,
.mf-tile-link:focus {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   GRID LAYOUT STYLES
   ========================================================================== */

.mf-grid-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.mf-grid-container {
    display: grid;
    gap: 20px;
}


/* ==========================================================================
   END GRID LAYOUT STYLES
   ========================================================================== */

/* ==========================================================================
   FILTER STYLES
   ========================================================================== */

.mf-grid-filters {
    margin-bottom: 2rem;
    padding: 1rem;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mf-filter-group.mf-filter-header {
    margin-right: 1rem;
}

.mf-filter-label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin: 0;
    white-space: nowrap;
}

/* ==========================================================================
   SORTING STYLES (now integrated with filters)
   ========================================================================== */

.mf-sort-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.mf-sort-group label {
    font-weight: 500;
    color: #333;
    margin: 0;
    font-size: 0.9rem;
}

.mf-sort-combined-select {
    min-width: 180px;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.mf-sort-combined-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

@media (max-width: 768px) {
    .mf-sort-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .mf-sort-combined-select {
        min-width: 200px;
        flex: 1;
    }
}

.mf-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.mf-filter-group label {
    font-weight: 500;
    color: #333;
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    display: inline-block;
}

.mf-filter-select {
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 14px;
    width: auto;
}

.mf-filter-select:focus {
    outline-offset: 1px;
}

/* ==========================================================================
   END FILTER STYLES
   ========================================================================== */

/* ==========================================================================
   NO RESULTS MESSAGE
   ========================================================================== */

.mf-grid-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
}

.mf-carousel-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
}

.mf-no-results-message {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    margin: 0 auto;
    color: #6c757d;
}

.mf-no-results-message h3 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 500;
}

.mf-no-results-message p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==========================================================================
   END NO RESULTS MESSAGE
   ========================================================================== */

/* ==========================================================================
   TILE STYLES
   ========================================================================== */

.mf-grid-tile {
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mf-grid-tile:hover {
    transform: translateY(-4px);
}

.mf-tile-image {
    width: 100%;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1;
}

.mf-tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.mf-grid-tile:hover .mf-tile-image img {
    transform: scale(1.05);
}

.mf-grid-tile h1,
.mf-grid-tile h2,
.mf-grid-tile h3,
.mf-grid-tile h4,
.mf-grid-tile h5,
.mf-grid-tile h6 {
    margin: 0 0 0.75rem 0;
    font-weight: 700;
    line-height: 1.2;
}

.mf-grid-tile p {
    margin: 0 0 0.75rem 0;
    line-height: 1.6;
}

/* Tile content wrapper for proper padding */
.mf-tile-content {
    padding: 1.5rem;
}

/* Reset margins for all elements inside content wrapper */
.mf-tile-content > * {
    margin-top: 0;
}

.mf-tile-content > *:not(:last-child) {
    margin-bottom: 0.75rem;
}

.mf-tile-content > *:last-child {
    margin-bottom: 0;
}

/* Spacing for numeric and inline elements */
.mf-tile-content span {
    display: block;
    margin-bottom: 0.5rem;
}

.mf-tile-content span:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   END TILE STYLES
   ========================================================================== */

/* ==========================================================================
   LOADING & ANIMATION STYLES
   ========================================================================== */

.mf-grid-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Initial grid loading state */
.mf-grid-container.mf-initial-loading {
    opacity: 0;
    visibility: hidden;
}

.mf-grid-container.mf-grid-ready {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Loading spinner */
.mf-grid-loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    flex-direction: column;
    gap: 1rem;
}

.mf-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mf-loading-text {
    font-size: 14px;
}


/* ==========================================================================
   END LOADING & ANIMATION STYLES
   ========================================================================== */

/* ==========================================================================
   ACCESSIBILITY STYLES
   ========================================================================== */

.mf-grid-tile:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================================
   END ACCESSIBILITY STYLES
   ========================================================================== */

/* ==========================================================================
   PAGINATION STYLES
   ========================================================================== */

.mf-pagination-controls {
    margin: 2rem 0 0 0;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.mf-pagination-controls.mf-pagination-loading {
    opacity: 0.6;
    pointer-events: none;
}

.mf-pagination-info-display {
    font-size: 0.9rem;
    white-space: nowrap;
}

.mf-pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mf-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.mf-pagination-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 38px;
    min-width: 38px;
    justify-content: center;
}

.mf-pagination-btn:hover {
    text-decoration: none;
}

.mf-pagination-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.mf-pagination-btn.mf-pagination-active {
    /* Active state styling moved to theme */
}

.mf-pagination-btn.mf-pagination-active:hover {
    /* Active hover state styling moved to theme */
}

.mf-pagination-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.mf-pagination-ellipsis {
    padding: 0.5rem 0.25rem;
    font-size: 0.9rem;
}

.mf-pagination-arrow {
    font-weight: bold;
}

/* ==========================================================================
   END PAGINATION STYLES
   ========================================================================== */

/* ==========================================================================
   CAROUSEL STYLES
   ========================================================================== */

.mf-carousel-wrapper {
    position: relative;
}

.mf-carousel-container {
    overflow: hidden;
    position: relative;
}

.mf-carousel-container .swiper-wrapper {
    padding-top: 5px;
}

.mf-carousel-container.mf-initial-loading {
    opacity: 0.3;
}

.mf-carousel-container.mf-carousel-ready {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.swiper-slide.mf-carousel-slide {
    height: auto;
}

.swiper-slide-active .mf-carousel-slide-inner{
    margin-left: 0.3px;
}

.mf-carousel-slide-inner {
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 96.9%;
}

.swiper-slide.mf-carousel-slide:hover .mf-carousel-slide-inner {
    transform: translateY(-2px);
}

.swiper-slide.mf-carousel-slide .mf-tile-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.swiper-slide.mf-carousel-slide .mf-tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.swiper-slide.mf-carousel-slide .mf-tile-content {
    padding: 15px;
}

.swiper-slide.mf-carousel-slide .mf-tile-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.swiper-slide.mf-carousel-slide .mf-tile-link:hover,
.swiper-slide.mf-carousel-slide .mf-tile-link:focus {
    text-decoration: none;
    color: inherit;
}

/* Swiper navigation buttons */
.mf-carousel-wrapper .swiper-button-next,
.mf-carousel-wrapper .swiper-button-prev {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    transition: all 0.2s ease;
}

.mf-carousel-wrapper .swiper-button-next:hover,
.mf-carousel-wrapper .swiper-button-prev:hover {
    /* Hover styling moved to theme */
}

.mf-carousel-wrapper .swiper-button-next:after,
.mf-carousel-wrapper .swiper-button-prev:after {
    font-size: 20px;
    font-weight: bold;
}

/* Swiper pagination dots - positioned outside wrapper */
.swiper-pagination {
    position: relative;
    text-align: center;
    margin-top: 20px;
    height: 17px;
    padding-top: 5px;
}

.mf-carousel-wrapper .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.mf-carousel-wrapper .swiper-pagination-bullet-active {
    transform: scale(1.2);
    border: none;
    outline: none;
}

/* ==========================================================================
   END CAROUSEL STYLES
   ========================================================================== */

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .mf-grid-filters,
    .mf-pagination-controls,
    .swiper-button-next,
    .swiper-button-prev,
    .swiper-pagination {
        display: none;
    }
    
    .mf-grid-container,
    .mf-carousel-container {
        display: block;
    }
    
    .mf-grid-tile,
    .swiper-slide.mf-carousel-slide {
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ==========================================================================
   END PRINT STYLES
   ========================================================================== */