/* ─── CSS Variables ─── */
:root {
    --bg: #f2f2f2;
    --black: #000000;
    --white: #ffffff;
    --text: #1a1a2e;
    --text-light: #555;
    --text-muted: #888;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --primary: #007aff;
    --primary-hover: #005bb5;
    --danger: #e74c3c;
    --danger-bg: #ffe0e0;
    --danger-hover: #ffcccc;
    --success: #28a745;
    --success-hover: #218838;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 30px;
    --padding-sm: 6px;
    --padding-md: 12px;
    --padding-lg: 20px;
    --font-sm: 12px;
    --font-md: 14px;
    --font-lg: 16px;
    --font-xl: 18px;
    --font-xxl: 24px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.10);
}

/* ─── Reset ─── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    width: 100%;
    overflow-x: hidden;
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
input, textarea, select, button {
    font-family: inherit;
    font-size: 16px !important;
    touch-action: manipulation;
}
button { cursor: pointer; background: none; border: none; }
a { text-decoration: none; color: var(--primary); }

/* ─── Drawer Container ─── */
.drawer-container {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    width: 100%;
}

/* ─── Main Content ─── */
.app-shell {
    max-width: 100vw;
    box-sizing: border-box;
    background: var(--bg);
    min-height: 100vh;
}
.drawer-container.side-open .app-shell {
    transform: translateX(-100%);
}

/* ─── Side Panel ─── */
.side-panel {
    background: var(--bg);
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--black);
    box-shadow: -4px 0 20px rgba(0,0,0,0.10);
    padding: 16px 20px 20px 20px;
    box-sizing: border-box;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 9999;
}
.drawer-container.side-open .side-panel {
    background: var(--bg);
    transform: translateX(0);
}

.side-panel .side-close {
    position: fixed;
    top: 1rem;
    float: left;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
    z-index: 10;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
}
.side-panel .side-close:hover {
    background: rgba(0,0,0,0.05);
}
.side-panel .side-close svg {
    width: 24px;
    height: 24px;
}
#side-panel-content {
    clear: both;
}

/* ─── Top Bar ─── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--white);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}
.top-bar h1 {
    font-size: var(--font-xxl);
    font-weight: 700;
    color: var(--text);
}
.user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar-link {
    padding: 0;
    cursor: pointer;
}
.top-bar .username { display: none; }

.text-btn {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--font-md);
    color: var(--text);
    background: var(--border-light);
    cursor: pointer;
    border: none;
}
.text-btn:hover { background: #e0e0e0; }

.notif-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--border-light);
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--font-md);
    cursor: pointer;
    color: var(--text);
}
.notif-btn:hover { background: #e0e0e0; }
.notif-btn svg { width: 20px; height: 20px; }

/* ─── Hero Section ─── */
.hero-section {
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    padding: 40px 20px 30px 20px;
    color: #fff;
    position: relative;
    min-height: 200px;
}
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px;
    text-align: center;
}
.hero-avatar-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.hero-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
}
.avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 50%;
    padding: 4px;
    font-size: 14px;
}
.hero-text h2 {
    font-size: var(--font-xl);
    font-weight: 600;
}
.hero-text p {
    font-size: var(--font-md);
    opacity: 0.9;
}
.cover-upload-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: absolute;
    right: 16px;
    top: 16px;
}
.hero-moods {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}
.mood-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px 4px 8px;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.mood-checkbox input {
    display: none;
}
.mood-checkbox .mood-emoji {
    font-size: 18px;
}
.mood-checkbox .mood-label {
    color: #fff;
}
.mood-checkbox:has(input:checked) {
    background: rgba(255,255,255,0.35);
}
.clear-mood-btn {
    margin-top: 8px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255,255,255,0.2);
}

/* ─── Everyone's Mood ─── */
.dharan-mood h3 {
    font-size: var(--font-md);
    color: var(--text-light);
    margin-bottom: 10px;
}
.mood-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
}
.mood-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-pill);
    cursor: pointer;
}
.mood-item .mood-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.mood-item .mood-emoji {
    font-size: 14px;
}
.mood-item .mood-label {
    font-size: var(--font-sm);
    color: var(--text-light);
}
.no-moods {
    color: var(--text-muted);
    font-size: var(--font-sm);
    padding: 10px 0;
}

/* ─── Feed Grid ─── */
.feed-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 16px 80px 16px;
    max-width: 100%;
    margin: 0 auto;
}
.grid-item {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow);
}
.grid-item img {
    width: 100%;
    display: block;
    height: auto;
}
.grid-item svg {
    width: 18px;
    height: 18px;
}
 
/* ─── Pin User Row ─── */
.pin-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px 14px;
}
.pin-user-row .pin-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}
.pin-user-name {
    font-size: var(--font-sm);
    color: var(--text-light);
    font-weight: 500;
}
.flair-badge {
    display: inline-block;
    background: var(--border-light);
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-left: auto;
}

/* ─── Pin Info ─── */
.pin-info {
    padding: 0 14px 14px 14px;
}
.pin-caption {
    font-size: var(--font-sm);
    color: var(--text-light);
    margin: 6px 0 10px 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pin-details {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 10px 0;
    flex-wrap: wrap;
}
.price {
    font-weight: 700;
    color: var(--text);
    font-size: var(--font-lg);
}
.price cite {
    font-style: normal;
    font-size: var(--font-sm);
    font-weight: 400;
    color: var(--text-muted);
}
.condition-badge,
.property-type-badge {
    background: var(--border-light);
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    text-transform: capitalize;
}
.property-type-badge {
    background: #e0f7fa;
    color: #006064;
}

.text-only-pin {
    padding: var(--padding-lg);
    font-size: 1.1rem;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ─── Quick Mood ─── */
.quick-mood-content {
    text-align: center;
    padding: 30px 16px 16px 16px;
}
.mood-emoji-big {
    font-size: 56px;
    display: block;
}
.mood-title {
    font-size: 24px;
    font-weight: 700;
    margin: 4px 0 2px 0;
}
.mood-time {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: lowercase;
}
.mood-user {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-light);
    margin-top: 4px;
}

/* ─── Pin Actions ─── */
  
/* ─── Pin Actions ─── */
.pin-actions {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

/* Wrap left and right groups to keep them on opposite sides */
.pin-actions .action-group-left,
.pin-actions .action-group-right {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* All buttons and links inside pin-actions */
.pin-actions button,
.pin-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    min-height: 34px;
    border: none;
    border-radius: var(--radius-pill, 30px);
    font-size: var(--font-sm, 13px);
    background: var(--border-light, #f0f0f0);
    color: var(--text, #333);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

/* Specific overrides */
.pin-actions .call-btn {
    background: var(--success, #28a745);
    color: #fff;
}
.pin-actions .map-link {
    background: #e2deff;
}
.pin-actions .like-btn {
    background: var(--border-light, #f0f0f0);
}
.pin-actions .like-btn.liked {
    background: #ffe0e6;
    color: #e91e63;
}
.pin-actions .like-btn.liked svg,
.pin-actions .like-btn.liked svg path
{fill: #e91e63;}
.pin-actions .delete-btn {
    background: var(--danger-bg, #ffe0e0);
    color: var(--danger, #e74c3c);
}
.pin-actions .comments-btn {
    background: var(--border-light, #f0f0f0);
}

/* Disabled state */
.pin-actions .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* SVG sizing */
.pin-actions svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
/* ─── Photo Scroll (to-let) ─── */
.photo-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.photo-scroll img {
    flex: 0 0 100%;
    scroll-snap-align: start;
    object-fit: cover;
    display: block;
    width: 100%;
}

/* ─── Video Embed ─── */
.video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
}
.video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.external-link a {
    display: inline-block;
    margin: 8px 0;
    color: var(--primary);
}

/* ─── Load More Sentinel ─── */
.load-more-sentinel {
    height: 1px;            /* tiny but visible to the Intersection Observer */
    width: 100%;
    opacity: 0;
    pointer-events: none;
    /* no visibility:hidden */
}
/* ─── Modals ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(6px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.modal-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 20px 30px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-overlay.is-open .modal-content {
    transform: translateY(0);
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: rgba(0,0,0,0.10); }
body.modal-open { overflow: hidden; }

/* ─── Modal: Type Selection ─── */
.type-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}
.type-option {
    padding: 14px 16px;
    font-size: var(--font-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    text-align: left;
    color: var(--text);
}
.type-option:hover { background: var(--border-light); }

/* ─── Pin Form ─── */
.pin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
}
.pin-form input[type="file"],
.pin-form textarea,
.pin-form input[type="number"],
.pin-form input[type="tel"],
.pin-form select {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 100%;
    background: var(--white);
}
.pin-form textarea {
    min-height: 80px;
    resize: vertical;
}
.pin-form button[type="submit"] {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-md);
    align-self: flex-start;
}
.pin-form button[type="submit"]:hover { background: var(--primary-hover); }

/* ─── Profile (inside side panel) ─── */
.profile-header {
    color: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    min-height: 60vh;
    justify-content: flex-end;
    padding: 30px 20px 20px 20px;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md);
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
}
.profile-posts {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 0;
} 
.follow-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: var(--radius-pill);
    font-size: var(--font-md);
    cursor: pointer;
}
.follow-btn:hover { background: var(--primary-hover); }
.text-btn-logout {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: var(--radius-pill);
    font-size: var(--font-md);
    cursor: pointer;
}
.text-btn-logout:hover { background: #c0392b; }

/* ─── Notifications (inside side panel) ─── */
.notifications-container {
    padding: 0;
}

.notif-header{
  text-align: center;
  display: flex;
  justify-content: space-between;
}
.notif-header h3 { padding-left:3rem;
}
.notif-tabs {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}
.notif-tab {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
}
.notif-tab.active {
    color: var(--text);
}
.notif-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}
.notif-tab span {
    background: var(--border-light);
    padding: 0 8px;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    margin-left: 4px;
}
.notif-panel { display: none; }
.notif-panel.active { display: block; }

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.notif-item.unread { background: #fffff2; }
.notif-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.notif-body {
    flex: 1;
    font-size: var(--font-sm);
    color: var(--text-light);
}
.notif-body strong { color: var(--text); }
.notif-post-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
}
.notif-empty {
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
}
.notif-post-tag {
    font-size: var(--font-sm);
    color: var(--primary);
    background: #eef5ff;
    padding: 0 8px;
    border-radius: var(--radius-pill);
}
.notif-open-btn {
    padding: 4px 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    cursor: pointer;
}

/* ─── Utilities ─── */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.w-full { width: 100%; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.notif-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 12px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}
.notif-header .side-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}
.notif-header span {
    font-size: 18px;
    font-weight: 600;
}

/* ─── Hide loading indicator ─── */
#upload-loading {
    display: none !important;
}

/* ─── Blur-up loading effect ─── */
.blur-up {
    filter: blur(20px);
    transition: filter 0.4s ease-in-out;
    will-change: filter;
}

.blur-up.loaded {
    filter: blur(0px);
}

/* Optional: subtle loading shimmer */
.blur-up.loading {
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Container to prevent layout shift */
.image-container {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 4/3;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Blur-up loading effect ─── */
.blur-up {
    filter: blur(20px);
    transition: filter 0.5s ease-in-out;
    will-change: filter;
    background: #f0f0f0;
}

.blur-up.loaded {
    filter: blur(0px);
}

/* Container to prevent layout shift */
.grid-item .image-container,
article.grid-item .image-container {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 4/3;
    width: 100%;
}

.grid-item .image-container img,
article.grid-item .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Loading shimmer effect */
.blur-up.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* ─── Smooth scroll disabled, instant jump ─── */
html {
    scroll-behavior: auto !important;
}

/* Anchor offset for fixed header */
#category-tabs {
    scroll-margin-top: 0px;
}

/* ─── Pin Detail Overlay ─── */
.pin-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pin-detail-overlay.active {
    opacity: 1;
}

.pin-detail-overlay::-webkit-scrollbar {
    width: 4px;
}

.pin-detail-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.pin-detail-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 10px 40px 10px;
}

/* Close button */
.pin-detail-close {
    position: fixed;
    top: 10px;
    float: right;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.pin-detail-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Main pin - uses your existing pin-card styles */
.pin-detail-main {
    margin-top: 10px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pin-detail-main .grid-item {
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
}

.pin-detail-main .main-image {
    max-height: 60vh;
    object-fit: contain;
    background: #000;
}

/* Related pins */
.pin-detail-related {
    margin-top: 24px;
}

.related-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-left: 4px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.related-pin {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.related-pin:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.related-pin img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
}

.related-pin .related-caption {
    padding: 8px 10px;
    font-size: 12px;
    color: #555;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading state */
.pin-detail-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.pin-detail-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.pin-detail-error {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.pin-detail-error button {
    margin-top: 16px;
    padding: 10px 24px;
    background: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* Mobile */
@media (max-width: 600px) {
    .pin-detail-overlay {
        padding: 10px;
    }
    
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
    
    .pin-detail-main .main-image {
        max-height: 50vh;
    }
    
.pin-detail-close {
    position: fixed;
    top: 10px;
    float: right;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
}

/* ─── Pin Detail Overlay ─── */
.pin-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pin-detail-overlay.active {
    opacity: 1;
}

.pin-detail-overlay::-webkit-scrollbar {
    width: 4px;
}

.pin-detail-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.pin-detail-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 10px 40px 10px;
}

.pin-detail-close {
    position: fixed;
    top: 10px;
    float: right;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.pin-detail-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.pin-detail-main {
    margin-top: 10px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pin-detail-main .grid-item {
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
}

.pin-detail-main .main-image {
    max-height: 60vh;
    object-fit: contain;
    background: #000;
}

.pin-detail-related {
    margin-top: 24px;
}

.related-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-left: 4px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.related-grid .grid-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 0 !important;
}

.related-grid .grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.related-grid .grid-item .main-image {
    aspect-ratio: 1/1;
    object-fit: cover;
    max-height: none;
}

.related-grid .grid-item .pin-info {
    padding: 8px 10px;
}

.related-grid .grid-item .pin-caption {
    font-size: 12px;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    max-height: 3.2em;
}

.related-grid .grid-item .pin-actions {
    display: none;
}

.related-grid .grid-item .pin-user-row {
    padding: 6px 10px;
}

.related-grid .grid-item .pin-avatar {
    width: 20px;
    height: 20px;
}

.related-grid .grid-item .pin-user-name {
    font-size: 12px;
}

.pin-detail-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.pin-detail-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pin-detail-error {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.pin-detail-error button {
    margin-top: 16px;
    padding: 10px 24px;
    background: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

@media (max-width: 600px) {
    .pin-detail-overlay {
        padding: 10px;
    }
    
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
    
    .pin-detail-main .main-image {
        max-height: 50vh;
    }
    
.pin-detail-close {
    position: fixed;
    top: 10px;
    float: right;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
}

/* ─── Simple Full Screen View ─── */
.pin-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pin-detail-overlay.active {
    opacity: 1;
}

.pin-detail-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 10px 40px 10px;
}

.pin-detail-close {
    position: fixed;
    top: 10px;
    float: right;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.pin-detail-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.pin-detail-main .grid-item {
    box-shadow: none !important;
    border-radius: 0 !important;
}

.pin-detail-main .grid-item .main-image {
    width: 100%;
    height: auto;
    max-height: max-content;
    object-fit: none;
    background: #fff;
}

.pin-detail-related {
    margin-top: 20px;
}

.related-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    padding-left: 4px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.related-grid .grid-item {
    margin-bottom: 0 !important;
}

.related-grid .grid-item .pin-actions {
    display: none;
}

.related-grid .grid-item .pin-info {
    padding: 6px 8px 8px 8px;
}

.related-grid .grid-item .pin-caption {
    font-size: 12px;
    -webkit-line-clamp: 2;
    max-height: 2.8em;
}

.related-grid .grid-item .pin-user-row {
    padding: 4px 8px;
}

.related-grid .grid-item .pin-avatar {
    width: 20px;
    height: 20px;
}

.related-grid .grid-item .pin-user-name {
    font-size: 11px;
}

.pin-detail-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.pin-detail-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #4a90d9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 600px) {
.pin-detail-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 10px 40px 10px;
}
    
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
    
.pin-detail-main .grid-item .main-image {
    width: 100%;
    height: auto;
    max-height: max-content;
    object-fit: none;
    background: #fff;
}
}

/* ─── Pin Detail - Full Size Image ─── */
.pin-detail-main .grid-item .main-image {
    width: 100%;
    height: auto;
    max-height: max-content;
    object-fit: none;
    background: #fff;
}

/* Make sure the image container allows full size */
.pin-detail-main .grid-item {
    max-width: 100%;
}

.pin-detail-main .grid-item .photo-scroll img {
    max-height: 70vh;
    object-fit: contain;
}

/* ─── Pin Detail - Full Size Image ─── */
.pin-detail-main .grid-item .main-image {
    width: 100%;
    height: auto;
    max-height: max-content;
    object-fit: none;
    background: #fff;
}

.pin-detail-main .grid-item {
    max-width: 100%;
}

.pin-detail-main .grid-item .photo-scroll img {
    max-height: 70vh;
    object-fit: contain;
}

/* Related pins in detail view */
.related-grid .grid-item .main-image {
    aspect-ratio: 1/1;
    object-fit: cover;
    max-height: none;
    width: 100%;
}

.related-grid .grid-item .pin-actions {
    display: none;
}

.related-grid .grid-item .pin-info {
    padding: 6px 8px 8px 8px;
}

.related-grid .grid-item .pin-caption {
    font-size: 12px;
    -webkit-line-clamp: 2;
    max-height: 2.8em;
}

.related-grid .grid-item .pin-user-row {
    padding: 4px 8px;
}

.related-grid .grid-item .pin-avatar {
    width: 20px;
    height: 20px;
}

.related-grid .grid-item .pin-user-name {
    font-size: 11px;
}

.pin-detail-overlay.active .pin-info { 
    position: static; 
}

/* ─── Pull to Close Indicators ─── */
.pin-detail-overlay {
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease;
    will-change: transform, opacity;
}

.pin-detail-overlay .pull-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.pin-detail-overlay.pull-active .pull-indicator {
    opacity: 1;
}

.pin-detail-overlay.pull-ready .pull-indicator {
    opacity: 1;
    color: #fff;
    background: rgba(255, 68, 68, 0.8);
}

/* Bottom pull indicator */
.pin-detail-overlay .bottom-indicator {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* When pulled down, show a shadow effect */
.pin-detail-overlay.pulling {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Close animation */
.pin-detail-overlay.closing {
    transform: translateY(100px) scale(0.95);
    opacity: 0;
}

/* ─── Smooth Pin Transitions ─── */
.pin-detail-main {
    transition: opacity 0.3s ease;
}

.pin-detail-main.loading {
    opacity: 0;
}

.pin-detail-main.loaded {
    opacity: 1;
}

/* Related pins hover effect */
.related-grid .grid-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-grid .grid-item:active {
    transform: scale(0.96);
}

/* Skeleton loading for smooth transition */
.pin-detail-main .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
    min-height: 200px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ─── Instant transitions ─── */
.pin-detail-overlay {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pin-detail-overlay.active {
    opacity: 1;
}

.pin-detail-overlay.closing {
    opacity: 0 !important;
    transform: scale(0.95) !important;
    pointer-events: none !important;
}

/* Remove any other transition delays */
.pin-detail-overlay .pin-detail-main {
    transition: none;
}

.related-grid .grid-item {
    transition: transform 0.15s ease;
}

.related-grid .grid-item:active {
    transform: scale(0.95);
}

/* ─── Zoom Transition Effects ─── */
.pin-detail-main {
    transition: opacity 0.25s ease;
}

.pin-detail-main .main-image {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Clone image animation */
.clone-image {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 8px;
    object-fit: cover;
}

.clone-image.zooming {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(1.1) !important;
    width: 90vw !important;
    height: auto !important;
    max-height: 80vh !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
}

.clone-image.fading {
    opacity: 0 !important;
    transform: translate(-50%, -50%) scale(1.2) !important;
}

/* Related pins hover */
.related-grid .grid-item {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.related-grid .grid-item:active {
    transform: scale(0.95);
}
