/* Templates Archive Styles */
.em-templates-archive-wrapper select {
    line-height: normal;
    margin-bottom: 0;
}
.em-templates-archive-wrapper {
    background-color: #fcfcfc;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

.em-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 30px;
}

/* Header */
.em-templates-header {
    padding: 80px 0 60px;
    text-align: center;
}

.em-page-title {
    font-size: 42px;
    font-weight: 300;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
    color: #1a1a1a;
}

.em-page-subtitle {
    font-size: 18px;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Filters */
.em-templates-filters {
    padding: 0 0 40px;
    border-bottom: 1px solid #eee;
    margin-bottom: 60px;
}

.em-filters-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: space-between;
    align-items: center;
}

.em-filters-left,
.em-filters-right {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
}

.em-filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.em-filter-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
}

.em-filter-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.em-filter-link {
    padding: 6px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.em-filter-link:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.em-filter-link.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.em-filter-select {
    padding: 8px 30px 8px 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.em-filter-select:hover,
.em-filter-select:focus {
    border-color: #1a1a1a;
}

/* Grid */
.em-templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    padding-bottom: 80px;
}

/* Template Card */
.em-template-card {
    background: #efefef;
    border:1px solid #bebebe;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.em-template-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.em-card-image-wrapper {
    position: relative;
    padding-top: 130%;
    /* Consistent aspect ratio */
    overflow: hidden;
    background: #f0f0f0;
}

.em-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.em-template-card:hover .em-card-image {
    transform: scale(1.05);
}

/* Badges */
.em-template-badges {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
}

.em-template-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

/* Specific Badge Colors */
.em-template-badge.badge-premium {
    background: rgba(26, 26, 26, 0.9);
    color: #fff;
}

.em-template-badge.badge-advanced {
    background: rgba(102, 102, 102, 0.9);
    color: #fff;
}

/* Overlay & Actions */
.em-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.em-template-card:hover .em-card-overlay {
    opacity: 1;
}

.em-card-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 80%;
}

/* Buttons */
.em-btn {
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.em-btn-primary {
    background-color: #1a1a1a;
    color: #fff;
}

.em-btn-primary:hover {
    background-color: #333;
}

.em-btn-secondary {
    background-color: #fff;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
}

.em-btn-secondary:hover {
    background-color: #f5f5f5;
}

.em-btn span {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Content */
.em-card-content {
    padding: 24px;
    text-align: center;
}

.em-template-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1a1a1a;
}

.em-template-excerpt {
    font-size: 14px;
    color: #777;
    margin: 0;
    line-height: 1.5;
}

/* Pagination */
.em-templates-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 40px 0 80px;
}

.em-templates-pagination .page-numbers {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    color: #666;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.em-templates-pagination .page-numbers.current,
.em-templates-pagination .page-numbers:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

/* Empty State */
.em-no-templates {
    text-align: center;
    padding: 100px 0;
    color: #999;
}

.em-no-templates span {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.em-no-templates h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

/* Responsive */
@media (max-width: 1199px) {
    .em-templates-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

@media (max-width: 991px) {
    .em-templates-filters {
        margin-bottom: 40px;
    }

    .em-filters-inner {
        align-items: flex-start;
        gap: 20px;
    }

    .em-filters-left,
    .em-filters-right {
        width: 100%;
        gap: 18px;
    }

    .em-filter-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .em-filter-links {
        width: 100%;
    }

    .em-templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .em-page-title {
        font-size: 32px;
    }
}

@media (max-width: 575px) {
    .em-templates-header {
        padding: 56px 0 36px;
    }

    .em-page-title {
        font-size: 28px;
        line-height: 1.1;
    }

    .em-page-subtitle {
        font-size: 15px;
    }

    .em-templates-filters {
        padding-bottom: 28px;
        margin-bottom: 28px;
    }

    .em-filter-label {
        font-size: 12px;
        letter-spacing: 0.8px;
    }

    .em-filter-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        margin: 0 -4px;
        padding-left: 4px;
        padding-right: 4px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .em-filter-links::-webkit-scrollbar {
        height: 6px;
    }

    .em-filter-links::-webkit-scrollbar-thumb {
        background: #d7d7d7;
        border-radius: 999px;
    }

    .em-filter-link {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
    }

    .em-filters-right .em-filter-group {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 12px;
        padding: 14px;
    }

    .em-filter-select {
        width: 100%;
        min-height: 42px;
        font-size: 16px;
    }

    .em-templates-grid {
        grid-template-columns: 1fr;
    }

    .em-container {
        padding: 0 20px;
    }

    .em-card-content {
        padding: 20px 18px;
    }

    .em-card-image-wrapper {
        padding-top: 118%;
        margin-bottom:200px;
        overflow:unset;
    }

    .em-card-overlay {
        position: absolute;
        width: 100%;
        height: auto;
        opacity: 1;
        background: transparent;
        backdrop-filter: none;
        display: block;
        padding: 14px 16px 0;
        box-sizing: border-box;
        bottom:-162px;
        top:unset;
    }

    .em-template-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

    .em-template-card:hover .em-card-image {
        transform: none;
    }

    .em-card-actions {
        width: 100%;
        gap: 10px;

    }

    .em-btn {
        width: 100%;
        width:-webkit-fill-available;
        min-height: 44px;
        /*flex-direction:row;*/
    }
}
