/* Modal Styles */
.mts-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.mts-modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Fixed Button Container */
.mts-fixed-container {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    display: flex;
    align-items: center;
}

/* Button Styles */
.mts-modal-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 14px 10px;
    background: #fff;
    color: #1a202c;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-width: 70px;
    min-height: 85px;
    gap: 0;
    writing-mode: initial;
    transform: translateZ(0);
    backface-visibility: hidden;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
}

.mts-modal-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(34,113,177,0.1), rgba(34,113,177,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mts-modal-trigger::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    background: rgba(34,113,177,0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.mts-modal-trigger-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.mts-modal-trigger i {
    font-size: 24px;
    margin-bottom: 8px;
    color: #2271b1;
    transition: transform 0.3s ease, color 0.3s ease;
}

.mts-modal-trigger-text {
    font-size: 13px;
    font-weight: 500;
    color: #1a202c;
    transition: color 0.3s ease;
}

/* Hover Effects */
.mts-modal-trigger:hover {
    background: #f5f7fa;
    color: #135e96;
    box-shadow: 0 4px 16px rgba(34,113,177,0.12);
    transform: translateY(-2px);
}

.mts-modal-trigger:hover::before {
    opacity: 1;
}

.mts-modal-trigger:hover i {
    transform: scale(1.1);
    color: #135e96;
}

.mts-modal-trigger:hover .mts-modal-trigger-text {
    color: #135e96;
}

/* Active/Click Effects */
.mts-modal-trigger:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(34,113,177,0.08);
}

.mts-modal-trigger:active::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
}

/* Focus Effects */
.mts-modal-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.2);
}

/* Animation for Modal Open */
.mts-modal-open .mts-modal-trigger {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* Search Styles */
.mts-modal-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.mts-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.mts-search-container {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

#mts-search {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#mts-search:focus {
    outline: none;
    border-color: var(--mts-buy-button-hover-bg-color, #135e96);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.1);
}

.mts-search-container::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 15px;
    top: 35%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    pointer-events: none;
    transition: color 0.3s ease;
}

.mts-search-container:focus-within::before {
    color: var(--mts-buy-button-hover-bg-color, #135e96);
}

/* Add a subtle shadow when header is sticky */
.mts-modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mts-modal-header.is-sticky::after {
    opacity: 1;
}

/* Demos Grid Styles */
.mts-modal-body {
    display: flex;
    margin-top: 20px;
    position: relative;
    min-height: 400px;
}

.mts-sidebar {
    width: 275px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    margin-right: 30px;
}

.mts-sidebar h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #333;
    padding: 0;
    background: none;
    z-index: auto;
}

.mts-theme-filters {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 8px;
}

.mts-theme-filters li {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.mts-theme-filters label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    position: relative;
    text-transform: capitalize;
    background-color: #f9f9f9;
    font-size: 13px;
}

.mts-theme-filters label:hover {
    color: #333;
    background-color: #eee;
    border-color: #ccc;
}

.mts-theme-filters input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.mts-theme-filters input[type="checkbox"]:checked + label {
    color: #fff;
    background-color: var(--mts-buy-button-bg-color, #2271b1);
    border-color: var(--mts-buy-button-bg-color, #2271b1);
}

.mts-theme-filters label.active {
    color: #fff;
    background-color: var(--mts-buy-button-bg-color, #2271b1);
    border-color: var(--mts-buy-button-bg-color, #2271b1);
}

.mts-theme-filters label.selected {
    background-color: #fff;
    color: var(--mts-buy-button-bg-color, #2271b1);
    border-color: var(--mts-buy-button-bg-color, #2271b1);
    padding-right: 24px;
    position: relative;
    font-weight: bold;
}

.mts-theme-filters label.selected::after {
    content: '\f00d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    top: 53%;
    transform: translateY(-50%);
    color: var(--mts-buy-button-bg-color, #2271b1);
    font-size: 13px;
}

.mts-selected-count {
    font-size: 14px;
    color: #666;
    margin-left: 5px;
}

.mts-demos-grid {
    display: grid;
    grid-template-columns: repeat(var(--mts-columns, 3), 1fr);
    gap: 30px;
    padding: 0;
    min-width: 0;
}

/* Adjust height for 2 columns */
.mts-demos-grid[style*="--mts-columns: 2"] .mts-demo-item,
.mts-demos-grid[style*="--mts-columns: 2"] .mts-demo-image {
    max-height: 400px;
}

.mts-demo-item {
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    visibility: visible;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.mts-demo-item.filtering-out {
    display: none;
    /* Ensure no residual layout impact */
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: none !important;
    transition: none !important;
}

.mts-demo-item.filtering-in {
    /* Remove animation and will-change to prevent layout issues */
    animation: none !important;
    will-change: auto !important;
    transform: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.mts-demo-item:hover {
    transform: scale3d(0.98, 0.98, 1);
    will-change: transform;
}

.mts-demo-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.mts-demo-count-display {
    text-align: right;
    margin-bottom: 10px;
}

.mts-demo-image {
    position: relative;
    width: 100%;
    height: 425px;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column-reverse;
    background-color: #f5f5f5;
}

.mts-demo-info {
    padding: 20px;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mts-demo-info h3 {
    margin: 0 0 10px;
    font-size: 1.2em;
    line-height: 1.2;
    color: #333;
}

.mts-demo-info p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

.mts-demo-content,
.mts-demo-actions,
.mts-demo-preview-button {
    display: none !important;
}

.mts-demos-grid .mts-demo-item:only-child:not(.filtering-out) {
    grid-column: span var(--mts-columns, 3);
    min-height: 400px;
}

.mts-demos-grid .mts-demo-item:only-child:not(.filtering-out) .mts-demo-image {
    min-height: 400px;
}

.mts-buy-theme-container {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.mts-buy-theme-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: var(--mts-buy-button-bg-color, #2271b1);
    color: #fff !important;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mts-buy-theme-button:hover {
    background: var(--mts-buy-button-hover-bg-color, #135e96);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.2);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .mts-modal-body {
        flex-direction: column;
    }

    .mts-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }

    .mts-demos-grid {
        grid-template-columns: 1fr;
    }
    
    .mts-modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .mts-modal-trigger {
        min-height: 120px;
        padding: 10px 20px;
    }

    .mts-modal-trigger i {
        font-size: 28px;
    }

    .mts-modal-trigger-text {
        font-size: 14px;
    }
}

.mts-demo-grid-wrapper {
    flex: 1;
    min-width: 0;
} 