/* ===== GALLERY — Masonry Grid & Photo Cards ===== */

/* Timeline date headers */
.timeline-group {
    margin-bottom: 32px;
}

.timeline-date {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-date::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Masonry grid */
.masonry-grid {
    columns: 4 280px;
    column-gap: 14px;
}

.photo-card {
    break-inside: avoid;
    margin-bottom: 14px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-light);
}

.photo-card>img:not(.uploader-badge),
.photo-card>video {
    width: 100%;
    display: block;
    transition: transform var(--transition-slow);
}

.photo-card:hover>img:not(.uploader-badge),
.photo-card:hover>video {
    transform: scale(1.03);
}

/* Video play badge */
.video-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    color: #FFF;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
    pointer-events: none;
}

/* Photo overlay (on hover) */
.photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-base);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 14px;
}

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

/* Uploader badge */
.uploader-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2;
    transition: transform var(--transition-fast);
}

.photo-card:hover .uploader-badge {
    transform: scale(1.1);
}

/* Photo actions (in overlay) */
.photo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.photo-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: none;
    color: #FFF;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.photo-action-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.photo-action-btn.favorited {
    color: #FF4D6D;
    background: rgba(255, 77, 109, 0.2);
}

/* Heart burst animation */
.heart-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.heart-burst svg {
    width: 80px;
    height: 80px;
    opacity: 0;
}

.heart-burst.animate svg {
    animation: heartBurst 0.6s ease forwards;
}

@keyframes heartBurst {
    0% {
        opacity: 1;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }

    100% {
        opacity: 0;
        transform: scale(1.6);
    }
}

/* Private indicator */
.private-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(142, 69, 133, 0.85);
    color: #FFF;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* ===== Photo Detail Modal ===== */
.photo-detail-modal .modal {
    max-width: 900px;
    display: flex;
    flex-direction: column;
}

.photo-detail-content {
    display: grid;
    grid-template-columns: 1fr 360px;
    min-height: 500px;
}

.photo-detail-image {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

.photo-detail-image img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.photo-detail-sidebar {
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 80vh;
}

/* Photo meta info */
.photo-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.photo-meta img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.photo-meta-info h4 {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.photo-meta-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Detail action buttons */
.detail-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    background: var(--accent-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.detail-action:hover {
    background: var(--accent-primary);
    color: #FFF;
    border-color: var(--accent-primary);
}

.detail-action.active {
    background: var(--accent-primary);
    color: #FFF;
    border-color: var(--accent-primary);
}

/* Tags section */
.tags-section {
    margin-bottom: 20px;
}

.tags-section h5 {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip {
    padding: 5px 14px;
    background: var(--accent-lighter);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-chip .tag-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.tag-chip .tag-remove:hover {
    color: #E53935;
}

.tag-input-wrap {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.tag-input-wrap input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.82rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.tag-input-wrap input:focus {
    border-color: var(--accent-primary);
}

.tag-input-wrap button {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--accent-primary);
    color: #FFF;
    font-size: 0.82rem;
    font-weight: 500;
}

/* Comments section */
.comments-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.comments-section h5 {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-item {
    display: flex;
    gap: 10px;
}

.comment-item img {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.comment-bubble {
    background: var(--accent-lighter);
    padding: 10px 14px;
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    flex: 1;
}

.comment-bubble .comment-author {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 2px;
}

.comment-bubble .comment-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.comment-bubble .comment-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.comment-input-wrap {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.comment-input-wrap input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.comment-input-wrap input:focus {
    border-color: var(--accent-primary);
}

.comment-input-wrap button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    background: var(--accent-primary);
    color: #FFF;
    font-size: 0.88rem;
    font-weight: 500;
}

.comment-input-wrap button:hover {
    background: var(--accent-hover);
}

/* Add to album section */
.album-select-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.album-select-section select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-body);
    cursor: pointer;
}

/* ── Gallery empty state ── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .photo-detail-content {
        grid-template-columns: 1fr;
    }

    .photo-detail-image {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 40vh;
    }

    .photo-detail-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: none;
    }
}

@media (max-width: 768px) {
    .masonry-grid {
        columns: 2;
        column-gap: 10px;
    }

    .photo-card {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .masonry-grid {
        columns: 2;
        column-gap: 8px;
    }
}

/* iPhone 15 Pro and similar (≤430px) */
@media (max-width: 430px) {
    .photo-detail-modal .modal {
        max-width: 100%;
        max-height: 95vh;
        margin: auto 0 0 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .photo-detail-image {
        max-height: 35vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .photo-detail-sidebar {
        padding: 16px;
    }

    .detail-actions {
        gap: 6px;
    }

    .detail-action {
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    .photo-card {
        margin-bottom: 8px;
        border-radius: var(--radius-sm);
    }

    .uploader-badge {
        width: 26px;
        height: 26px;
        top: 6px;
        right: 6px;
    }

    .empty-state {
        padding: 48px 16px;
    }

    .empty-state .empty-icon {
        font-size: 3rem;
    }

    .empty-state h3 {
        font-size: 1.1rem;
    }
}