/* ==========================================================================
   LH Client Gallery — styles
   Background: #0d0d0d | Modal bg: #161616 | Text: #e8e8e8
   Accent: #169de5 | Error: #e8750a
   ========================================================================== */

/* ── Password-locked modal ──────────────────────────────────────────────── */

.lh-gallery-locked {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    min-height: 100vh;
    background: #0d0d0d;
    padding: 2rem 1rem;
}

.lh-gallery-modal {
    background: #161616;
    border: 1px solid rgba(22, 157, 229, 0.15);
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.lh-gallery-modal__title {
    color: #e8e8e8;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
}

.lh-gallery-modal__subtitle {
    color: rgba(232, 232, 232, 0.55);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 2rem;
}

.lh-gallery-modal__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lh-gallery-modal__input {
    background: #111;
    border: 1px solid rgba(22, 157, 229, 0.3);
    color: #e8e8e8;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.lh-gallery-modal__input:focus {
    border-color: rgba(22, 157, 229, 0.7);
}

.lh-gallery-modal__submit {
    background: #e8750a;
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.lh-gallery-modal__submit:hover {
    opacity: 0.88;
}

.lh-gallery-modal__submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lh-gallery-modal__error {
    color: #e8750a;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    margin: 0;
}

/* ── Gallery page layout ────────────────────────────────────────────────── */

.lh-gallery-page {
    background: #0d0d0d;
    min-height: 100vh;
    padding-top: 80px; /* clear fixed header */
    padding-bottom: 0;
}

.lh-gallery-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2.5rem 2rem 1.5rem;
}

.lh-gallery-page__title {
    color: #e8e8e8;
    font-size: 1.6rem;
    letter-spacing: 0.06em;
    margin: 0;
}

.lh-gallery-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.lh-gallery-download-all {
    background: #e8750a;
    color: #fff;
    border: none;
    padding: 0.65rem 1.4rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lh-gallery-download-all:hover {
    opacity: 0.88;
}

.lh-gallery-download-all:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lh-gallery-select-toggle {
    background: transparent;
    border: 1px solid rgba(22, 157, 229, 0.4);
    color: rgba(232, 232, 232, 0.7);
    padding: 0.65rem 1.4rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lh-gallery-select-toggle:hover,
.lh-gallery-select-toggle.is-active {
    background: rgba(22, 157, 229, 0.12);
    border-color: #169de5;
    color: #e8e8e8;
}

/* ── Sticky selection bar ───────────────────────────────────────────────── */

.lh-selection-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.9rem 2rem;
    background: #161616;
    border-top: 2px solid #169de5;
    z-index: 100;
}

.lh-selection-count {
    color: #e8e8e8;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    flex: 1;
}

.lh-selection-download {
    background: #e8750a;
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lh-selection-download:hover {
    opacity: 0.88;
}

.lh-selection-download:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lh-selection-cancel {
    background: transparent;
    border: 1px solid rgba(232, 232, 232, 0.2);
    color: rgba(232, 232, 232, 0.6);
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.lh-selection-cancel:hover {
    border-color: rgba(232, 232, 232, 0.4);
    color: #e8e8e8;
}

/* ── Masonry grid ───────────────────────────────────────────────────────── */

.lh-gallery__grid {
    padding: 0 2rem 2rem;
    position: relative;
}

/* Isotope sizing elements */
.lh-gallery__sizer,
.lh-gallery__item {
    width: calc(33.333% - 6px);
}

.lh-gallery__gutter {
    width: 8px;
}

.lh-gallery__item {
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.lh-gallery__link {
    display: block;
    line-height: 0;
}

.lh-gallery__img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s;
}

.lh-gallery__img:hover {
    opacity: 0.9;
}

/* Portrait image constraint — never overflow viewport */
.lh-gallery__img {
    max-height: calc(100vh - 120px);
    object-fit: contain;
}

#lh-gallery-grid.is-selecting .lh-gallery__link {
    pointer-events: none; /* Disable lightbox clicks */
}

#lh-gallery-grid.is-selecting .lh-gallery__item {
    cursor: pointer;
}

/* Checkmark indicator */
.lh-gallery__select-indicator {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.4);
    z-index: 2;
    box-sizing: border-box;
}

#lh-gallery-grid.is-selecting .lh-gallery__select-indicator {
    display: block;
}

/* Selected item indicator */
.lh-gallery__item.is-selected .lh-gallery__select-indicator {
    background: #169de5;
    border-color: #169de5;
}

.lh-gallery__item.is-selected .lh-gallery__select-indicator::after {
    content: '';
    display: block;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(3px, 1px);
}

/* Blue border inset on selected items */
.lh-gallery__item.is-selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #169de5;
    pointer-events: none;
    z-index: 1;
}

/* ── Bottom download row ────────────────────────────────────────────────── */

.lh-gallery-footer {
    text-align: center;
    padding: 2rem 0 4rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .lh-gallery__sizer,
    .lh-gallery__item {
        width: calc(50% - 4px);
    }
    .lh-gallery-page__header {
        padding: 2rem 1rem 1rem;
    }
    .lh-gallery__grid {
        padding: 0 1rem 2rem;
    }
    .lh-selection-bar {
        padding: 0.9rem 1rem;
    }
}

@media (max-width: 480px) {
    .lh-gallery__sizer,
    .lh-gallery__item {
        width: 100%;
    }
    .lh-gallery-page__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Download progress bar ──────────────────────────────────────────────── */

.lh-download-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 2rem;
    background: rgba(13, 13, 13, 0.9);
}

.lh-download-progress progress {
    flex: 1;
    max-width: 300px;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 2px;
}

.lh-download-progress progress::-webkit-progress-bar {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.lh-download-progress progress::-webkit-progress-value {
    background: #169de5;
    border-radius: 2px;
    transition: width 0.2s;
}

.lh-download-progress progress::-moz-progress-bar {
    background: #169de5;
    border-radius: 2px;
}

.lh-download-progress__label {
    color: rgba(232,232,232,0.7);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* ── Custom lightbox ────────────────────────────────────────────────────── */

#lh-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.92);
    display: none;
    align-items: center;
    justify-content: center;
}

#lh-lightbox.is-open {
    display: flex;
}

.lh-lightbox__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

.lh-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s;
}

.lh-lightbox__spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #169de5;
    border-radius: 50%;
    animation: lh-spin 0.7s linear infinite;
    display: none;
}

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

.lh-lightbox__close,
.lh-lightbox__prev,
.lh-lightbox__next {
    position: fixed;
    background: none;
    border: none;
    color: rgba(232,232,232,0.8);
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem;
    transition: color 0.2s;
    z-index: 10000;
}

.lh-lightbox__close:hover,
.lh-lightbox__prev:hover,
.lh-lightbox__next:hover {
    color: #fff;
}

.lh-lightbox__close {
    top: 1rem;
    right: 1.5rem;
    font-size: 2.2rem;
}

.lh-lightbox__prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
}

.lh-lightbox__next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
}

.lh-lightbox__counter {
    position: fixed;
    top: 1.2rem;
    left: 1.5rem;
    color: rgba(232,232,232,0.6);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
}

/* ── Galleries index page ───────────────────────────────────────────────── */

.lh-galleries-index {
    background: #0d0d0d;
    min-height: 100vh;
    padding-top: 100px;
    padding-bottom: 4rem;
}

.lh-galleries-index__title {
    color: #e8e8e8;
    font-size: 1.8rem;
    letter-spacing: 0.06em;
    margin: 0 0 2rem;
    padding: 0 2rem;
}

.lh-galleries-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 0 2rem;
}

.lh-gallery-card {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: block;
    text-decoration: none;
}

.lh-gallery-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.lh-gallery-card:hover .lh-gallery-card__img {
    transform: scale(1.04);
}

.lh-gallery-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.75) 100%);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.lh-gallery-card__title {
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.lh-gallery-card__lock {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    background: #169de5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .lh-galleries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lh-galleries-grid {
        padding: 0 1rem;
    }
    .lh-galleries-index__title {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .lh-galleries-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Gallery search ─────────────────────────────────────────────────────── */

.lh-galleries-search {
    padding: 0 2rem 1.8rem;
}

.lh-galleries-search__input {
    width: 100%;
    max-width: 420px;
    background: #161616;
    border: 1px solid rgba(22, 157, 229, 0.25);
    border-radius: 3px;
    color: #e8e8e8;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.lh-galleries-search__input::placeholder {
    color: rgba(232, 232, 232, 0.3);
}

.lh-galleries-search__input:focus {
    border-color: #169de5;
}

/* Cancel button (shown by browser in search inputs) */
.lh-galleries-search__input::-webkit-search-cancel-button {
    filter: invert(1) opacity(0.4);
    cursor: pointer;
}

.lh-galleries-no-results {
    color: rgba(232, 232, 232, 0.45);
    padding: 0 2rem;
    font-size: 0.95rem;
}

.lh-galleries-no-results[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .lh-galleries-search {
        padding: 0 1rem 1.5rem;
    }
    .lh-galleries-search__input {
        max-width: 100%;
    }
}
