/**
 * Client Gallery Portal — Front-end Styles (mobile-first)
 */

/* ── Layout ───────────────────────────────────────────────────────── */

.cgp-page-wrap {
    width: 80%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.cgp-page-wrap * {
    box-sizing: border-box;
}

/* ── Gallery nav ─────────────────────────────────────────────────── */

.cgp-gallery-nav {
    margin-bottom: 20px;
}

.cgp-back-link {
    color: #2271b1;
    text-decoration: none;
    font-size: 14px;
}

.cgp-back-link:hover {
    text-decoration: underline;
}

/* ── Main ─────────────────────────────────────────────────────────── */

.cgp-main h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 20px;
    color: #111;
}

/* ── Empty State ──────────────────────────────────────────────────── */

.cgp-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

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

.cgp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.cgp-btn:hover {
    background: #135e96;
    color: #fff;
}

.cgp-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.cgp-btn-icon {
    font-size: 18px;
    line-height: 1;
}

.cgp-btn-download-all {
    flex-shrink: 0;
}

/* ── Dashboard Card Grid ──────────────────────────────────────────── */

.cgp-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 40px;
}

@media (min-width: 600px) {
    .cgp-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .cgp-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.cgp-property-card {
    display: block;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
}

.cgp-property-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.cgp-card-thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e5e7eb;
}

.cgp-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cgp-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 48px;
}

.cgp-card-body {
    padding: 14px 16px;
}

.cgp-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #111;
}

.cgp-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
}

/* ── Gallery Header ───────────────────────────────────────────────── */

.cgp-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cgp-gallery-header h1 {
    margin-bottom: 4px;
}

.cgp-gallery-count {
    color: #6b7280;
    font-size: 15px;
    margin: 0;
}

/* ── Gallery Grid ─────────────────────────────────────────────────── */

.cgp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 40px;
}

@media (min-width: 600px) {
    .cgp-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (min-width: 900px) {
    .cgp-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

.cgp-gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    background: #e5e7eb;
    transition: opacity 0.2s;
}

.cgp-gallery-item:hover {
    opacity: 0.85;
}

.cgp-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Gallery Video Items ──────────────────────────────────────────── */

.cgp-gallery-item-video {
    position: relative;
}

.cgp-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 3px;
    pointer-events: none;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cgp-gallery-item-video:hover .cgp-play-overlay {
    background: rgba(0,0,0,0.75);
}

/* ── Lightbox ─────────────────────────────────────────────────────── */

.cgp-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
}

.cgp-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
}

.cgp-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cgp-lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.cgp-lightbox-close:hover {
    opacity: 1;
}

.cgp-lightbox-prev,
.cgp-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    z-index: 10;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
}

.cgp-lightbox-prev:hover,
.cgp-lightbox-next:hover {
    opacity: 1;
}

.cgp-lightbox-prev {
    left: 8px;
}

.cgp-lightbox-next {
    right: 8px;
}

@media (min-width: 600px) {
    .cgp-lightbox-prev {
        left: 20px;
    }
    .cgp-lightbox-next {
        right: 20px;
    }
}

.cgp-lightbox-image-wrap {
    max-width: 90vw;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cgp-lightbox-image-wrap img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
}

.cgp-lightbox-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    z-index: 10;
    flex-wrap: wrap;
    justify-content: center;
}

#cgp-lightbox-filename {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

/* ── Responsive tweaks ────────────────────────────────────────────── */

@media (max-width: 599px) {
    .cgp-header {
        padding: 12px 0;
        margin-bottom: 16px;
    }

    .cgp-header-logo {
        max-height: 32px;
    }

    .cgp-main h1 {
        font-size: 18px;
    }

    .cgp-gallery-header {
        flex-direction: column;
    }

    .cgp-btn-download-all {
        width: 100%;
        justify-content: center;
    }

    .cgp-lightbox-prev,
    .cgp-lightbox-next {
        font-size: 36px;
    }

    .cgp-lightbox-footer {
        padding: 0 16px;
    }
}
