/* =============================================================================
 * style.css
 * IMGverse Search — Light mode only, Plus Jakarta Sans, premium masonry UI.
 * No dark mode. No framework. Pure CSS columns masonry.
 *
 * @package IMGverse-Search
 * @since   1.0.0
 * ============================================================================= */

/* ---------------------------------------------------------------------------
 * Design tokens
 * --------------------------------------------------------------------------- */
:root {
    --brand-gradient: linear-gradient(135deg, #FF3366 0%, #FF9933 100%);
    --brand:          #FF3366;
    --bg:             #F8F9FA;
    --surface:        #FFFFFF;
    --text-strong:    #09090B;
    --text-base:      #3F3F46;
    --text-muted:     #71717A;
    --border:         rgba(0, 0, 0, 0.08);
    --border-strong:  rgba(0, 0, 0, 0.14);
    --radius-card:    16px;
    --radius-pill:    100px;
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.06);
    --transition:     0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------------------------
 * Reset
 * --------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
 * Base
 * --------------------------------------------------------------------------- */
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text-base);
    min-height: 100vh;
}

/* ---------------------------------------------------------------------------
 * Header — sticky, compact, search embedded
 * --------------------------------------------------------------------------- */
#site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-strong);
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--brand-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* Search form */
#search-form {
    flex: 1;
    max-width: 860px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-wrapper:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255,51,102,0.12);
    background: var(--surface);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 1.1rem;
}

#search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 0.975rem;
    font-weight: 500;
    color: var(--text-strong);
    outline: none;
}

#search-input::placeholder { color: #A1A1AA; }
#search-input::-webkit-search-cancel-button { display: none; }

/* ---------------------------------------------------------------------------
 * Provider filter pills
 * --------------------------------------------------------------------------- */
#filters-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

#filters-bar::-webkit-scrollbar { display: none; }

.filter-pill {
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-base);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.filter-pill:hover {
    border-color: var(--text-strong);
    color: var(--text-strong);
}

.filter-pill.active {
    background: var(--text-strong);
    border-color: var(--text-strong);
    color: #fff;
}

/* ---------------------------------------------------------------------------
 * Orientation filter bar
 * --------------------------------------------------------------------------- */
#orientation-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    background: #FAFAFA;
}

#orientation-bar::-webkit-scrollbar { display: none; }

.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-right: 0.25rem;
}

.orient-pill {
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-base);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--transition);
}

.orient-pill:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.orient-pill.active {
    background: var(--brand-gradient);
    border-color: transparent;
    color: #fff;
}

/* ---------------------------------------------------------------------------
 * Main layout
 * --------------------------------------------------------------------------- */
#main-content {
    padding: 1.5rem 2rem 5rem;
    max-width: 2000px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------------
 * Masonry grid — pure CSS columns
 * --------------------------------------------------------------------------- */
.grid {
    column-count: 2;
    column-gap: 1.25rem;
}

@media (min-width: 768px)  { .grid { column-count: 3; } }
@media (min-width: 1100px) { .grid { column-count: 4; } }
@media (min-width: 1500px) { .grid { column-count: 5; } }
@media (min-width: 1900px) { .grid { column-count: 6; } }

/* ---------------------------------------------------------------------------
 * Image card
 * --------------------------------------------------------------------------- */
.img-card {
    break-inside: avoid;
    margin-bottom: 1.25rem;
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: #E4E4E7;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.img-card img {
    width: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-card:hover img {
    transform: scale(1.03);
}

/* Card hover overlay */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.08) 0%,
        transparent 40%,
        rgba(0,0,0,0.65) 100%);
    opacity: 0;
    transition: opacity 0.22s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

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

.card-top {
    display: flex;
    justify-content: flex-end;
}

.provider-badge {
    background: rgba(255,255,255,0.92);
    color: var(--text-strong);
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transform: translateY(6px);
    transition: transform var(--transition);
}

.img-card:hover .card-bottom { transform: translateY(0); }

.card-credit {
    color: rgba(255,255,255,0.85);
    font-size: 0.75rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-credit a {
    color: inherit;
    text-decoration: none;
}

/* Open-in-tab button */
.btn-open {
    width: 100%;
    padding: 0.7rem;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-open:hover {
    background: #fff;
    color: var(--brand);
}

/* ---------------------------------------------------------------------------
 * Empty state
 * --------------------------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    gap: 1rem;
}

.empty-icon {
    width: 72px;
    height: 72px;
    background: rgba(255,51,102,0.07);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
}

.empty-state h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-strong);
}

.empty-state p {
    color: var(--text-muted);
    max-width: 380px;
    line-height: 1.6;
}

/* ---------------------------------------------------------------------------
 * Loading dots
 * --------------------------------------------------------------------------- */
.loader {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    padding: 2rem;
}

.loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    animation: bounce 0.8s ease-in-out infinite;
}

.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s;  }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%            { transform: scale(1.0); opacity: 1;   }
}

.hidden { display: none !important; }
