/* FindYourTag — Modern CSS */

:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-secondary: #6b7280;
    --color-accent: #0071e3;
    --color-accent-hover: #0062cc;
    --color-accent-light: #e8f4fd;
    --color-border: #e5e7eb;
    --color-border-hover: #d1d5db;
    --color-success: #34c759;
    --color-warning: #ff9f0a;
    --color-tag-bg: #f3f4f6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --container: 1280px;
    --sidebar-width: 280px;
}

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

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text);
}

.logo-icon {
    font-size: 28px;
    color: var(--color-accent);
}

.logo-text {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--color-accent);
}

.tagline {
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Stats Bar */
.stats-bar {
    background: var(--color-accent);
    color: white;
    padding: 10px 0;
    font-size: 13px;
}

.stats-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stat strong {
    font-weight: 700;
}

.stat-sep {
    opacity: 0.5;
}

/* Layout */
.main-content {
    padding: 32px 0 64px;
}

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 32px;
    align-items: start;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-toggle {
    display: none;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    gap: 8px;
    align-items: center;
}

.sidebar-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-label {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-input {
    font-family: var(--font);
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    transition: border-color var(--transition);
    width: 100%;
    outline: none;
}

.filter-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-options.scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition);
    user-select: none;
}

.filter-checkbox:hover {
    background: var(--color-tag-bg);
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--color-accent);
    width: 16px;
    height: 16px;
}

.filter-checkbox .count {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-tag-bg);
    padding: 1px 7px;
    border-radius: 10px;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-input {
    width: 50% !important;
}

.price-sep {
    color: var(--color-text-secondary);
    font-size: 13px;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--color-accent-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.btn-outline:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-block {
    width: 100%;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.result-count {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.sort-select {
    font-family: var(--font);
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    background: var(--color-surface);
    cursor: pointer;
    outline: none;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.view-btn {
    padding: 8px 12px;
    background: var(--color-surface);
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition);
    font-size: 14px;
}

.view-btn.active {
    background: var(--color-accent);
    color: white;
}

.view-btn + .view-btn {
    border-left: 1px solid var(--color-border);
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.filter-tag-remove {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.filter-tag-remove:hover {
    opacity: 1;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-grid.list-view {
    grid-template-columns: 1fr;
}

.loading-spinner {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
    font-size: 16px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.3;
}

/* Product Card */
.product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card.featured {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.product-image {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--color-tag-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.product-image .placeholder-icon {
    font-size: 48px;
    color: var(--color-border);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-featured {
    background: var(--color-accent);
    color: white;
}

.badge-dual {
    background: var(--color-success);
    color: white;
}

.badge-budget {
    background: var(--color-warning);
    color: white;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.product-brand {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-accent);
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.product-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.product-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--color-tag-bg);
    border-radius: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.product-category {
    font-size: 12px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* List View Card */
.list-view .product-card {
    flex-direction: row;
}

.list-view .product-image {
    width: 200px;
    min-width: 200px;
    aspect-ratio: auto;
    height: 160px;
}

.list-view .product-info {
    flex: 1;
}

.list-view .product-footer {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    border-top: none;
    border-left: 1px solid var(--color-border);
    min-width: 140px;
    padding: 16px 20px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--color-tag-bg);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background var(--transition);
}

.modal-close:hover {
    background: var(--color-border);
}

.modal-image {
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--color-tag-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.modal-image img {
    max-width: 60%;
    max-height: 80%;
    object-fit: contain;
}

.modal-image .placeholder-icon {
    font-size: 72px;
    color: var(--color-border);
}

.modal-content {
    padding: 28px;
}

.modal-brand {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-accent);
    margin-bottom: 4px;
}

.modal-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.modal-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 16px;
}

.modal-desc {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
}

.modal-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.spec-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

.spec-value {
    font-size: 14px;
    font-weight: 500;
}

.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Footer */
.site-footer {
    background: var(--color-text);
    color: rgba(255,255,255,0.6);
    padding: 32px 0;
    text-align: center;
    font-size: 13px;
}

.affiliate-disclosure {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-content {
        display: none;
    }

    .sidebar-content.open {
        display: flex;
        margin-top: 12px;
    }

    .header-inner {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .list-view .product-card {
        flex-direction: column;
    }

    .list-view .product-image {
        width: 100%;
        height: 200px;
    }

    .list-view .product-footer {
        flex-direction: row;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .modal-specs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: space-between;
    }
}
