:root {
    --ds-primary: #000000;
    --ds-primary-strong: #111111;
    --ds-primary-heavy: #222222;
    --ds-on-primary: #ffffff;
    --ds-text: #000000;
    --ds-text-sub: #616161;
    --ds-text-tertiary: #9e9e9e;
    --ds-text-disable: #bdbdbd;
    --ds-bg: #ffffff;
    --ds-bg-alt: #fafafa;
    --ds-fill: #f5f5f5;
    --ds-fill-strong: #eeeeee;
    --ds-border: #f0f0f0;
    --ds-border-strong: #e0e0e0;
    --ds-positive: #00c853;
    --ds-caution: #ffd600;
    --ds-negative: #ff1744;
    --ds-radius-sm: 8px;
    --ds-radius-md: 12px;
    --ds-radius-lg: 16px;
    --ds-radius-xl: 24px;
    --ds-radius-pill: 9999px;
    --ds-shadow-sm: 0 1px 3px rgba(0,0,0,.05);
    --ds-shadow-md: 0 4px 12px rgba(0,0,0,.05);
    --ds-shadow-lg: 0 8px 24px rgba(0,0,0,.08);
}

/* Pretendard 폰트 적용 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

/* 전체 레이아웃 */
html, body {
    margin: 0;
    padding: 0;
    background-color: var(--ds-bg);
    overflow-x: hidden;
    width: 100%;
}

.threads-app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--ds-bg);
    font-family: 'Pretendard', -apple-system, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    position: relative;
    box-sizing: border-box;
}

/* 블록 테마 기본 컨테이너 여백 및 너비 제한 해제 */
.wp-site-blocks,
.entry-content,
.post-content,
.wp-block-group {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 사이드바 내비게이션 */
.threads-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80px;
    background-color: var(--ds-bg);
    border-right: 1px solid var(--ds-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    z-index: 1000;
}

.sidebar-logo {
    margin-bottom: 48px;
    color: var(--ds-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo a {
    color: inherit;
    text-decoration: none;
    display: flex;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    align-items: center;
}

.nav-item {
    color: var(--ds-text-tertiary);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--ds-radius-md);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-item:hover {
    color: var(--ds-text);
    background-color: var(--ds-fill);
}

.nav-item.active {
    color: var(--ds-text);
}

.nav-label {
    display: none; /* 아이콘 위주로 표시 */
}

.threads-container {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
    color: var(--ds-text);
    background-color: var(--ds-bg);
    margin-left: calc(50% - 300px);
}

@media (min-width: 1200px) {
    .threads-container {
        margin-left: calc(50% - 300px + 40px);
    }
}

@media (max-width: 1024px) {
    .threads-container {
        margin-left: 120px;
        margin-right: 40px;
    }
}

/* 헤더 영역 */
.threads-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.threads-logo {
    color: var(--ds-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.threads-tabs {
    display: flex;
    width: 100%;
    border-bottom: 1px solid var(--ds-border);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 14px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ds-text-tertiary);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 2px solid transparent;
    text-align: center;
}

.tab-btn:hover {
    color: var(--ds-text);
}

.tab-btn.active {
    color: var(--ds-text);
    border-bottom-color: var(--ds-text);
}

/* 글 작성 영역 */
.thread-composer-card {
    background: var(--ds-bg);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--ds-shadow-sm);
    display: flex;
    gap: 16px;
}

.composer-avatar img, .thread-avatar img {
    border-radius: 50%;
    object-fit: cover;
}

.composer-body {
    flex: 1;
}

.composer-user-name {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
}

#thread-composer-form textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ds-text);
    background: transparent;
    padding: 0;
    margin-bottom: 12px;
    min-height: 80px;
    font-family: inherit;
}

#thread-composer-form textarea:focus {
    outline: none;
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--ds-border);
    padding-top: 12px;
}

.char-count {
    font-size: 13px;
    color: var(--ds-text-tertiary);
}

.btn-post {
    background-color: var(--ds-primary);
    color: var(--ds-on-primary);
    border: none;
    border-radius: var(--ds-radius-pill);
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-post:hover {
    background-color: var(--ds-primary-strong);
}

/* 로그인 유도 */
.login-prompt {
    width: 100%;
    text-align: center;
    padding: 12px 0;
}

.login-prompt p {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--ds-text-sub);
}

.btn-login {
    display: inline-block;
    background-color: var(--ds-primary);
    color: var(--ds-on-primary) !important;
    text-decoration: none;
    border-radius: var(--ds-radius-pill);
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-login:hover {
    background-color: var(--ds-primary-strong);
}

/* 피드 리스트 */
.threads-feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread-card {
    background: var(--ds-bg);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    padding: 20px;
    box-shadow: var(--ds-shadow-sm);
    display: flex;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thread-card:hover {
    box-shadow: var(--ds-shadow-md);
}

.thread-main {
    flex: 1;
}

.thread-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.thread-author {
    font-weight: 700;
    font-size: 15px;
}

.thread-time {
    font-size: 13px;
    color: var(--ds-text-tertiary);
}

.thread-content-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ds-text);
    word-break: break-word;
    margin-bottom: 14px;
}

.thread-content-body a {
    color: #0066cc;
    text-decoration: none;
}

.thread-content-body a:hover {
    text-decoration: underline;
}

.thread-actions {
    display: flex;
    gap: 16px;
}

.action-btn {
    background: none;
    border: none;
    padding: 6px;
    margin: -6px;
    color: var(--ds-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    border-radius: 50%;
}

.action-btn:hover {
    color: var(--ds-text);
}

.btn-like.liked {
    color: var(--ds-negative);
}

.btn-like.liked svg {
    fill: var(--ds-negative);
    stroke: var(--ds-negative);
}

.like-count {
    font-size: 14px;
    font-weight: 500;
}

.no-threads {
    text-align: center;
    padding: 48px 16px;
    color: var(--ds-text-tertiary);
    border: 1px dashed var(--ds-border-strong);
    border-radius: var(--ds-radius-lg);
}

/* 반응형 모바일 */
@media (max-width: 768px) {
    .threads-app-layout {
        flex-direction: column;
    }
    
    .threads-sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 68px;
        border-right: none;
        border-top: 1px solid var(--ds-border);
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    .sidebar-logo {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        gap: 0;
    }
    
    .threads-container {
        margin: 0 auto !important;
        padding: 16px 12px 100px 12px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .threads-container {
        padding: 16px 8px 100px 8px;
        margin: 0 auto !important;
        max-width: 100%;
        width: 100%;
    }
    .thread-card, .thread-composer-card {
        padding: 16px;
        gap: 12px;
    }
    .composer-avatar img, .thread-avatar img {
        width: 36px;
        height: 36px;
    }
}

/* 로그인 및 회원가입 모달 스타일 */
.gsc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gsc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}
.gsc-modal-container {
    position: relative;
    background-color: var(--ds-bg, #fff);
    border-radius: var(--ds-radius-lg, 16px);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    box-shadow: var(--ds-shadow-lg, 0 8px 28px rgba(0,0,0,.10));
    z-index: 1;
    animation: gscModalFadeIn 0.25s ease;
}
@keyframes gscModalFadeIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.gsc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--ds-text-sub, #4E5968);
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}
.gsc-modal-close:hover {
    color: var(--ds-text, #191F28);
}
.gsc-modal-header {
    margin-bottom: 24px;
    text-align: center;
}
.gsc-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--ds-text, #191F28);
    margin: 0 0 8px 0;
}
.gsc-modal-header p {
    font-size: 15px;
    color: var(--ds-text-sub, #4E5968);
    margin: 0;
}
.gsc-modal-form .form-group {
    margin-bottom: 16px;
}
.gsc-modal-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ds-text-sub, #4E5968);
    margin-bottom: 6px;
}
.gsc-modal-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--ds-border, #E5E8EB);
    border-radius: var(--ds-radius-md, 12px);
    font-size: 15px;
    color: var(--ds-text, #191F28);
    background-color: var(--ds-bg, #fff);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.gsc-modal-form input:focus {
    outline: none;
    border-color: var(--ds-primary, #3182F6);
    box-shadow: 0 0 0 3px rgba(49,130,246,.15);
}
.gsc-modal-error {
    background-color: rgba(240, 68, 82, 0.1);
    color: var(--ds-negative, #F04452);
    padding: 12px;
    border-radius: var(--ds-radius-sm, 8px);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.gsc-btn-primary {
    width: 100%;
    height: 48px;
    background-color: var(--ds-primary, #3182F6);
    color: var(--ds-on-primary, #fff) !important;
    -webkit-text-fill-color: var(--ds-on-primary, #fff) !important;
    border: none;
    border-radius: var(--ds-radius-md, 12px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.gsc-btn-primary:hover {
    background-color: var(--ds-primary-strong, #2272EB);
}
.gsc-modal-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--ds-text-sub, #4E5968);
}
.gsc-modal-footer a {
    color: var(--ds-primary, #3182F6);
    text-decoration: none;
    font-weight: 600;
}
.gsc-modal-footer a:hover {
    text-decoration: underline;
}
