.templates-page {
    padding: 40px 0 80px;
    background: white;
    min-height: 100vh;
}

/* Templates Header */
.templates-header {
    background: linear-gradient(135deg, var(--soft-blue), var(--light-blue));
    border-radius: 24px;
    padding: 50px 40px;
    margin-bottom: 40px;
    border: 1px solid var(--border-gray);
    overflow: hidden;
    position: relative;
}

.templates-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    position: relative;
    z-index: 1;
}

.header-text {
    flex: 1;
}

.page-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--dark-blue);
    margin-bottom: 15px;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--dark-blue), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-description {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 25px;
    line-height: 1.6;
}

.templates-stats {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.stat-item {
    color: var(--text-gray);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-visual {
    flex-shrink: 0;
}

.template-preview-cards {
    display: flex;
    gap: 15px;
    transform: perspective(1000px) rotateY(-15deg);
}

.preview-card {
    width: 100px;
    height: 140px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.preview-card::after {
    content: '';
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    height: 8px;
    background: var(--border-gray);
    border-radius: 4px;
}

.preview-card.card-2 {
    transform: translateY(-20px);
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.preview-card.card-3 {
    transform: translateY(-10px);
}

.templates-header:hover .preview-card {
    transform: translateY(-5px);
}

/* ========== PERBAIKAN FILTERS SIDEBAR ========== */
/* Filters Sidebar - Samakan dengan category.css */
.filters-sidebar {
    background: var(--soft-blue);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-gray);
    position: sticky;
    top: 140px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) transparent;
}

.filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filters-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.filters-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 10px;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* Category Filters - Samakan dengan category.css */
.categories-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.category-filter-item:hover {
    background: white;
    color: var(--primary-blue);
    border-color: var(--light-blue);
}

.category-filter-item.active {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.category-icon-small {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.category-filter-item.active .category-icon-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.category-filter-item span:not(.category-count) {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.category-count {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.category-filter-item.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Tech Stack Filters */
.tech-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tech-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tech-filter-item:hover {
    background: white;
    color: var(--primary-blue);
    border-color: var(--light-blue);
}

.tech-filter-item.active {
    background: var(--primary-blue);
    color: white;
}

.tech-filter-item span:not(.tech-count) {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.tech-count {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.tech-filter-item.active .tech-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Rating Filters */
.rating-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.rating-filter-item:hover {
    background: white;
    color: var(--primary-blue);
    border-color: var(--light-blue);
}

.rating-filter-item.active {
    background: var(--primary-blue);
    color: white;
}

.rating-filter-item .stars {
    color: #fbbf24;
    font-size: 0.85rem;
}

.rating-filter-item.active .stars {
    color: #fbbf24;
}

.rating-filter-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    background: white;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    justify-content: center;
    min-width: 70px;
}

.quick-action-btn:hover {
    background: var(--light-blue);
    color: var(--primary-blue);
    border-color: var(--light-blue);
}

.quick-action-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Price Filter - Samakan dengan category.css */
.price-filter {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-gray);
}

.price-range {
    width: 100%;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.price-inputs input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    transition: all 0.3s ease;
    min-width: 0;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.price-inputs input::placeholder {
    color: var(--text-gray);
    font-size: 0.85rem;
}

.price-separator {
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    min-width: 15px;
    text-align: center;
}

.price-range-display {
    margin-bottom: 15px;
    padding: 8px 12px;
    background: var(--soft-blue);
    border-radius: 6px;
    text-align: center;
}

.price-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-filter .btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    border: none;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.3px;
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.price-filter .btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.price-filter .btn-outline-secondary {
    border: 1px solid var(--border-gray);
    color: var(--text-gray);
    background: white;
    padding: 10px 16px;
    font-size: 0.85rem;
}

.price-filter .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: var(--text-gray);
    color: var(--dark-blue);
}

/* Loading state for price filter */
.price-filter.loading {
    opacity: 0.7;
    pointer-events: none;
}

.price-filter.loading .btn {
    position: relative;
}

.price-filter.loading .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ========== END PERBAIKAN FILTERS SIDEBAR ========== */

/* Templates Toolbar - Enhanced */
.templates-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--soft-blue);
    padding: 25px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--border-gray);
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.05);
}

.toolbar-left {
    flex: 1;
    min-width: 300px;
}

.search-filter {
    max-width: 450px;
    position: relative;
}

.search-filter .form-control {
    border-radius: 12px 0 0 12px;
    border-right: none;
    padding: 14px 20px;
    font-size: 0.95rem;
    border: 2px solid var(--border-gray);
    transition: all 0.3s ease;
}

.search-filter .form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: none;
}

.search-filter .btn {
    border-radius: 0 12px 12px 0;
    padding: 14px 20px;
    border: 2px solid var(--primary-blue);
    background: var(--primary-blue);
    color: white;
    transition: all 0.3s ease;
}

.search-filter .btn:hover {
    background: var(--secondary-blue);
    border-color: var(--secondary-blue);
    transform: translateY(-1px);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* View Mode Toggle - Enhanced */
.view-mode-toggle {
    display: flex;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    overflow: hidden;
}

.view-mode-toggle {
    display: flex;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    overflow: hidden;
}

.view-btn {
    padding: 10px 12px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 1px solid var(--border-gray);
}

.view-btn:last-child {
    border-right: none;
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary-blue);
    color: white;
}

/* Sort Dropdown - Enhanced */
.sort-dropdown select {
    min-width: 160px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    background: white;
}

/* Template Cards - Enhanced Grid View */
.templates-container.grid-view .template-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 35px;
    border: 1px solid var(--border-gray);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.templates-container.grid-view .template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(59, 130, 246, 0.02));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.templates-container.grid-view .template-card:hover::before {
    opacity: 1;
}

.templates-container.grid-view .template-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 25px 80px rgba(59, 130, 246, 0.25);
    color: inherit;
    text-decoration: none;
}

.templates-container.grid-view .template-card .template-image {
    height: 220px;
    position: relative;
    overflow: hidden;
}

.templates-container.grid-view .template-card .template-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.templates-container.grid-view .template-card:hover .template-image img {
    transform: scale(1.05);
}

.templates-container.grid-view .template-card .template-content {
    padding: 30px;
    position: relative;
    z-index: 2;
}

/* Template Category Badge */
.template-category {
    margin-bottom: 12px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.category-badge:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

/* Template Title */
.template-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark-blue);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Template Meta */
.template-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.rating-stars {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #fbbf24;
    font-size: 0.9rem;
}

.rating-stars span {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-left: 5px;
    font-weight: 500;
}

.template-stats {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-gray);
}

.template-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

/* Tech Stack */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tech-tag {
    background: var(--soft-blue);
    color: var(--primary-blue);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: var(--light-blue);
    transform: translateY(-1px);
}

.tech-tag.more {
    background: var(--border-gray);
    color: var(--text-gray);
}

/* Template Footer */
.template-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-gray);
}

.price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-blue);
}

.price-original {
    font-size: 0.9rem;
    text-decoration: line-through;
    color: var(--text-gray);
}

.discount-badge {
    background: var(--success-green);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    align-self: flex-start;
}

/* Template Labels */
.template-labels {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-label {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-new {
    background: linear-gradient(45deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.label-featured {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.label-popular {
    background: linear-gradient(45deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.label-bestseller {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.label-discount {
    background: linear-gradient(45deg, #06b6d4, #0891b2);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

/* Wishlist Button */
.wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wishlist-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.wishlist-btn.active {
    color: #ef4444;
    background: rgba(255, 255, 255, 1);
}

/* List View Styles */
.templates-container.list-view .template-card {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    margin-bottom: 30px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-gray);
    padding: 25px;
}

.templates-container.list-view .template-card:hover {
    color: inherit;
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.15);
    text-decoration: none;
}

.template-card-list .template-image {
    width: 280px;
    height: 180px;
    flex-shrink: 0;
    margin-right: 25px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.template-card-list .template-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.template-card-list .template-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.template-description {
    color: var(--text-gray);
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Results Info */
.results-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    font-size: 0.95rem;
    color: var(--text-gray);
    flex-wrap: wrap;
    padding: 12px 0;
}

.search-info {
    color: var(--primary-blue);
    font-weight: 600;
}

.clear-search {
    color: var(--text-gray);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    border: 1px solid var(--border-gray);
}

.clear-search:hover {
    background: var(--light-blue);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* No Templates */
.no-templates {
    text-align: center;
    padding: 80px 20px;
    background: var(--soft-blue);
    border-radius: 20px;
    margin: 40px 0;
}

.no-templates-content i {
    font-size: 5rem;
    color: var(--border-gray);
    margin-bottom: 25px;
}

.no-templates-content h3 {
    font-size: 1.8rem;
    color: var(--dark-blue);
    margin-bottom: 15px;
    font-weight: 700;
}

.no-templates-content p {
    color: var(--text-gray);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.no-templates-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Active Filters */
.active-filters {
    background: white;
    border-radius: 16px;
    padding: 18px 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-gray);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.05);
}

.active-filters-content {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 700;
    color: var(--text-gray);
    font-size: 0.95rem;
    white-space: nowrap;
}

.filter-chips {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-blue);
    color: var(--primary-blue);
    padding: 8px 14px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-chip:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-2px);
}

.filter-chip-remove {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.filter-chip-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

.clear-all-filters {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-all-filters:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Pagination Enhanced */
.pagination-wrapper {
    margin-top: 60px;
}

.pagination .page-link {
    color: var(--text-gray);
    border: 2px solid var(--border-gray);
    padding: 12px 18px;
    margin: 0 3px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

.pagination .page-link:hover {
    background: var(--soft-blue);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.pagination .page-item.active .page-link {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    font-weight: 700;
    background: var(--soft-blue);
    border-color: var(--light-blue);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    
    .template-preview-cards {
        transform: none;
    }
    
    .page-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 992px) {
    .templates-page {
        padding: 20px 0 60px;
    }
    
    .filters-sidebar {
        position: static;
        margin-bottom: 25px;
        padding: 20px;
    }
    
    .templates-header {
        padding: 30px 25px;
        margin-bottom: 30px;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .templates-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }
    
    .toolbar-left {
        min-width: auto;
    }
    
    .toolbar-right {
        justify-content: space-between;
    }
    
    .template-card-list .template-image {
        width: 220px;
        height: 140px;
    }
}

@media (max-width: 768px) {
    .templates-header {
        padding: 25px 20px;
    }
    
    .page-title {
        font-size: 1.8rem;
    }
    
    .templates-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .template-preview-cards {
        display: none;
    }
    
    .filters-sidebar {
        padding: 15px;
        border-radius: 12px;
    }
    
    .filter-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .category-filter-item {
        padding: 10px 12px;
    }
    
    .category-icon-small {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .templates-toolbar {
        padding: 15px;
    }
    
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-dropdown select {
        min-width: 140px;
    }
    
    .templates-container.list-view .template-card {
        flex-direction: column;
        padding: 20px;
    }
    
    .template-card-list .template-image {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .template-card-list .template-content {
        min-height: auto;
    }
    
    .template-card-list .template-title {
        font-size: 1.3rem;
    }
    
    .template-card-list .template-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .template-card-list .template-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-top: 15px;
    }
    
    .active-filters-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .filter-chips {
        width: 100%;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        flex: none;
        justify-content: flex-start;
    }
    
    .price-inputs {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .price-inputs input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 10px;
    }
    
    .price-separator {
        display: none;
    }
    
    .price-filter .btn {
        padding: 14px 20px;
        font-size: 0.95rem;
        border-radius: 10px;
        font-weight: 600;
    }
}

@media (max-width: 576px) {
    .templates-container.grid-view .template-card .template-content {
        padding: 20px;
    }
    
    .template-title {
        font-size: 1.2rem;
    }
    
    .pagination .page-link {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

/* Loading States */
.template-image.loading {
    position: relative;
    overflow: hidden;
}

.template-image.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Smooth Transitions */
.templates-container {
    transition: opacity 0.3s ease;
}

.template-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Print Styles */
@media print {
    .filters-sidebar,
    .templates-toolbar,
    .pagination-wrapper,
    .wishlist-btn,
    .active-filters {
        display: none !important;
    }
    
    .templates-container .col-lg-4 {
        width: 50% !important;
    }
    
    .template-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}