/* ===========================
   Drive Gallery — Public Styles
   =========================== */

/* --- Layout --- */
.dg-gallery {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
}
.dg-gallery__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.dg-gallery__filters {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.dg-filter-btn {
    padding: .4rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    color: #555;
    transition: all .2s;
}
.dg-filter-btn:hover,
.dg-filter-btn.active {
    border-color: #4f46e5;
    background: #4f46e5;
    color: #fff;
}

/* ── GRID LAYOUT ── */
.dg-gallery__grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1rem;
    align-items: start; /* each cell sizes to its own content height */
}

/* Column definitions — equal-width columns, rows size to content */
.dg-cols-1 { grid-template-columns: repeat(1, 1fr); }
.dg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.dg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.dg-cols-4 { grid-template-columns: repeat(4, 1fr); }
.dg-cols-5 { grid-template-columns: repeat(5, 1fr); }
.dg-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Card styling */
.dg-card {
    background: #fff;
    border: 1px solid #e8e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.dg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(79,70,229,.15);
}

/* Remove fixed aspect ratio so images keep natural proportions */
.dg-card__thumb {
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
    min-height: 140px; /* placeholder until lazy images load — keeps masonry columns stable */
}
.dg-card__thumb img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .4s;
}
.dg-card:hover .dg-card__thumb img {
    transform: scale(1.06);
}

/* Rest of the card styles (unchanged) */
.dg-card__ext {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}
.dg-card__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    backdrop-filter: blur(6px);
}
.dg-card__badge--price {
    background: rgba(79,70,229,.9);
    color: #fff;
}
.dg-card__badge--free {
    background: rgba(34,197,94,.9);
    color: #fff;
}
.dg-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: .35rem;
}
.dg-card__name {
    font-weight: 600;
    font-size: .9rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dg-card__desc {
    font-size: .78rem;
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dg-card__size {
    font-size: .72rem;
    color: #999;
}
.dg-card__actions {
    margin-top: auto;
    padding-top: .75rem;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Buttons (unchanged) */
.dg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: .45rem .85rem;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all .2s;
    line-height: 1;
}
.dg-btn--buy { background: #4f46e5; color: #fff !important; flex: 1; justify-content: center; }
.dg-btn--buy:hover { background: #4338ca; }
.dg-btn--download { background: #6366f1; color: #fff; flex: 1; justify-content: center; font-size: .85rem; letter-spacing: .03em; border-radius: 10px; padding: .55rem 1.1rem; box-shadow: 0 2px 8px rgba(99,102,241,.35); }
.dg-btn--download:hover { background: #4f46e5; box-shadow: 0 4px 14px rgba(99,102,241,.45); transform: translateY(-1px); }
.dg-btn--preview { background: #f3f4f6; color: #333; }
.dg-btn--preview:hover { background: #e5e7eb; }

.dg-card[data-hidden="1"] { display: none; }

/* ── Modal ── */
.dg-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.dg-modal.is-open {
    display: flex;
}
.dg-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
}
.dg-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    width: min(480px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
    z-index: 1;
}
.dg-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background .2s;
}
.dg-modal__close:hover { background: #e5e7eb; }
.dg-modal__header { margin-bottom: 1.25rem; }
.dg-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}
.dg-modal__file-name {
    font-size: .85rem;
    color: #555;
    margin: 0 0 .25rem;
}
.dg-modal__price {
    font-size: 1rem;
    font-weight: 700;
    color: #4f46e5;
    margin: 0;
}
.dg-modal__loading {
    text-align: center;
    padding: 1.5rem 0;
    color: #555;
}
.dg-spinner {
    width: 40px;
    height: 40px;
    animation: dg-spin 1s linear infinite;
    display: block;
    margin: 0 auto .75rem;
}
@keyframes dg-spin { to { transform: rotate(360deg); } }
.dg-modal__success {
    text-align: center;
    padding: 1rem 0;
}
.dg-modal__success h4 {
    font-size: 1.1rem;
    margin: .75rem 0 1rem;
    color: #16a34a;
}
.dg-modal__error {
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: .85rem;
    margin-top: .75rem;
}

/* ── Lightbox ── */
.dg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.dg-lightbox.is-open {
    display: flex;
}
.dg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.82);
}
.dg-lightbox__dialog {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}
.dg-lightbox__close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.dg-lightbox__close:hover { background: rgba(255,255,255,.3); }
.dg-lightbox__title {
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
}
.dg-lightbox__img-wrap {
    position: relative;
    display: inline-block;
}
.dg-lightbox__img {
    display: block;
    max-width: 88vw;
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.dg-lightbox__watermark {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .75rem;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

@media (max-width: 768px) {
    .dg-cols-3, .dg-cols-4, .dg-cols-5, .dg-cols-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .dg-gallery__grid { grid-template-columns: repeat(1, 1fr) !important; }
}
.dg-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.dg-page-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.dg-page-btn.is-active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.dg-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.dg-page-btn:hover:not(:disabled):not(.is-active) {
    background: #f0f0f0;
}

/* --- Pagination --- */
.dg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.dg-page-btn {
    padding: 6px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    color: #555;
    transition: all .2s;
    line-height: 1.4;
}

.dg-page-btn.is-active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.dg-page-btn:hover:not(:disabled):not(.is-active) {
    border-color: #4f46e5;
    color: #4f46e5;
}

.dg-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
/* ══════════════════════════════════════════════════════
   PRODUCT DETAIL POPUP
   ══════════════════════════════════════════════════════ */

/* Hover overlay on card thumbnail */
.dg-card__thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(79, 70, 229, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
.dg-card__thumb:hover .dg-card__thumb-overlay {
    opacity: 1;
}

/* Detail popup container */
.dg-detail {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    align-items: center;
    justify-content: center;
}
.dg-detail.is-open {
    display: flex;
}
.dg-detail__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
}

/* Dialog box */
.dg-detail__dialog {
    position: relative;
    background: #fff;
    border-radius: 20px;
    width: min(860px, 94vw);
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0, 0, 0, .3);
    z-index: 1;
    padding: 2rem;
}

/* Two-column layout: image left, info right */
.dg-detail__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Image side */
.dg-detail__image-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    line-height: 0;
}
.dg-detail__image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 70vh;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.dg-detail__image-watermark {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .5);
    color: #fff;
    font-size: .72rem;
    padding: 3px 12px;
    border-radius: 20px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* Info side */
.dg-detail__info {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    padding-top: .25rem;
}
.dg-detail__badge-wrap {
    margin: 0;
}
.dg-detail__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
    line-height: 1.3;
}
.dg-detail__desc {
    font-size: .88rem;
    color: #555;
    margin: 0;
    line-height: 1.6;
}

/* Meta list (size, format, instant download, secure) */
.dg-detail__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    border-top: 1px solid #f0f0f5;
    padding-top: .85rem;
}
.dg-detail__meta li {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: #444;
}
.dg-detail__meta svg {
    flex-shrink: 0;
    color: #4f46e5;
}

/* Action buttons inside detail popup */
.dg-detail__actions {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-top: .5rem;
}
.dg-detail__buy-btn {
    width: 100%;
    justify-content: center;
    padding: .75rem 1rem;
    font-size: .95rem;
}
.dg-detail__preview-btn {
    width: 100%;
    justify-content: center;
}

/* Mobile: stack to single column */
@media (max-width: 600px) {
    .dg-detail__inner {
        grid-template-columns: 1fr;
    }
    .dg-detail__dialog {
        padding: 1.25rem;
        border-radius: 16px;
    }
    .dg-detail__image {
        max-height: 50vw;
    }
}

/* ── What's Included block ──────────────────────────────────── */
.dg-detail__included {
    margin: 1rem 0 .5rem;
    padding: 1rem 1.1rem;
    background: #f8f8fb;
    border-radius: 10px;
    border: 1px solid #eaecf4;
    font-size: .82rem;
    line-height: 1.6;
    color: #374151;
}
.dg-detail__included h4 {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #111827;
    margin: .9rem 0 .3rem;
}
.dg-detail__included h4:first-child {
    margin-top: 0;
}
.dg-detail__included p {
    margin: .3rem 0;
}
.dg-detail__included ul {
    margin: .4rem 0 .4rem 1.1rem;
    padding: 0;
}
.dg-detail__included ul li {
    margin-bottom: .45rem;
}

/* ── Format Pricing Buttons ─────────────────────────────────────────── */
.dg-format-pricing {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    width: 100%;
    margin-bottom: .5rem;
}
.dg-detail__format-pricing {
    display: none;
}
.dg-detail__format-pricing.is-visible {
    display: flex;
}
.dg-format-pricing .dg-btn {
    width: 100%;
    justify-content: flex-start;
    font-size: .82rem;
    padding: .5rem .75rem;
}
.dg-btn--bundle {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(217,119,6,.35);
}
.dg-btn--bundle:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
}
