/* Template Gallery Styles */

.template-gallery-page {
    min-height: 100vh;
    background: var(--bg-dark);
    padding: var(--space-2xl) var(--space-lg);
}

.template-gallery-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.template-gallery-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-md);
}

.template-gallery-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    line-height: 1.6;
}

/* Gallery Grid */
.template-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Template Card */
.template-gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.template-gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.template-gallery-card:hover .template-card-overlay {
    opacity: 1;
}

/* Card Preview (Phone Mock) */
.template-card-preview {
    position: relative;
    aspect-ratio: 9/14;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
}

.template-card-phone {
    position: absolute;
    inset: 20px;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.template-card-phone-header {
    padding: 16px;
    text-align: center;
    color: white;
}

.template-card-phone-logo {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 12px;
    margin: 0 auto 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-card-phone-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.template-card-phone-name {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.template-card-phone-desc {
    font-size: 10px;
    opacity: 0.9;
    margin: 4px 0 0;
}

.template-card-phone-products {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-card-phone-product {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.template-card-phone-product-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #e9ecef;
    overflow: hidden;
    flex-shrink: 0;
}

.template-card-phone-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-card-phone-product-info {
    flex: 1;
    min-width: 0;
}

.template-card-phone-product-info h4 {
    font-size: 10px;
    margin: 0 0 2px;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-phone-product-info span {
    font-size: 9px;
    font-weight: 600;
}

/* Card Overlay */
.template-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.template-card-overlay-btn {
    padding: 14px 32px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.template-gallery-card:hover .template-card-overlay-btn {
    transform: translateY(0);
}

/* Card Info */
.template-card-info {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

.template-card-info h3 {
    font-size: 1.25rem;
    margin: 0 0 var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.template-card-info h3 span {
    font-size: 1.5rem;
}

.template-card-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

.template-card-tags {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.template-card-tag {
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Featured Badge */
.template-card-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Back Button */
.template-gallery-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
    transition: color 0.2s;
}

.template-gallery-back:hover {
    color: var(--text-primary);
}

/* Change Template Button (in constructor) */
.change-template-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: var(--space-md);
    width: 100%;
    justify-content: center;
}

.change-template-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .template-gallery-page {
        padding: var(--space-lg) var(--space-md);
    }

    .template-gallery-header h1 {
        font-size: 1.75rem;
    }

    .template-gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .template-card-preview {
        aspect-ratio: 9/12;
    }
}

@media (min-width: 1200px) {
    .template-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}