* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #f5f5f5;
    color: #333;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-bar {
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.categories {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn.active,
.category-btn:hover {
    background: #667eea;
    color: white;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.template-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    cursor: pointer;
    position: relative;
}

.template-card:hover {
    transform: translateY(-5px);
}

.free-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 10;
}

.price-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 10;
}

.template-image {
    width: 100%;
    height: 200px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border-radius: 8px;
    border: 2px solid #ddd;
    overflow: hidden;
    position: relative;
}

.template-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fallback-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
}

.template-info {
    padding: 1rem;
}

.template-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.template-category {
    color: #667eea;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-btn {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.download-btn:hover {
    background: #5a6fd8;
}

.more-templates-link {
    text-align: center;
    padding: 1rem;
}

.more-templates-link.top {
    margin-bottom: 1rem;
}

.more-templates-link.bottom {
    margin-top: 2rem;
}

.more-templates-link a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
    font-weight: 500;
}

.more-templates-link a:hover {
    background: #5a6fd8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 0 0.5rem;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .categories {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .search-bar input {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    .template-info {
        padding: 0.8rem;
    }
    
    .template-title {
        font-size: 1.1rem;
    }
    
    .more-templates-link a {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .categories {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .category-btn {
        width: 200px;
        text-align: center;
    }
    
    .template-image {
        height: 150px;
    }
    
    .free-tag,
    .price-tag {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}