/* --- ADVANCED SEARCH PAGE --- */

/* Page Title */
.search-page-title {
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--c-text);
    margin: 2.5rem 0 2rem;
    letter-spacing: -0.5px;
}

/* Search Bar */
.search-bar {
    max-width: 650px;
    margin: 0 auto 2.5rem;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--c-border);
}
.search-bar-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    font-family: var(--font-main);
    color: var(--c-text);
    outline: none;
    min-width: 0;
}
.search-bar-input::placeholder {
    color: #94a3b8;
}
.search-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #374151;
    color: #fff;
    border: none;
    padding: 0.7rem 1.6rem;
    margin: 0.35rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.search-bar-btn:hover {
    background: #1f2937;
}
.search-bar-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Color Palette Section */
.palette-section {
    max-width: 750px;
    margin: 0 auto 3rem;
    text-align: center;
}
.palette-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 0 0 1rem;
}

/* Color Matrix Grid */
.color-matrix {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    border-radius: 8px;
    overflow: hidden;
}
.color-swatch {
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s, z-index 0s 0.2s;
    border: none;
}
.color-swatch:hover {
    transform: scale(1.4);
    z-index: 10;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 4px 12px rgba(0,0,0,0.25);
    border-radius: 3px;
    transition: transform 0.2s, box-shadow 0.2s, z-index 0s;
}
.color-swatch.active {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 0 0 3px var(--c-text), 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 3px;
}
.color-swatch.active::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* Fix visibility on light swatches */
.color-swatch[data-color="White"].active::after,
.color-swatch[data-color="Yellow"].active::after {
    color: #000;
    text-shadow: none;
}

/* Results Section */
.results-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 0 0 1.5rem;
}

.results-area {
    min-height: 300px;
    padding-bottom: 3rem;
}

.res-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    opacity: 1;
    transition: opacity 0.3s;
}
.res-grid.loading {
    opacity: 0.4;
    pointer-events: none;
}

/* Result Card */
.res-card {
    background: #dfe4ea;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: var(--c-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
}
.res-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.res-img-wrap {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 12px;
    background: #f1f5f9;
    margin-bottom: 0.75rem;
}
.res-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}
.res-card:hover .res-img {
    transform: scale(1.05);
}

.res-body {
    text-align: center;
    width: 100%;
}
.res-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.res-desc {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

/* Loader */
.loader {
    display: none;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--c-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 3rem auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.no-res {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--c-text-muted);
    grid-column: 1 / -1;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .res-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .res-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .color-matrix {
        grid-template-columns: repeat(10, 1fr);
    }
    .search-page-title {
        margin: 2rem 0 1.5rem;
    }
}
@media (max-width: 480px) {
    .res-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .color-matrix {
        grid-template-columns: repeat(8, 1fr);
    }
    .search-bar {
        border-radius: 16px;
    }
    .search-bar-btn {
        border-radius: 12px;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    .res-card {
        padding: 0.75rem 0.75rem 0.75rem;
        border-radius: 12px;
    }
}
