/* Colorlib Template Switcher - Modern CSS */
/* Updated 2026 - No external dependencies */

/* CSS Variables */
:root {
    --color-primary: #E66346;
    --color-primary-light: #F37054;
    --color-bg-dark: #333;
    --color-bg-darker: #222;
    --color-bg-body: #727272;
    --color-bg-carousel: #3A3A3A;
    --color-text-muted: #9B9B9B;
    --color-purchase: #7AC64D;
    --color-border: #444;
    --header-height: 60px;
    --grid-height: 340px;
    --product-width: 200px;
    --product-height: 130px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg-body);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header Bar */
.switcher-bar {
    display: flex;
    align-items: center;
    background: var(--color-bg-dark);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
    position: relative;
    z-index: 22;
}

/* Logo */
.logo {
    border-right: 1px solid var(--color-border);
    height: 100%;
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 100%;
}

.logo img {
    height: 30px;
    width: auto;
}

/* Header Buttons */
.header-buttons {
    display: flex;
    margin-left: auto;
}

.header-btn {
    position: relative;
}

.header-btn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-left: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: background 0.2s, color 0.2s;
}

.header-btn a:hover {
    background: var(--color-bg-darker);
    color: #fff;
}

.header-btn a svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.purchase-btn {
    background: var(--color-purchase);
}

.purchase-btn a {
    border: none;
    color: #fff;
}

.remove-btn a {
    border: none;
}

/* Viewport Buttons */
@media (max-width: 767px) {
    .desktop-btn,
    .tablet-btn,
    .mobile-btn {
        display: none;
    }
}

.viewport-disabled .desktop-btn,
.viewport-disabled .tablet-btn,
.viewport-disabled .mobile-btn {
    opacity: 0;
    visibility: hidden;
}

/* Product Switcher Button */
.product-switcher {
    background: var(--color-bg-darker);
    height: 100%;
    display: flex;
    align-items: center;
}

.product-switcher a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 40px;
    height: 100%;
    color: var(--color-text-muted);
    font-size: 16px;
    text-transform: uppercase;
}

.product-switcher a::before {
    content: '+';
    font-size: 20px;
}

.product-switcher .badge {
    display: none;
}

@media (max-width: 550px) {
    .product-switcher {
        display: none;
    }
}

/* Badge */
.badge {
    display: inline-block;
    background: linear-gradient(to bottom, var(--color-primary-light), var(--color-primary));
    border: 1px solid #C94F33;
    border-radius: 2px;
    color: #fff;
    font-size: 10px;
    font-weight: 300;
    padding: 3px 7px;
}

/* Full-Screen Modal Overlay */
.switcher-body {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
}

.toggle .switcher-body {
    opacity: 1;
    visibility: visible;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--color-bg-dark);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 400;
}

.modal-header .template-count {
    color: var(--color-text-muted);
    font-size: 14px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-close svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Filter Bar */
.filter-bar {
    background: var(--color-bg-darker);
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border);
}

/* Search Box */
.search-box {
    padding: 15px 20px 10px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: var(--color-bg-dark);
    color: #fff;
    font-size: 16px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--color-text-muted);
}

.search-box input:focus {
    border-color: var(--color-primary);
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 15px;
    max-height: 90px;
    overflow-y: auto;
}

.category-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: var(--color-primary);
    color: #fff;
}

.category-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.category-btn .count {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 11px;
}

.category-btn.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* Products Grid Container */
.products-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--color-bg-dark);
}

.products-wrapper::-webkit-scrollbar {
    width: 10px;
}

.products-wrapper::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
}

.products-wrapper::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 5px;
}

.products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Product Card */
.product {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.product.hidden {
    display: none;
}

/* Lazy load placeholder */
.product img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--color-bg-carousel);
    transition: opacity 0.3s;
}

.product img[data-src] {
    opacity: 0;
}

.product img.loaded {
    opacity: 1;
}

.product .title {
    display: block;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    padding: 10px;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product .badge {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* No results message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 18px;
    padding: 40px;
}

/* Product Iframe */
.product-iframe {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    max-width: 100%;
    border: none;
    transition: width 0.3s ease;
}

/* Preloader */
.preloader {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.preloader-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    background: linear-gradient(to bottom, var(--color-primary-light), var(--color-primary));
    border: 1px solid #C94F33;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.preloader-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Dark Theme */
body.dark {
    background: #1B1B1B;
}

.dark .switcher-bar {
    background: #1B1B1B;
}

.dark .switcher-bar,
.dark .logo,
.dark .header-btn a {
    border-color: #000;
}
