/* css/main-style.css */

/* ─────────────────────────────────────────
   레이아웃
───────────────────────────────────────── */
.ug-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* 좌측 사이드바 */
.ug-side-nav {
    width: var(--side-nav-width);
    min-width: var(--side-nav-width);
    background-color: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    height: 100%;
}
.ug-side-nav .logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    margin-bottom: 50px;
    display: block;
    padding-left: 10px;
}
.ug-side-nav .nav-links { flex: 1; }
.ug-side-nav .nav-links li { margin-bottom: 8px; }
.ug-side-nav .nav-links a,
.ug-side-nav .nav-footer button {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 18px;
    color: var(--text-2);
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    width: 100%;
    text-align: left;
}
.ug-side-nav .nav-links a:not(.write-link):not(.active):hover,
.ug-side-nav .nav-footer button:hover {
    background-color: var(--bg-2);
    color: var(--text-0);
}
.ug-side-nav .nav-links a.active {
    background-color: var(--primary-alpha);
    color: var(--primary);
    font-weight: 700;
}
.ug-side-nav .nav-links a.active span.material-symbols-rounded {
    font-variation-settings: 'FILL' 1;
}
.ug-side-nav .nav-links a.write-link {
    background-color: var(--primary);
    color: white;
    margin-top: 30px;
    justify-content: center;
    font-weight: 700;
    gap: 10px;
}
.ug-side-nav .nav-links a.write-link:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}
.ug-side-nav span.material-symbols-rounded { font-size: 26px; }

/* 중앙 피드 */
.ug-main-feed {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background-color: var(--bg-0);
    height: 100%;
    min-width: 500px;
}
.ug-main-feed .main-header {
    padding: 20px 28px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: rgba(5,5,5,0.88);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.ug-main-feed .main-header h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}
.ug-main-feed .feed-tabs { display: flex; }
.ug-main-feed .tab-item {
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-2);
    position: relative;
    cursor: pointer;
    transition: color 0.2s;
}
.ug-main-feed .tab-item:hover { color: var(--text-0); }
.ug-main-feed .tab-item.active { color: var(--text-0); font-weight: 700; }
.ug-main-feed .tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0;
    width: 100%; height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

/* 스크롤 영역 */
.feed-scroll-area {
    flex: 1;
    overflow-y: scroll;
    padding: 16px 0 32px;
}
.feed-scroll-area::-webkit-scrollbar { width: 5px; }
.feed-scroll-area::-webkit-scrollbar-track { background: transparent; }
.feed-scroll-area::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 4px; }
.feed-scroll-area::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

.feed-loader {
    text-align: center;
    padding: 60px 0;
    color: var(--text-3);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.feed-empty, .feed-error {
    text-align: center;
    padding: 80px 30px;
    color: var(--text-2);
    line-height: 1.8;
    font-size: 0.95rem;
}

/* 우측 패널 */
.ug-right-panel {
    width: var(--panel-right-width);
    min-width: var(--panel-right-width);
    background-color: var(--bg-1);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100%;
    overflow-y: auto;
}
.trending-topics h2 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.trending-topics li {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.trending-topics li a {
    font-size: 0.9rem;
    color: var(--text-1);
    font-weight: 600;
    transition: color 0.2s;
}
.trending-topics li a:hover { color: var(--primary-hover); }
.trending-topics li .count { font-size: 0.78rem; color: var(--text-3); font-family: monospace; }
.auth-status-card {
    background-color: var(--bg-2);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    text-align: center;
}

/* ─────────────────────────────────────────
   게시물 카드 — 컴팩트
───────────────────────────────────────── */
.post-card {
    margin: 0 16px 12px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover {
    border-color: rgba(157,78,221,0.4);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.post-card-inner {
    padding: 16px 18px 14px;
}

/* 헤더 */
.post-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
}
.post-meta { display: flex; flex-direction: column; gap: 1px; }
.post-username { font-weight: 700; font-size: 0.88rem; color: var(--text-0); }
.post-time { font-size: 0.74rem; color: var(--text-3); }

/* 제목 */
.post-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-0);
    margin-bottom: 10px;
    letter-spacing: -0.2px;
    line-height: 1.35;
}

/* ─── 이미지: 인스타그램 스타일 ─── */
.post-image-wrap {
    margin: 0 -18px 12px;   /* 카드 패딩 밖으로 꽉 채우기 */
    background: #000;
    position: relative;
    overflow: hidden;
}
.post-image {
    display: block;
    width: 100%;
    max-height: 320px;           /* 최대 높이 제한 */
    object-fit: contain;         /* 비율 유지, 남은 공간은 검은 배경 */
    object-position: center;
}

/* ─── 본문: 3줄 클램프 ─── */
.post-body {
    color: var(--text-1);
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 6px;
}
.post-body-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 더 보기 버튼 */
.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: opacity 0.2s;
}
.expand-btn:hover { opacity: 0.75; }

/* 태그 */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0 2px;
}
.post-tag {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-alpha);
    padding: 2px 9px;
    border-radius: 20px;
}

/* 액션 버튼 */
.post-actions {
    display: flex;
    gap: 2px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
}
.action-btn:hover { background: var(--bg-2); color: var(--text-0); }
.action-btn .material-symbols-rounded { font-size: 18px; }

.like-btn.liked { color: #f43f5e; }
.like-btn.liked:hover { background: rgba(244,63,94,0.1); }

@keyframes likePop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.5); }
    70%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}
.like-pop .like-icon { animation: likePop 0.38s ease; }

/* ─────────────────────────────────────────
   댓글 (항상 표시, 토글로 접기 가능)
───────────────────────────────────────── */
.comment-section {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}
.comment-section.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    max-height: 220px;
    overflow-y: auto;
}
.comment-list::-webkit-scrollbar { width: 3px; }
.comment-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.no-comments {
    font-size: 0.78rem;
    color: var(--text-3);
    text-align: center;
    padding: 8px 0;
}

.comment-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.comment-avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-2);
}
.comment-bubble {
    background: var(--bg-2);
    border-radius: 10px;
    padding: 7px 11px;
    flex: 1;
}
.comment-user {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 2px;
}
.comment-text {
    font-size: 0.84rem;
    color: var(--text-1);
    line-height: 1.45;
    word-break: break-word;
    margin: 0;
}
.comment-time {
    font-size: 0.68rem;
    color: var(--text-3);
    margin-top: 3px;
    display: block;
}

/* 댓글 입력창 */
.comment-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 8px 6px 12px;
    transition: border-color 0.2s;
}
.comment-input-row:focus-within { border-color: var(--primary); }
.comment-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-0);
    font-size: 0.85rem;
    font-family: inherit;
    padding: 3px 0;
}
.comment-input::placeholder { color: var(--text-3); }
.comment-send-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
.comment-send-btn:hover { background: var(--primary-hover); }
.comment-send-btn:active { transform: scale(0.9); }
.comment-send-btn .material-symbols-rounded { font-size: 16px; }

/* ─────────────────────────────────────────
   마크다운 렌더링
───────────────────────────────────────── */
.markdown-rendered h1 { font-size: 1.3rem; font-weight: 800; color: var(--text-0); margin: 0.9em 0 0.4em; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.markdown-rendered h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-0); margin: 0.8em 0 0.35em; }
.markdown-rendered h3 { font-size: 0.98rem; font-weight: 700; color: var(--text-0); margin: 0.7em 0 0.3em; }
.markdown-rendered h4 { font-size: 0.9rem; font-weight: 700; color: var(--text-1); margin: 0.6em 0 0.25em; }
.markdown-rendered p  { margin: 0.4em 0; }
.markdown-rendered strong { color: var(--text-0); font-weight: 700; }
.markdown-rendered em { color: var(--text-1); font-style: italic; }
.markdown-rendered del { opacity: 0.5; }
.markdown-rendered a  { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.markdown-rendered blockquote {
    border-left: 3px solid var(--primary);
    padding: 3px 12px;
    margin: 8px 0;
    color: var(--text-2);
    background: var(--primary-alpha);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.markdown-rendered code {
    background: var(--bg-2);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.83em;
    color: #c084fc;
}
.markdown-rendered pre {
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 8px 0;
}
.markdown-rendered pre code { background: transparent; padding: 0; color: var(--text-1); }
.markdown-rendered ul, .markdown-rendered ol { padding-left: 18px; margin: 0.4em 0; }
.markdown-rendered li { margin: 0.2em 0; }
.markdown-rendered hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.markdown-rendered img { max-width: 100%; border-radius: 8px; margin: 6px 0; }

/* ─────────────────────────────────────────
   토스트
───────────────────────────────────────── */
.ug-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-0);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.4,0,0.2,1);
    backdrop-filter: blur(12px);
    pointer-events: none;
    white-space: nowrap;
}
.ug-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 스핀 */
@keyframes spin { to { transform: rotate(360deg); } }
.animation-spin { animation: spin 1s linear infinite; display: inline-block; }

/* ─────────────────────────────────────────
   점 3개 더보기 메뉴
───────────────────────────────────────── */
.post-more-wrap { position: relative; }
.post-more-btn { padding: 4px; color: var(--text-3); border-radius: 8px; }
.post-more-btn:hover { color: var(--text-0); background: var(--bg-2); }
.post-more-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-width: 130px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.more-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-1);
    transition: background 0.15s;
    text-align: left;
}
.more-menu-item:hover { background: var(--bg-1); }
.more-menu-item .material-symbols-rounded { font-size: 18px; }

/* ─────────────────────────────────────────
   신고 모달
───────────────────────────────────────── */
#report-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
#report-overlay.open { display: flex; }
#report-modal {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 20px 24px 36px;
    width: 100%;
    max-width: 520px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
#report-modal.slide-up { transform: translateY(0); }
.report-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 0 auto 20px;
}
.report-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.report-sub { font-size: 0.83rem; color: var(--text-3); margin-bottom: 18px; }
.report-reasons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.report-reason-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem; font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.report-reason-item:hover { background: var(--bg-2); }
.report-reason-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.report-reason-item:has(input:checked) { border-color: var(--primary); background: var(--primary-alpha); }
#report-submit-btn {
    width: 100%; padding: 13px;
    background: var(--primary); color: white;
    border-radius: 12px; font-weight: 700; font-size: 0.95rem;
    margin-bottom: 8px;
    transition: background 0.2s;
}
#report-submit-btn:hover { background: var(--primary-hover); }
#report-cancel-btn {
    width: 100%; padding: 11px;
    background: var(--bg-2); color: var(--text-2);
    border-radius: 12px; font-weight: 600; font-size: 0.9rem;
}

/* ─────────────────────────────────────────
   미니프로필 패널
───────────────────────────────────────── */
#mini-profile-panel {
    position: fixed;
    top: 0; right: -320px;
    width: 300px; height: 100vh;
    background: var(--bg-1);
    border-left: 1px solid var(--border);
    z-index: 500;
    transition: right 0.32s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
}
#mini-profile-panel.open { right: 0; }
.mini-profile-inner {
    padding: 28px 24px;
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
}
.mini-close-btn {
    align-self: flex-end;
    color: var(--text-3); padding: 4px;
}
.mini-close-btn:hover { color: var(--text-0); }
.mini-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    object-fit: cover;
}
.mini-username { font-weight: 800; font-size: 1rem; }
.mini-desc { font-size: 0.83rem; color: var(--text-2); text-align: center; line-height: 1.5; }
.mini-stats {
    display: flex; gap: 20px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: 100%; justify-content: center;
    text-align: center;
}
.mini-stats div { display: flex; flex-direction: column; gap: 2px; }
.mini-stats strong { font-size: 1rem; font-weight: 800; }
.mini-stats span { font-size: 0.75rem; color: var(--text-3); }
.mini-follow-btn {
    width: 100%; padding: 11px;
    background: var(--primary); color: white;
    border-radius: 12px; font-weight: 700; font-size: 0.9rem;
    transition: background 0.2s;
}
.mini-follow-btn:hover { background: var(--primary-hover); }
.mini-follow-btn.following {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
}
.mini-profile-link {
    font-size: 0.85rem; color: var(--primary);
    font-weight: 600; text-decoration: underline;
}

/* ─────────────────────────────────────────
   우측 패널 프로필 (가로 배치)
───────────────────────────────────────── */
.user-profile-card { text-align: left; }
.user-profile-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
}
.user-profile-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    flex-shrink: 0;
    object-fit: cover;
}
.user-profile-info { display: flex; flex-direction: column; gap: 2px; }
.user-profile-name { font-weight: 800; font-size: 0.95rem; }
.user-profile-role { font-size: 0.78rem; color: var(--text-3); }
.btn-my-profile {
    display: block; width: 100%;
    padding: 8px; font-size: 0.85rem; font-weight: 700;
    border-radius: 8px;
    background: var(--bg-0);
    border: 1px solid var(--border);
    text-align: center;
    color: var(--text-1);
    transition: border-color 0.2s, color 0.2s;
}
.btn-my-profile:hover { border-color: var(--primary); color: var(--primary); }

/* ─────────────────────────────────────────
   알림 뱃지
───────────────────────────────────────── */
.noti-link { position: relative; }
.badge {
    position: absolute;
    top: 6px; left: 28px;
    min-width: 18px; height: 18px;
    background: #ff4444;
    color: white;
    font-size: 0.68rem; font-weight: 700;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

/* ─────────────────────────────────────────
   애니메이션
───────────────────────────────────────── */
@keyframes slideInTop {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
}

/* ─────────────────────────────────────────
   인스타그램 스타일 캐러셀
───────────────────────────────────────── */
.post-carousel {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    margin: 14px 0;
    aspect-ratio: 1/1;
    max-height: 480px;
}

.carousel-slides {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.carousel-slide.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.55);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.post-carousel:hover .carousel-btn {
    opacity: 1;
}

.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-btn .material-symbols-rounded {
    font-size: 22px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.3);
}

.carousel-counter {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    z-index: 10;
}
