/* gallery/css/gallery.css */

/* ── Page wrapper ────────────────────────────────────────── */
.gallery_page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.gallery_header {
    border-bottom: 1px solid var(--container_border_light, #e2e8f0);
    padding-bottom: 0.75rem;
}

/* ── Public album grid ───────────────────────────────────── */
.gallery_album_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.gallery_album_card {
    display: block;
    border-radius: var(--base_radius_md, 10px);
    overflow: hidden;
    background: var(--card_bg, #fff);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.gallery_album_card:hover {
    transform: translateY(-2px);
    box-shadow: var(--container_shadow_md, 0 4px 16px rgba(0,0,0,.15));
}

.gallery_album_thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--grid_item_bg_1, #f3f4f6);
}

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

.gallery_album_count {
    position: absolute;
    bottom: 6px; right: 8px;
    font-size: 0.72rem;
    background: rgba(0,0,0,.6);
    color: #fff;
    padding: 2px 7px;
    border-radius: 99px;
}

.gallery_album_buddies_badge {
    position: absolute;
    top: 6px; left: 8px;
    font-size: 0.72rem;
    background: rgba(37,99,235,.75);
    color: #fff;
    padding: 2px 7px;
    border-radius: 99px;
    display: flex; align-items: center; gap: 3px;
}

/* ── Album page sidebar + grid layout ───────────────────── */
.gallery_album_layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.gallery_album_sidebar {
    width: 200px;
    flex-shrink: 0;
    padding: 0.75rem !important;
}

.gallery_album_grid_panel {
    flex: 1;
    min-width: 0;
}

.gallery_album_sidebar_link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    padding: 0.4rem 0.5rem;
    border-radius: var(--base_radius_sm, 6px);
    transition: background 0.12s;
}

.gallery_album_sidebar_link:hover,
.gallery_album_sidebar_link.is_active {
    background: var(--grid_item_bg_1, #f3f4f6);
}

.gallery_album_sidebar_link.is_active {
    font-weight: 600;
}

.gallery_album_sidebar_thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--base_radius_sm, 4px);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--grid_item_bg_1, #f3f4f6);
    border: 1px solid var(--container_border_light, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gallery_album_sidebar_info {
    flex: 1;
    min-width: 0;
}

@media (max-width: 640px) {
    .gallery_album_layout { flex-direction: column; }
    .gallery_album_sidebar { width: 100%; }
}

/* ── Single-album image grid ─────────────────────────────── */
.gallery_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.gallery_grid_item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--base_radius_sm, 6px);
    background: var(--grid_item_bg_1, #f3f4f6);
    border: 1px solid var(--container_border_light, #e2e8f0);
    cursor: pointer;
}

.gallery_grid_item img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.2s ease;
}

.gallery_grid_item:hover img { transform: scale(1.04); }

.gallery_grid_caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    color: #fff;
    font-size: 0.72rem;
    padding: 1rem 0.5rem 0.4rem;
    line-height: 1.3;
    pointer-events: none;
}

/* ── Lightbox ────────────────────────────────────────────── */
.gallery_lightbox {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.92);
    align-items: center; justify-content: center; flex-direction: column;
}

.gallery_lightbox.is_open { display: flex; }

.gallery_lb_inner {
    display: flex; flex-direction: column; align-items: center;
    max-width: 90vw; max-height: 90vh;
}

.gallery_lb_img {
    max-width: 100%; max-height: 80vh;
    object-fit: contain; border-radius: 4px; display: block;
}

.gallery_lb_caption {
    color: #ddd; font-size: 0.85rem;
    margin-top: 0.6rem; text-align: center; max-width: 600px;
}

.gallery_lb_counter { color: #888; font-size: 0.75rem; margin-top: 0.3rem; }

.gallery_lb_close,
.gallery_lb_prev,
.gallery_lb_next {
    position: fixed; background: transparent; border: none;
    color: #fff; cursor: pointer; font-size: 2rem; line-height: 1;
    padding: 0.5rem; opacity: 0.7; transition: opacity 0.15s; z-index: 1001;
}

.gallery_lb_close:hover,
.gallery_lb_prev:hover,
.gallery_lb_next:hover { opacity: 1; }

.gallery_lb_close { top: 1rem; right: 1.25rem; font-size: 2.2rem; }
.gallery_lb_prev  { top: 50%; left: 1rem;  transform: translateY(-50%); font-size: 3rem; }
.gallery_lb_next  { top: 50%; right: 1rem; transform: translateY(-50%); font-size: 3rem; }

/* ── Profile page gallery widget ────────────────────────── */
.gallery_profile_widget {
    text-align: left;
}

.gallery_profile_widget_header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.gallery_profile_widget_card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--base_radius_sm, 6px);
    overflow: hidden;
    border: 1px solid var(--container_border_light, #e2e8f0);
    transition: box-shadow 0.15s ease;
}

.gallery_profile_widget_card:hover {
    box-shadow: var(--container_shadow_md, 0 4px 16px rgba(0,0,0,.12));
}

.gallery_profile_widget_thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--grid_item_bg_1, #f3f4f6);
    overflow: hidden;
}

.gallery_profile_widget_thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.2s ease;
}
.gallery_profile_widget_card:hover .gallery_profile_widget_thumb img {
    transform: scale(1.03);
}

.gallery_profile_widget_empty_thumb {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.gallery_profile_widget_empty_thumb .material-symbols-outlined { font-size: 2rem; }

.gallery_profile_widget_badge {
    position: absolute;
    top: 6px; left: 6px;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 99px;
    color: #fff;
}
.gallery_profile_widget_badge_buddies   { background: rgba(37,99,235,.8); }
.gallery_profile_widget_badge_followers { background: rgba(22,163,74,.8); }
.gallery_profile_widget_badge_draft     { background: rgba(0,0,0,.5); }

.gallery_profile_widget_info {
    padding: 0.45rem 0.6rem 0.5rem;
}

.gallery_profile_widget_title {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery_profile_widget_count {
    font-size: 0.75rem;
    margin-top: 2px;
}

/* ── Lightbox actions (like + report) ───────────────────── */
.gallery_lb_actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.65rem;
}

.gallery_lb_like_btn,
.gallery_lb_report_btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 99px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 0.28rem 0.75rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 1;
}

.gallery_lb_like_btn .material-symbols-outlined,
.gallery_lb_report_btn .material-symbols-outlined {
    font-size: 1.15rem;
    /* outlined (unfilled) by default */
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    transition: font-variation-settings 0.15s, color 0.15s;
}

.gallery_lb_like_btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,.5);
}

/* Liked state — fill the heart red */
.gallery_lb_like_btn.is_liked {
    color: #ef4444;
    border-color: rgba(239,68,68,.5);
}
.gallery_lb_like_btn.is_liked .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    color: #ef4444;
}

/* Guest (not logged in) — slightly dimmer */
.gallery_lb_like_btn.lb_like_guest {
    opacity: 0.55;
}

.gallery_lb_report_btn:hover,
.gallery_lb_report_btn.is_active {
    color: #fbbf24;
    border-color: rgba(251,191,36,.45);
}

.gallery_lb_reported_label {
    font-size: 0.8rem;
    color: #9ca3af;
    padding: 0.28rem 0.5rem;
}

/* ── Lightbox report panel — centered fixed overlay ─────── */
.gallery_lb_report_panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    width: 90%;
    max-width: 440px;
    background: #1c1c2e;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--base_radius_md, 10px);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
}

.gallery_lb_report_panel textarea {
    width: 100%;
    min-height: 90px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 0.88rem;
    padding: 0.5rem 0.65rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
.gallery_lb_report_panel textarea::placeholder { color: #6b7280; }
.gallery_lb_report_panel textarea:focus { border-color: rgba(255,255,255,.45); }

/* ── Admin two-column layout ─────────────────────────────── */
.gallery_admin_layout {
    display: flex; gap: 0.75rem; align-items: flex-start; width: 100%;
}

.gallery_admin_sidebar { width: 240px; flex-shrink: 0; padding: 0.75rem !important; }
.gallery_admin_content  { flex: 1; min-width: 0; }

/* ── Album sidebar list ──────────────────────────────────── */
.gallery_album_list { list-style: none; padding: 0; margin: 0; }

.gallery_album_list_item {
    padding: 0.5rem 0.6rem;
    border-radius: var(--base_radius_sm, 6px);
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}

.gallery_album_list_item:hover,
.gallery_album_list_item.is_active { background: var(--grid_item_bg_1, #f3f4f6); }

.gallery_album_list_item > a {
    flex: 1; min-width: 0; text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
}

.gallery_album_list_title {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem;
}

.gallery_album_list_actions { display: flex; gap: 2px; flex-shrink: 0; }

/* ── Admin thumbnail grid ────────────────────────────────── */
.gallery_admin_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.gallery_admin_thumb {
    position: relative; aspect-ratio: 1;
    border-radius: var(--base_radius_sm, 6px); overflow: hidden;
    background: var(--grid_item_bg_1, #f3f4f6);
    border: 2px solid var(--container_border_light, #e2e8f0);
    cursor: pointer;
}

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

.gallery_admin_thumb_actions {
    position: absolute; top: 4px; right: 4px;
    display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s;
}

.gallery_admin_thumb:hover .gallery_admin_thumb_actions { opacity: 1; }

.gallery_admin_thumb_caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.6); color: #eee; font-size: 0.7rem;
    padding: 0.25rem 0.4rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Upload progress ─────────────────────────────────────── */
.gallery_upload_progress {
    font-size: 0.85rem; color: var(--special_text_muted, #888); margin-bottom: 1rem;
}

/* ── Modal overlay (backdrop) ────────────────────────────── */
.modal_overlay {
    position: fixed; inset: 0; z-index: 1010;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
}

.modal_overlay[hidden] { display: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .gallery_admin_layout  { flex-direction: column; }
    .gallery_admin_sidebar { width: 100%; }
    .gallery_grid          { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .gallery_album_grid    { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
