:root {
    --gallery-primary: #2f55d4;
    --gallery-bg: #f8f9fc;
    --gallery-card-bg: #ffffff;
    --gallery-text: #3c4858;
    --gallery-muted: #8492a6;
    --gallery-shadow: 0 10px 25px rgba(60, 72, 88, 0.15);
    --gallery-radius: 12px;
}

.gallery-container {
    padding: 120px 0 80px;
    background: var(--gallery-bg);
    min-height: 100vh;
}

.gallery-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* Sidebar Styling */
.gallery-sidebar {
    background: var(--gallery-card-bg);
    padding: 30px;
    border-radius: var(--gallery-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--gallery-text);
}

.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 12px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gallery-text);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-link:hover, .category-link.active {
    background: rgba(47, 85, 212, 0.1);
    color: var(--gallery-primary);
}

.category-count {
    font-size: 12px;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--gallery-muted);
}

/* Main Content Area */
.gallery-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gallery-card-bg);
    padding: 20px 30px;
    border-radius: var(--gallery-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.search-box {
    display: flex;
    background: #f1f3f9;
    border-radius: 50px;
    padding: 5px 20px;
    width: 400px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    padding: 10px;
    width: 100%;
    font-size: 14px;
}

.search-btn {
    border: none;
    background: transparent;
    color: var(--gallery-muted);
    cursor: pointer;
}

.sort-select {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #e1e7ec;
    outline: none;
    font-size: 14px;
    color: var(--gallery-text);
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.template-card {
    background: var(--gallery-card-bg);
    border-radius: var(--gallery-radius);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 1px solid #f1f3f9;
    display: flex;
    flex-direction: column;
}

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

.card-img-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.template-card:hover .card-img-wrapper img {
    transform: scale(1.1) translateY(-10%);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(47, 85, 212, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-card:hover .card-overlay {
    opacity: 1;
}

.overlay-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-view {
    background: white;
    color: var(--gallery-primary);
}

.btn-use {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.btn-use:hover {
    background: white;
    color: var(--gallery-primary);
}

.card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-badge {
    font-size: 10px;
    background: #eef2ff;
    color: var(--gallery-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 10px;
}

.template-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gallery-text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f1f3f9;
}

.price {
    font-size: 18px;
    font-weight: 800;
    color: var(--gallery-primary);
}

.sold-count {
    font-size: 12px;
    color: var(--gallery-muted);
}

/* Responsive */
@media (max-width: 992px) {
    .gallery-layout {
        grid-template-columns: 1fr;
    }
    .gallery-sidebar {
        display: none; /* Hide sidebar on mobile or move to top */
    }
    .search-box {
        width: 100%;
    }
}
