body {
    overflow-x: hidden;
}

.trstemp-step-row {
    background: #f8f9fa;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.trstemp-template-gallery {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 0;
}

.trstemp-gallery-header {
    text-align: center;
    margin-bottom: 30px;
}

.trstemp-gallery-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.trstemp-gallery-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.trstemp-search-section {
    text-align: center;
    margin: 40px 0 30px 0;
}

.trstemp-search-box-full {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.trstemp-search-box-full input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #e5e5e5;
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.trstemp-search-box-full input:focus {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
}

.trstemp-search-box-full .trstemp-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

.trstemp-gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
    padding-left: 20px;
}

.trstemp-category-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.right-controls {
    display: flex;
    align-items: center;
    /* gap: 15px; */
    flex-wrap: wrap;
    margin-right: 10px !important;
}



.trstemp-filter-dropdown {
    position: relative;
    display: inline-block;
}

.trstemp-filter-dropdown .trstemp-filter {
    position: relative;
}

.subcategory-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    transform: translateY(-10px);
}

.trstemp-filter-dropdown:hover .subcategory-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.subcategory-dropdown:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.trstemp-filter-dropdown {
    position: relative;
}

.trstemp-filter {
    padding: 8px 16px;
    border: 2px solid #e5e5e5;
    background: #fff;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trstemp-filter.trstemp-active,
.trstemp-filter:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.trstemp-filter-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}



.subfilter {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.subfilter:hover {
    background: #f8f9fa;
}

.subfilter:first-child {
    border-radius: 8px 8px 0 0;
}

.subfilter:last-child {
    border-radius: 0 0 8px 8px;
}

.sort-dropdown select,
.template-type-filters select {
    padding: 10px 15px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    background: white;
    min-width: 140px;
}

.sort-dropdown select:focus,
.template-type-filters select:focus {
    border-color: #667eea;
}

.type-filters {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
    margin-left: auto;
}

.type-filter {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.type-filter.active,
.type-filter:hover {
    background: #667eea;
    color: white;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;

        padding: 0 20px;
    box-sizing: border-box;
}

.template-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fff;
        min-width: 0;
    max-width: 100%;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.template-card.selected {
    border: 3px solid #667eea;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.template-preview {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.template-placeholder h4 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
}

.template-placeholder p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.template-card:hover .template-overlay {
    opacity: 1;
    pointer-events: auto;
}

.btn-preview,
.btn-select {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-preview {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-preview:hover {
    background: rgba(255,255,255,0.3);
}

.btn-select {
    background: #667eea;
    color: white;
}

.btn-select:hover {
    background: #5a6fd8;
}

.btn-upgrade {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-upgrade:hover {
    background: linear-gradient(135deg, #f7931e, #ff6b35);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.template-info {
    padding: 15px;
}

.template-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
}

.template-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.premium-badge {
    font-size: 12px;
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.free-badge {
    font-size: 12px;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.pro-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.pro-badge-large {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.pack-badge {
    font-size: 12px;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.single-badge {
    font-size: 12px;
    color: #6c757d;
    background: rgba(108, 117, 125, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}



@media (max-width: 1024px) {
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .gallery-footer {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .category-filters {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
    }
}

.pro-upgrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 25px 30px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-footer {
    padding: 20px 30px 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-upgrade {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-cancel {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
}

.template-type-filters select {
    padding: 10px 15px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    background: white;
    min-width: 140px;
}

.template-type-filters select:focus {
    border-color: #667eea;
}

.type-filters {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
}

.type-filter {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.type-filter.active,
.type-filter:hover {
    background: #667eea;
    color: white;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Continue button enhancement when template is selected */
.trstemp-btn-primary.template-selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    }
    50% {
        box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
    }
    100% {
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    }
}

/* ================================
   No Templates Found – Premium UI
================================ */

/* Force No-Template box to center inside grid */
.templates-grid #trstemp-no-templates {
    grid-column: 1 / -1;          /* span full grid */
    display: flex;
    justify-content: center;
}

#trstemp-no-templates {
    display: none;
    max-width: 520px;
    margin: 80px auto;
    padding: 50px 40px;
    text-align: center;

    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.08),
        rgba(118, 75, 162, 0.08)
    );

    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.15);

    animation: trstempFadeUp 0.4s ease;
}

/* Icon / heading */
#trstemp-no-templates h3 {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 12px;
    line-height: 1.2 !important;
}

/* Description text */
#trstemp-no-templates p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
}

/* Go Back button */
#trstemp-no-templates .turbo-btn-secondary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;

    padding: 12px 32px;
    border-radius: 30px;

    font-size: 15px;
    font-weight: 600;
    cursor: pointer;

    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
    transition: all 0.3s ease;
    margin-top: 18px;
}

#trstemp-no-templates .turbo-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.45);
}

/* Smooth entrance animation */
@keyframes trstempFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
