/* ============================================================
   components.css — New UI component styles
   Toast system, Nav user menu, Empty states, Image detail,
   Bookmarks, Notifications, Upload progress
   ============================================================ */

/* ---- Toast Notification System (U-40) ---- */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 2.5rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(16, 24, 52, 0.97);
    border: 1px solid var(--border-medium);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 280px;
}

.toast.toast-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.toast-out {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    pointer-events: none;
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.toast-success  { border-color: var(--green-border); }
.toast-success .toast-icon  { background: var(--green-bg); color: var(--green-text); }
.toast-error    { border-color: var(--red-border); }
.toast-error .toast-icon    { background: var(--red-bg); color: var(--red-text); }
.toast-warning  { border-color: var(--yellow-border); }
.toast-warning .toast-icon  { background: var(--yellow-bg); color: var(--yellow-text); }
.toast-info     { border-color: var(--info-border); }
.toast-info .toast-icon     { background: var(--info-bg); color: var(--info-text); }

.toast-msg {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-dimmed);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
    box-shadow: none;
    border-radius: 0;
}
.toast-close:hover { color: var(--text-primary); }


/* ---- Nav User Dropdown (U-03) ---- */
.nav-user-menu {
    position: relative;
    display: inline-flex;
}

.nav-user-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    background: var(--bg-input);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
    box-shadow: none;
}
.nav-user-btn:hover { border-color: var(--accent-start); }

.nav-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.nav-user-avatar.loaded,
.nav-user-avatar[data-loaded] { opacity: 1; }

.nav-user-initials {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-start);
    text-transform: uppercase;
    line-height: 1;
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: rgba(10, 16, 40, 0.98);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    display: none;
    z-index: 200;
}
.nav-user-dropdown.open { display: block; }

.nav-user-dropdown-name {
    padding: 0.7rem 1rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.25rem;
}

.nav-user-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
}
.nav-user-dropdown a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-user-dropdown-sep {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.25rem 0;
}

.nav-user-dropdown-logout {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--red-text);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.12s;
    box-shadow: none;
    border-radius: 0;
}
.nav-user-dropdown-logout:hover { background: var(--red-bg); }


/* ---- Image Detail (U-12, U-14, U-13) ---- */
.image-detail {
    max-width: 960px;
    margin: 0 auto;
}

.image-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.back-btn {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.back-btn:hover { color: var(--accent-start); text-decoration: none; }

.image-nav { display: flex; gap: 0.5rem; }

.nav-btn {
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: rgba(44, 212, 255, 0.1); color: var(--accent-start); text-decoration: none; }
.nav-btn.disabled { opacity: 0.35; pointer-events: none; cursor: default; }

/* Large edge navigation buttons (U-14) */
.image-viewer-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.image-edge-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 12, 26, 0.7);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    opacity: 0.6;
    backdrop-filter: blur(4px);
}
.image-edge-btn:hover { background: rgba(44,212,255,0.15); color: var(--accent-start); opacity: 1; text-decoration: none; }
.image-edge-prev { left: 8px; }
.image-edge-next { right: 8px; }

@media (max-width: 900px) {
    .image-edge-prev { left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
    .image-edge-next { right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
}

.image-viewer { margin-bottom: 1.25rem; }

.image-detail-header { margin-bottom: 0.75rem; }
.image-detail-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; font-weight: 700; }
.tier-label { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tag-pill {
    font-size: 0.8rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    background: rgba(44,212,255,0.1);
    border: 1px solid rgba(44,212,255,0.25);
    color: var(--accent-start);
    transition: background 0.12s;
}
.tag-pill:hover { background: rgba(44,212,255,0.2); text-decoration: none; }

.post-story {
    display: flex;
    gap: 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.post-story-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}
.post-story-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.post-story-avatar img.loaded,
.post-story-avatar img[data-loaded] { opacity: 1; }
.post-story-avatar-placeholder { font-size: 1.2rem; }

.post-story-author { font-size: 0.85rem; font-weight: 600; color: var(--accent-start); margin-bottom: 0.3rem; }
.post-story-author a { color: inherit; }
.post-story-author a:hover { text-decoration: underline; }
.post-story-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

.like-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-hover);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.like-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.like-btn.liked { border-color: var(--red); color: var(--red); background: var(--red-bg); }

.like-count { font-size: 0.85rem; color: var(--text-muted); }


/* ---- Empty States (U-43) ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
    display: block;
}
.empty-state p { margin: 0.25rem 0; }


/* ---- Bookmarks page (U-44) ---- */
.bookmark-card {
    display: flex;
    flex-direction: column;
    position: relative;
}
.bookmark-card > a {
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.bookmark-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    background: var(--bg-input);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
}

.bookmark-date { color: var(--text-dimmed); }

.bookmark-remove-btn {
    background: none;
    border: none;
    color: var(--text-dimmed);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: color 0.12s, background 0.12s;
    box-shadow: none;
}
.bookmark-remove-btn:hover { color: var(--red-text); background: var(--red-bg); }


/* ---- Notifications (U-22, U-23, U-24) ---- */
.notification-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1.5px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.notification-avatar img.loaded,
.notification-avatar img[data-loaded] { opacity: 1; }
.notification-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-start);
    text-transform: uppercase;
}

/* Make notification items hoverable when they're <a> links */
a.notification-item:hover {
    border-color: var(--accent-start);
    background: rgba(44,212,255,0.04);
    text-decoration: none;
}

.notification-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-start);
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
}


/* ---- Home page stat links (U-06) ---- */
.stat-item-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: color 0.15s;
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.4rem;
}
.stat-item-link:hover { text-decoration: none; }
.stat-item-link:hover .stat-number { color: var(--accent-end); }
.stat-item-link:hover .stat-label { color: var(--text-secondary); }


/* ---- Image viewer overlay buttons ---- */
.viewer.locked {
    position: relative;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.viewer.locked img {
    width: 100%;
    height: auto;
    filter: blur(18px) brightness(0.4);
    display: block;
}
.viewer.locked .overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    text-align: center;
}
.viewer.locked .overlay p { color: var(--text-secondary); margin: 0; }

.btn-subscribe-disabled,
.btn-login-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.35rem;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    background: var(--accent-gradient);
    color: #020412;
    box-shadow: 0 6px 16px var(--accent-glow);
}
.btn-subscribe-disabled:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-login-modal:hover { filter: brightness(1.05); transform: translateY(-1px); }


/* ---- Following card (U-25 minor improvement) ---- */
.following-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-dimmed);
    border-top: 1px solid var(--border-subtle);
}


/* ---- bg-card variable (used across) ---- */
.bg-card { background: var(--bg-card, rgba(255,255,255,0.04)); }


/* ---- Mobile adjustments ---- */
@media (max-width: 600px) {
    .toast-container { bottom: 0.75rem; right: 0.75rem; left: 0.75rem; width: auto; }
    .image-edge-prev, .image-edge-next { display: none; } /* keyboard arrows sufficient on small screens */
    .nav-user-dropdown { right: -0.5rem; }
}
/* ---- Card tags ---- */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.card-tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.07);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s;
    line-height: 1.4;
}

.card-tag:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

.card-tag-more {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-dimmed);
    background: rgba(255,255,255,0.04);
}

/* ---- Admin flash message spacing ---- */
.admin-page-header { margin-bottom: 1.5rem; }
