/* Modern Templates Page Styles */

/* CSS Custom Properties for Enhanced Theming */
:root {
    --primary-color: #EEC225;
    --primary-dark: #d4a91a;
    --primary-gradient: linear-gradient(135deg, #EEC225 0%, #d4a91a 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);

    --card-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --card-shadow-hover: 0 15px 35px rgba(0,0,0,0.15);
    --card-border-radius: 16px;
    --card-padding: 20px;

    --animation-duration: 0.3s;
    --animation-easing: cubic-bezier(0.25, 0.8, 0.25, 1);

    --text-primary: #334155;
    --text-secondary: #64748b;
    --text-light: #ffffff;

    --bg-primary-light: rgba(238, 194, 37, 0.1);
    --bg-success-light: rgba(5, 150, 105, 0.1);
    --bg-warning-light: rgba(217, 119, 6, 0.1);
    --bg-info-light: rgba(8, 145, 178, 0.1);
}

/* Dark Mode CSS Variables */
[data-theme=dark] {
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-light: #ffffff;

    --card-shadow: 0 4px 12px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 15px 35px rgba(0,0,0,0.4);
}

/* Templates Page Wrapper */
#templatesPageWrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    scroll-behavior: auto;
    overflow-x: hidden;
}

/* Fix scroll behavior for the entire page */
html, body {
    scroll-behavior: auto !important;
    overflow-x: hidden;
}

/* Ensure proper scroll direction */
* {
    scroll-behavior: auto !important;
}

/* Enhanced Search Section */
.templates-search-section .card {
    border: none;
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    transition: all var(--animation-duration) var(--animation-easing);
}

.templates-search-section .card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 2;
}

.search-input-wrapper input {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding-left: 45px;
    transition: all var(--animation-duration) ease;
}

.search-input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(238, 194, 37, 0.1);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.filter-dropdown select,
.sort-dropdown select {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: all var(--animation-duration) ease;
}

.filter-dropdown select:focus,
.sort-dropdown select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(238, 194, 37, 0.1);
}

/* Advanced Filters */
.advanced-filters-toggle button {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.advanced-filters-toggle button:hover {
    color: var(--primary-color);
}

/* Active Filters */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    background: var(--primary-color);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-tag .remove-filter {
    cursor: pointer;
    font-weight: bold;
}

/* Template Statistics Cards - Use same classes as products page */
.templates-stats-section .stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    color: var(--text-primary);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

.templates-stats-section .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    pointer-events: none;
    transition: all 0.3s ease;
    border-radius: 16px 16px 0 0;
}

.templates-stats-section .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(238, 194, 37, 0.12), 0 3px 8px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.templates-stats-section .stat-card:hover::before {
    height: 6px;
}

.templates-stats-section .stat-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.templates-stats-section .stat-content {
    text-align: left;
    flex: 1;
}

.templates-stats-section .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.templates-stats-section .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
    line-height: 1.3;
}

/* Mini Stat Cards */
.templates-stats-section .mini-stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.templates-stats-section .mini-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 194, 37, 0.12), 0 3px 8px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.templates-stats-section .mini-stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.templates-stats-section .mini-stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.templates-stats-section .mini-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.template-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    transition: all 0.3s ease;
}

.template-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.template-stat-card:hover::before {
    height: 6px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 24px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

/* Template Type Sections */
.template-type-section {
    margin-bottom: 2rem;
}

.type-header {
    background: #f8fafc;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all var(--animation-duration) ease;
}

.type-header:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
}

.type-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-color);
}

.type-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.type-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.type-count .badge {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 20px;
}

/* Modern Template Cards - Clean Card Design Like Reference */
.modern-template-card {
    background: #ffffff;
    border-radius: 16px;
    border: none;
    overflow: visible;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    max-width: 400px; /* Prevent cards from becoming too wide */
    margin: 8px auto; /* Center cards in their columns */
    display: flex;
    flex-direction: column;
    cursor: pointer;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 20px;
}

.modern-template-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Template Type Badge (Top Left) */
.template-type-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #FEF3C7;
    color: #D97706;
    padding: 8px 12px;
    border-radius: 0 0 12px 0;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}



/* Active Status Badge */
.template-active-badge {
    position: absolute;
    top: 42px;
    left: -8px;
    background: #3B82F6;
    color: white;
    padding: 4px 8px;
    border-radius: 0 8px 8px 0;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

/* Template Preview Container */
.template-preview-container {
    position: relative;
    width: 140px;
    height: 140px;
    background: #F3F4F6;
    border-radius: 12px;
    overflow: hidden;
    margin: 16px auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Template Preview Image with Auto-Scroll Animation */
.template-preview-image {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

.template-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
    position: relative;
}

/* For auto-scroll images, use different object-fit */
.template-preview-image img.auto-scroll-image {
    object-fit: cover;
    object-position: top;
    height: auto;
    min-height: 100%;
}

/* Auto-scroll animation for tall images */
.auto-scroll-image {
    animation: imageAutoScroll 8s ease-in-out infinite;
    height: auto;
    min-height: 100%;
    object-position: top;
}

@keyframes imageAutoScroll {
    0% { transform: translateY(0); }
    20% { transform: translateY(0); }
    40% { transform: translateY(-20%); }
    60% { transform: translateY(-40%); }
    80% { transform: translateY(-20%); }
    100% { transform: translateY(0); }
}

/* Simple hover effect */
.modern-template-card:hover .template-preview-image img {
    transform: scale(1.05);
}

/* Pause auto-scroll on hover */
.modern-template-card:hover .auto-scroll-image {
    animation-play-state: paused;
}

/* Image Loading State */
.image-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    z-index: 2;
}

.image-loading-spinner i {
    font-size: 24px;
    margin-bottom: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.template-preview-fallback,
.template-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.template-preview-fallback i,
.template-preview-placeholder i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* Template Type Overlay */
.template-type-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 5;
}

.template-type-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(238, 194, 37, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #B8860B;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Template Quick Actions Overlay */
.template-quick-actions {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10;
}

.modern-template-card:hover .template-quick-actions {
    opacity: 1;
    transform: translateY(0);
}

.template-quick-actions .btn {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.template-quick-actions .btn:hover {
    background: #EEC225;
    border-color: #EEC225;
    color: white;
    transform: scale(1.1);
}

/* Template Card Content */
.template-card-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    gap: 12px;
    text-align: center;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.template-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px 0;
    line-height: 1.2;
    text-align: center;
}

.performance-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.performance-indicator.high-performance {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.performance-indicator.medium-performance {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.performance-indicator.low-performance {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* Template Statistics - Compact Design */
.template-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 8px 0;
    font-size: 13px;
    color: #6B7280;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item i {
    font-size: 14px;
}

.stat-number {
    font-weight: 600;
    color: #374151;
}

/* Template Features */
.template-features {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.feature-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    color: #0369a1;
}

.feature-tag i {
    font-size: 12px;
}

/* Activity and Feature Badges */
.template-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    width: fit-content;
    margin: 0 auto;
}

.activity-badge.high {
    background: #DCFCE7;
    color: #166534;
}

.activity-badge.moderate {
    background: #FEF3C7;
    color: #92400E;
}

.activity-badge.low {
    background: #FEE2E2;
    color: #991B1B;
}

.feature-badges {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.feature-badge {
    background: #FEF3C7;
    color: #92400E;
    padding: 3px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Product Information */
.template-product-info {
    margin: 8px 0;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.product-badge {
    background: #EFF6FF;
    color: #1D4ED8;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    margin: 0 auto;
    max-width: 90%;
    text-align: center;
}

.product-badge span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Products Toggle */
.products-toggle {
    background: #F3F4F6;
    color: #6B7280;
    padding: 3px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px auto;
    width: fit-content;
}

.products-toggle:hover {
    background: #E5E7EB;
    color: #374151;
}

.products-toggle .toggle-icon {
    transition: transform 0.2s ease;
}

.products-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.products-expanded {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 3px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Template Card Actions - Reference Design Style */
.template-card-actions {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    gap: 8px;
}

.template-card-actions .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 16px;
    transition: all 0.2s ease;
    border: 1px solid;
    flex: 1;
    font-size: 14px;
}

.template-card-actions .btn-outline-success {
    background: #ffffff;
    border-color: #10B981;
    color: #10B981;
}

.template-card-actions .btn-outline-success:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.template-card-actions .btn-warning {
    background: #EEC225;
    border-color: #EEC225;
    color: #1F2937;
}

.template-card-actions .btn-warning:hover {
    background: #D97706;
    border-color: #D97706;
    color: white;
}
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    text-align: center;
}

.template-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    color: #64748b;
}

.meta-item i {
    font-size: 16px;
}

/* Template Action Info */
.template-action-info {
    margin: 12px 0;
}

.action-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FFF3CD;
    border: 1px solid #FFECB5;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #856404;
}

/* Template Performance */
.template-performance {
    margin: 12px 0;
}

.performance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.performance-badge.high-performance {
    background: #D1FAE5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.performance-badge.medium-performance {
    background: #FEF3C7;
    border: 1px solid #FDE68A;
    color: #92400E;
}

.performance-badge.low-performance {
    background: #FEE2E2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

/* Template Card Footer */
.template-card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.template-card-footer .btn {
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.template-card-footer .btn-outline-success {
    border-color: #10b981;
    color: #10b981;
}

.template-card-footer .btn-outline-success:hover {
    background-color: #10b981;
    border-color: #10b981;
    color: white;
}

.template-card-footer .btn-warning {
    background-color: #EEC225;
    border-color: #EEC225;
    color: #1e293b;
}

.template-card-footer .btn-warning:hover {
    background-color: #d4a91a;
    border-color: #d4a91a;
    color: #1e293b;
}

.template-card-footer .btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.template-card-footer .btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Remove old conflicting styles - these are replaced by the new design above */

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.empty-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* iPad and Tablet Responsive Design */
@media (min-width: 768px) and (max-width: 1199px) {
    .modern-template-card {
        max-width: 450px;
        width: 260px;
        padding: 18px;
        margin: 8px auto;
    }

    .template-preview-container {
        width: 160px;
        height: 160px;
        margin: 16px auto 20px auto;
    }

    .template-name {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .template-stats {
        gap: 16px;
        font-size: 13px;
        margin: 8px 0;
    }

    .template-card-actions .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .template-type-badge {
        padding: 6px 10px;
        font-size: 11px;
    }

    .template-active-badge {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Large Desktop Responsive Design */
@media (min-width: 1200px) {
    .modern-template-card {
        max-width: 320px;
        padding: 20px;
        margin: 8px auto;
    }

    .template-preview-container {
        width: 180px;
        height: 180px;
        margin: 20px auto 24px auto;
    }

    .template-name {
        font-size: 17px;
        margin-bottom: 10px;
    }

    .template-stats {
        gap: 20px;
        font-size: 14px;
        margin: 12px 0;
    }

    .template-card-actions .btn {
        padding: 12px 18px;
        font-size: 14px;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .templates-search-section .row {
        gap: 12px;
    }

    .templates-search-section .col-md-6,
    .templates-search-section .col-md-3 {
        margin-bottom: 12px;
    }

    .search-suggestions {
        max-height: 150px;
        font-size: 14px;
    }

    .suggestion-item {
        padding: 10px 12px;
    }

    .templates-stats-section .stat-card {
        margin-bottom: 12px;
        padding: 16px;
        gap: 12px;
    }

    .templates-stats-section .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .templates-stats-section .stat-number {
        font-size: 1.5rem;
    }

    .templates-stats-section .stat-label {
        font-size: 12px;
    }

    .type-header {
        padding: 16px;
    }

    .type-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .type-title {
        font-size: 1.1rem;
    }

    .type-description {
        font-size: 13px;
    }

    .modern-template-card {
        margin-bottom: 16px;
    }

    .modern-template-card:hover {
        transform: translateY(-4px) scale(1.01);
    }

    .template-preview-container {
        height: 160px;
    }

    .template-card-content {
        padding: 16px;
    }

    .template-header {
        margin-bottom: 12px;
    }

    .template-name {
        font-size: 16px;
    }

    .template-stats {
        gap: 12px;
        margin-bottom: 12px;
    }

    .stat-item {
        padding: 10px;
    }

    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .stat-number {
        font-size: 14px;
    }

    .stat-label {
        font-size: 10px;
    }

    .template-features {
        gap: 6px;
        margin-bottom: 16px;
    }

    .feature-tag {
        font-size: 10px;
        padding: 4px 8px;
    }

    .template-card-actions {
        padding-top: 12px;
    }

    .template-card-actions .btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    .template-status-badge {
        top: 12px;
        right: 12px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .template-quick-actions {
        top: 8px;
        left: 8px;
        gap: 6px;
    }

    .template-quick-actions .btn {
        width: 32px;
        height: 32px;
    }

    .performance-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }

    .filter-tags {
        gap: 6px;
    }

    .filter-tag {
        font-size: 11px;
        padding: 3px 10px;
    }
}

/* Mobile Responsive Styles for New Card Design */
@media (max-width: 768px) {
    .modern-template-card {
        padding: 12px;
        margin: 6px;
    }

    .template-preview-container {
        width: 160px;
        height: 160px;
        margin: 12px auto 16px auto;
    }

    .template-name {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .template-stats {
        gap: 16px;
        font-size: 12px;
        margin: 6px 0;
    }

    .activity-badge {
        padding: 3px 6px;
        font-size: 10px;
    }

    .feature-badge {
        padding: 2px 4px;
        font-size: 9px;
    }

    .template-card-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .product-badge {
        padding: 3px 6px;
        font-size: 10px;
    }

    .template-badges {
        margin: 6px 0;
        gap: 4px;
    }

    .template-product-info {
        margin: 6px 0;
    }

    .template-type-badge {
        top: -6px;
        left: -6px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .template-active-badge {
        top: 36px;
        left: -6px;
        padding: 3px 6px;
        font-size: 10px;
    }
}

@media (max-width: 576px) {
    .modern-template-card {
        padding: 10px;
        margin: 4px;
    }

    .template-preview-container {
        width: 140px;
        height: 140px;
        margin: 8px auto 12px auto;
    }

    .template-name {
        font-size: 14px;
        margin-bottom: 3px;
    }

    .template-stats {
        gap: 12px;
        font-size: 11px;
        margin: 4px 0;
    }

    .template-card-actions {
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
    }

    .template-card-actions .btn {
        width: 100%;
        padding: 6px 10px;
        font-size: 11px;
    }

    .template-type-badge {
        top: -4px;
        left: -4px;
        padding: 4px 8px;
        font-size: 10px;
    }

    .template-active-badge {
        top: 28px;
        left: -4px;
        padding: 2px 4px;
        font-size: 9px;
    }

    .product-badge {
        padding: 2px 4px;
        font-size: 9px;
    }

    .feature-badges {
        gap: 3px;
    }

    .feature-badge {
        padding: 1px 3px;
        font-size: 8px;
    }

    .activity-badge {
        padding: 2px 4px;
        font-size: 9px;
    }

    .template-badges {
        margin: 4px 0;
        gap: 3px;
    }

    .template-product-info {
        margin: 4px 0;
    }
}

/* iPhone 14 and similar sized devices (430px width) */
@media (max-width: 430px) {
    .template-preview-container {
        width: 160px;
        height: 160px;
        margin: 10px auto 14px auto;
    }

    .modern-template-card {
        padding: 12px;
        margin: 4px;
    }

    .template-type-badge {
        top: -4px;
        left: -4px;
        padding: 6px 8px;
        font-size: 10px;
    }

    .template-active-badge {
        top: 32px;
        left: -4px;
        padding: 3px 6px;
        font-size: 9px;
    }
}

/* Dark Mode Support */
[data-theme=dark] #templatesPageWrapper {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme=dark] .templates-search-section .card {
    background-color: #242644;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

[data-theme=dark] .templates-search-section .form-control,
[data-theme=dark] .templates-search-section .form-select {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

[data-theme=dark] .templates-search-section .form-control:focus,
[data-theme=dark] .templates-search-section .form-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    color: white;
}

[data-theme=dark] .search-suggestions {
    background: #242644;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme=dark] .suggestion-item {
    color: #e2e8f0;
}

[data-theme=dark] .suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme=dark] .type-header {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme=dark] .type-title {
    color: #e2e8f0;
}

[data-theme=dark] .type-description {
    color: #a0aec0;
}

[data-theme=dark] .modern-template-card {
    background-color: #242644;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

[data-theme=dark] .template-card-header,
[data-theme=dark] .template-card-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme=dark] .template-name {
    color: #ffffff;
}

[data-theme=dark] .template-meta {
    color: #a0aec0;
}

[data-theme=dark] .template-thumbnail {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme=dark] .template-stat-card {
    background-color: #242644;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

[data-theme=dark] .template-stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(238, 194, 37, 0.2), 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme=dark] .stat-value {
    color: #e2e8f0;
}

[data-theme=dark] .stat-number {
    color: #e2e8f0 !important;
}

[data-theme=dark] .stat-label {
    color: #a0aec0 !important;
}

[data-theme=dark] .stat-card {
    background-color: #242644 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0;
}

[data-theme=dark] .templates-stats-section .stat-card {
    background-color: #242644 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0;
}

[data-theme=dark] .templates-stats-section .stat-number {
    color: #e2e8f0 !important;
}

[data-theme=dark] .templates-stats-section .stat-label {
    color: #a0aec0 !important;
}

[data-theme=dark] .mini-stat-card {
    background-color: #242644 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0;
}

[data-theme=dark] .mini-stat-number {
    color: #e2e8f0 !important;
}

[data-theme=dark] .mini-stat-label {
    color: #a0aec0 !important;
}

[data-theme=dark] .templates-stats-section .mini-stat-number {
    color: #e2e8f0 !important;
}

[data-theme=dark] .templates-stats-section .mini-stat-label {
    color: #a0aec0 !important;
}

/* Fallback for browsers that support prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    .stat-card {
        background-color: #242644 !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        color: #e2e8f0;
    }

    .stat-number {
        color: #e2e8f0 !important;
    }

    .stat-label {
        color: #a0aec0 !important;
    }

    .mini-stat-card {
        background-color: #242644 !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        color: #e2e8f0;
    }

    .mini-stat-number {
        color: #e2e8f0 !important;
    }

    .mini-stat-label {
        color: #a0aec0 !important;
    }

    .templates-stats-section .stat-card {
        background-color: #242644 !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        color: #e2e8f0;
    }

    .templates-stats-section .stat-number {
        color: #e2e8f0 !important;
    }

    .templates-stats-section .stat-label {
        color: #a0aec0 !important;
    }

    .templates-stats-section .mini-stat-number {
        color: #e2e8f0 !important;
    }

    .templates-stats-section .mini-stat-label {
        color: #a0aec0 !important;
    }
}

[data-theme=dark] .empty-title {
    color: #e2e8f0;
}

[data-theme=dark] .empty-description {
    color: #a0aec0;
}

[data-theme=dark] .modern-template-card:hover {
    box-shadow: 0 20px 40px rgba(238, 194, 37, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

[data-theme=dark] .modern-template-card::before {
    background: linear-gradient(135deg, rgba(238, 194, 37, 0.03) 0%, rgba(212, 169, 26, 0.03) 100%);
}

[data-theme=dark] .modern-template-card:hover::before {
    background: linear-gradient(135deg, rgba(238, 194, 37, 0.1) 0%, rgba(212, 169, 26, 0.1) 100%);
}

/* Light mode explicit styling */
[data-theme=light] .modern-template-card,
.modern-template-card {
    background: white;
    border-color: #e9ecef;
    color: #334155;
}

[data-theme=light] .templates-search-section .card,
.templates-search-section .card {
    background: white;
    border-color: #e9ecef;
}

[data-theme=light] .template-name,
.template-name {
    color: #1e293b;
}

[data-theme=light] .template-meta,
.template-meta {
    color: #64748b;
}

[data-theme=light] .template-stat-card,
.template-stat-card {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

[data-theme=light] .type-header,
.type-header {
    background: #f8fafc;
    border-color: #e9ecef;
}

[data-theme=light] .type-title,
.type-title {
    color: #1e293b;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Enhanced interactions */
.modern-template-card .shimmer-effect {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(238, 194, 37, 0.2), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.modern-template-card:hover .shimmer-effect {
    left: 100%;
}
