/* ── SD Photos ─────────────────────────────────────────────
   Photo gallery, upload, and private photo styles.
   ───────────────────────────────────────────────────────── */

/* ── Photo Gallery Grid (profile view) ───────────────────── */
.sd-photos__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.sd-photos__item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: var(--sd-bg-light, #f5f5f5);
}

.sd-photos__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.sd-photos__item:hover img {
    transform: scale(1.05);
}

/* ── Profile Edit Photo Grid (2+4 bento layout) ──────────── */
.sd-photos__edit-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    gap: 4px;
    margin-bottom: 24px;
}

.sd-photos__edit-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    background: var(--sd-bg-light, #f5f5f5);
    cursor: pointer;
}

.sd-photos__edit-item:first-child {
    grid-row: 1 / 3;
    aspect-ratio: auto;
}

.sd-photos__edit-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sd-photos__edit-item--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    color: #999;
    font-size: 28px;
    transition: border-color 0.2s;
}

.sd-photos__edit-item--empty:hover {
    border-color: var(--sd-primary, #ff4081);
    color: var(--sd-primary, #ff4081);
}

/* Photo number badge */
.sd-photos__badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* ── Private Photo Overlay ────────────────────────────────── */
.sd-photos__item--private {
    position: relative;
}

.sd-photos__item--private img {
    filter: blur(15px);
}

.sd-photos__lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(128, 0, 255, 0.3);
    border-radius: 12px;
}

.sd-photos__lock-icon {
    width: 56px;
    height: 56px;
    background: rgba(128, 0, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sd-photos__lock-icon svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* ── Photo Actions (overlay on edit) ─────────────────────── */
.sd-photos__actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
}

.sd-photos__edit-item:hover .sd-photos__actions {
    display: flex;
}

.sd-photos__action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.sd-photos__action-btn:hover {
    transform: scale(1.1);
}

.sd-photos__action-btn--delete {
    background: rgba(244, 67, 54, 0.9);
    color: white;
}

/* ── Upload Overlay ──────────────────────────────────────── */
.sd-photos__upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.sd-photos__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: var(--sd-primary, #ff4081);
    border-radius: 50%;
    animation: sd-spin 0.6s linear infinite;
}

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

/* ── Upload Input (hidden) ───────────────────────────────── */
.sd-photos__upload-input {
    display: none;
}

/* ── Photo Lightbox ──────────────────────────────────────── */
.sd-photos__lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sd-photos__lightbox--visible {
    opacity: 1;
}

.sd-photos__lightbox img {
    max-width: calc(100% - 120px);
    max-height: calc(100% - 100px);
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}

.sd-photos__lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    z-index: 2;
}

.sd-photos__lightbox-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.sd-photos__lightbox-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sd-photos__lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sd-photos__lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.sd-photos__lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.sd-photos__lightbox-prev {
    left: 16px;
}

.sd-photos__lightbox-next {
    right: 16px;
}

@media (max-width: 768px) {
    .sd-photos__lightbox img {
        max-width: 100%;
        max-height: calc(100% - 80px);
        border-radius: 0;
    }

    .sd-photos__lightbox-arrow {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.15);
    }

    .sd-photos__lightbox-prev { left: 8px; }
    .sd-photos__lightbox-next { right: 8px; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sd-photos__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }

    .sd-photos__item {
        border-radius: 4px;
    }

    .sd-photos__edit-grid {
        gap: 3px;
    }

    .sd-photos__edit-item {
        border-radius: 8px;
    }
}
