/* style.css (모든 기능 및 핫딜 SVG 플레이스홀더 포함 최종 마스터 버전) */

/* --- 1. 테마 색상 변수 정의 --- */
:root {
    /* 라이트 모드 (기본값) */
    --color-background: #f0f2f5;
    --color-surface: #ffffff;
    --color-text-primary: #1c1c1c;
    --color-text-secondary: #555;
    --color-border: #ddd;
    --color-nav-background: #ffffff;
    --color-nav-text: #1c1c1c;
    --color-nav-hover: #f0f2f5;
    --color-icon-button-bg: rgba(255, 255, 255, 0.8);
    --color-icon-button-text: #1c1c1c;
    --color-icon-button-shadow: rgba(0,0,0,0.2);
    --panel-width-right: 353px;
    --bottom-nav-height: 50px;
    --transition-speed: 0.3s;
    --chat-toggle-size: 44px; 
}

body.dark-mode {
    /* 다크 모드 (블랙 모드) */
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-text-primary: #e4e6eb;
    --color-text-secondary: #aaa;
    --color-border: #444;
    --color-nav-background: #1c2128;
    --color-nav-text: #e4e6eb;
    --color-nav-hover: rgba(255, 255, 255, 0.1);
    --color-icon-button-bg: rgba(0, 0, 0, 0.6);
    --color-icon-button-text: #ffffff;
    --color-icon-button-shadow: rgba(0,0,0,0.4);
}
/* --- 변수 정의 끝 --- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    padding-bottom: var(--bottom-nav-height);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.site-container { display: flex; }
.icon-button {
    background: var(--color-icon-button-bg); color: var(--color-icon-button-text);
    border: 1px solid var(--color-border); border-radius: 50%; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
    box-shadow: 0 4px 8px var(--color-icon-button-shadow);
    z-index: 1001; padding: 0;
}

/* --- 채팅 및 메뉴 토글 라인 스타일 --- */
#chat-resizer { position: fixed; top: 0; right: var(--panel-width-right); width: 12px; height: 100vh; cursor: pointer; z-index: 1003; transition: right var(--transition-speed) ease-in-out; transform: translateX(50%); }
body:not(.chat-visible) #chat-resizer { right: 0; }
#chat-resizer::before, #chat-resizer::after { content: ''; position: absolute; left: 50%; top: 50%; transition: all 0.2s ease; }
#chat-resizer::before { transform: translateX(-50%); width: 2px; height: 100%; background-color: var(--color-border); }
#chat-resizer::after { transform: translate(-50%, -50%); width: 6px; height: 6px; border-radius: 50%; background-color: var(--color-text-secondary); opacity: 0.5; }
#chat-resizer:hover::before { width: 6px; box-shadow: 0 0 8px 0px var(--color-text-secondary); }
#chat-resizer:hover::after { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
#menu-resizer { position: fixed; bottom: calc(var(--bottom-nav-height) - 6px); left: 0; width: 100%; height: 12px; cursor: pointer; z-index: 1000; transition: bottom var(--transition-speed) ease-in-out; }
body.menu-hidden #menu-resizer { bottom: -6px; }
#menu-resizer::before, #menu-resizer::after { content: ''; position: absolute; left: 50%; top: 50%; transition: all 0.2s ease; }
#menu-resizer::before { transform: translate(-50%, -50%); width: 100%; height: 2px; background-color: var(--color-border); }
#menu-resizer::after { transform: translate(-50%, -50%); width: 6px; height: 6px; border-radius: 50%; background-color: var(--color-text-secondary); opacity: 0.5; }
#menu-resizer:hover::before { height: 6px; box-shadow: 0 0 8px 0px var(--color-text-secondary); }
#menu-resizer:hover::after { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
/* --- 토글 라인 스타일 끝 --- */

.chat-menu-bar { display: flex; align-items: center; background-color: var(--color-surface); padding: 5px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.chat-menu-bar .chat-menu-button { background: transparent; border: none; color: var(--color-text-primary); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 16px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color 0.2s ease; }
.chat-menu-bar .chat-menu-button:hover { background-color: var(--color-nav-hover); }
.chat-menu-bar .chat-menu-button.coupang { color: #c51d2a; font-weight: bold; }
#mobile-chat-menu-bar { justify-content: space-around; }

/* --- 하단 네비게이션 바 --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--bottom-nav-height);
    background-color: var(--color-nav-background); border-top: 1px solid var(--color-border);
    display: flex; justify-content: center;
    transition: transform 0.3s ease-in-out; 
    z-index: 1001;
}
.bottom-nav.hidden { transform: translateY(100%); }

.nav-content-wrapper {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; max-width: 1200px; padding: 0 20px;
    transition: margin-right 0.3s ease-in-out;
}
body.chat-visible .nav-content-wrapper { margin-right: var(--panel-width-right); }
.nav-links { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--color-nav-text); text-decoration: none; padding: 10px 15px; border-radius: 5px; transition: background-color 0.2s ease; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.nav-links a:hover { background-color: var(--color-nav-hover); }
.nav-links svg { display: none; }
.icon-button-group { display: flex; align-items: center; gap: 10px; }
.icon-button-group .icon-button { position: static; transform: none; margin: 0; box-shadow: none; border: none; background-color: transparent; }
.icon-button-group .icon-button:hover { background-color: var(--color-nav-hover); }
#mobile-chat-toggle { display: none; }
#mobile-chat-toggle .icon-collapse { display: none; }

/* --- 나머지 스타일 --- */
.content-container { flex-grow: 1; padding: 20px; transition: margin-right var(--transition-speed) ease-in-out; }
body.chat-visible .content-container { margin-right: var(--panel-width-right); }
.streams { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.stream-item { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all 0.2s ease; }
.stream-item:hover { transform: translateY(-5px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.stream-cover { position: relative; display: block; }
.stream-cover img { width: 100%; display: block; aspect-ratio: 16 / 9; background-color: #eee; }
.stream-viewer { position: absolute; bottom: 8px; left: 8px; background-color: rgba(0,0,0,0.7); color: white; padding: 3px 8px; border-radius: 5px; font-size: 13px; }
.stream-details { padding: 15px; }
.stream-title { font-size: 16px; font-weight: 600; margin: 0 0 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text-primary); }
.stream-name a { font-size: 14px; color: var(--color-text-secondary); text-decoration: none; }
.stream-name a:hover { text-decoration: underline; }

body.player-mode, body.home-mode { overflow: hidden; }
body.player-mode .content-container, body.home-mode .content-container { padding: 0; }
.player-container { position: relative; width: 100%; background-color: #000; transition: height var(--transition-speed) ease-in-out; }
.player-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
body.player-mode .player-container { height: calc(100vh - var(--bottom-nav-height)); }
body.player-mode.menu-hidden .player-container { height: 100vh; }
body.home-mode .content-container { height: calc(100vh - var(--bottom-nav-height)); }
body.home-mode.menu-hidden .content-container { height: 100vh; }

.right-panel { width: var(--panel-width-right); height: 100vh; background-color: var(--color-surface); border-left: 1px solid var(--color-border); position: fixed; top: 0; right: 0; transition: transform var(--transition-speed) ease-in-out; padding: 0; overflow: hidden; transform: translateX(0); z-index: 1002; display: flex; flex-direction: column; }
.right-panel:not(.visible) { transform: translateX(100%); }
.chat-iframe { width: 100%; height: 100%; border: none; display: block; flex-grow: 1; }

.loading-wrapper { display: flex; justify-content: center; align-items: center; min-height: 300px; }
.loader { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--color-border); border-top-color: var(--color-text-primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 공지 게시판 스타일 --- */
.announcement-board { max-width: 800px; margin: 0 auto; }
.announcement-item { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; margin-bottom: 12px; transition: all 0.2s ease; }
.announcement-item[open] { box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.announcement-title { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; font-size: 16px; font-weight: 600; cursor: pointer; list-style: none; }
.announcement-title::-webkit-details-marker { display: none; }
.announcement-timestamp { font-size: 13px; font-weight: 400; color: var(--color-text-secondary); white-space: nowrap; margin-left: 20px; }
.announcement-content { padding: 0 20px 20px 20px; line-height: 1.6; color: var(--color-text-secondary); border-top: 1px solid var(--color-border); }
.summary-right { display: flex; align-items: center; gap: 10px; }

/* --- 관리자 기능 관련 스타일 --- */
.board-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 2px solid var(--color-border); margin-bottom: 20px;}
.board-header h1 { margin: 0; padding: 0; border: none; }
.write-button { background-color: var(--color-text-primary); color: var(--color-background); border: none; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 14px; font-weight: 600; }
.admin-buttons button { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-secondary); font-size: 12px; padding: 3px 8px; border-radius: 4px; cursor: pointer; }
.admin-buttons button:hover { background-color: var(--color-nav-hover); }

/* --- 글쓰기/수정 모달 스타일 --- */
.modal-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6); display: flex;
    justify-content: center; align-items: center; z-index: 2000;
    opacity: 1; visibility: visible; transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal-wrapper.hidden { opacity: 0; visibility: hidden; }
.modal-content {
    background-color: var(--color-surface);
    padding: 30px; border-radius: 8px; width: 90%; max-width: 600px;
    display: flex; flex-direction: column; gap: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.modal-content h3 {
    margin: 0; padding: 0; border: none; font-size: 1.5rem;
    color: var(--color-text-primary);
}
.modal-content input, .modal-content textarea {
    width: 100%; padding: 10px; border: 1px solid var(--color-border);
    border-radius: 5px; background-color: var(--color-background);
    color: var(--color-text-primary); font-size: 16px;
}
.modal-content textarea { min-height: 200px; resize: vertical; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 1rem; }
.modal-buttons button { padding: 10px 20px; border-radius: 5px; border: none; font-size: 16px; cursor: pointer; transition: background-color 0.2s ease; }
#cancel-post-btn { background-color: var(--color-nav-hover); color: var(--color-text-primary); border: 1px solid var(--color-border); }
#save-post-btn { background-color: var(--color-text-primary); color: var(--color-background); }

/* --- 플랫폼 뱃지, 광고, 채팅 안내 등 --- */
.stream-name { display: flex; align-items: center; gap: 8px; }
.platform-badge { padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; color: #ffffff; line-height: 1; }
.platform-chzzk { background-color: #00ffa3; color: #000000; }
.platform-afreeca { background-color: #00e493; color: #000000; }
.platform-youtube { background-color: #FF0000; }
.platform-kick { background-color: #53FC18; color: #000000;}
.platform-twitch { background-color: #9146FF; }
.stream-ad-item { padding: 0; position: relative; overflow: hidden; min-height: 250px; display: flex; justify-content: center; align-items: center; background-color: var(--color-background); border: 2px dashed var(--color-border); border-radius: 8px; }
.ad-fallback-message { display: flex; justify-content: center; align-items: center; text-align: center; position: absolute; top: 0; left: 0; width: 100%; height: 100%; padding: 20px; font-size: 14px; font-weight: 500; color: var(--color-text-secondary); pointer-events: none; z-index: 1; }
.ad-iframe { position: relative; z-index: 2; flex-shrink: 0; }
.stream-item-message { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 20px; grid-column: 1 / -1; text-align: center; color: var(--color-text-secondary); }
#chat-welcome-message { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; width: 100%; height: 100%; padding: 20px; font-size: 16px; color: var(--color-text-secondary); line-height: 1.6; }
#chat-welcome-message .notice { font-size: 13px; margin-top: 20px; opacity: 0.8; }
.right-panel .chat-iframe { display: none; }
.right-panel.chat-active #chat-welcome-message { display: none; }
.right-panel.chat-active .chat-iframe { display: block; }

/* --- 핫딜 아코디언 게시판 스타일 --- */
.hotdeal-item-details {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}
.hotdeal-item-details[open] {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.hotdeal-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    list-style: none;
}
.hotdeal-summary::-webkit-details-marker { display: none; }
/* [핵심 복구] 썸네일 이미지 또는 이미지 없을 때의 공간 */
.hotdeal-summary-image, .hotdeal-summary-image-placeholder {
    width: 60px; height: 60px; object-fit: cover; border-radius: 8px;
    flex-shrink: 0; background-color: var(--color-background);
    display: flex; align-items: center; justify-content: center;
}

.hotdeal-placeholder-svg {
    width: 32px; height: 32px; color: var(--color-text-secondary);
}

.hotdeal-summary-main {
    flex-grow: 1;
    min-width: 0;
}
.hotdeal-summary-title {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}
.hotdeal-summary-date {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}
.hotdeal-summary-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.hotdeal-details-content {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    line-height: 1.6;
}
.hotdeal-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.info-label {
    font-weight: bold;
    color: var(--color-text-primary);
    flex-shrink: 0;
}
.hotdeal-link {
    font-weight: bold;
    color: #007bff;
    text-decoration: underline;
    word-break: break-all;
}
body.dark-mode .hotdeal-link {
    color: #58a6ff;
}
.hotdeal-commission-notice {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 0.75rem;
    margin: 0 0 1rem 0;
}
.hotdeal-desc {
    margin: 2rem 0;
    color: var(--color-text-primary);
}
.hotdeal-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin-top: 1.5rem;
    border-radius: 8px;
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.pagination button {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.pagination button:hover:not(:disabled) {
    background-color: var(--color-nav-hover);
}
.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.page-number {
    font-weight: bold;
    color: var(--color-text-secondary);
}



/* --- 모바일 반응형 --- */
@media screen and (max-width: 768px) {
    body { overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
    #chat-resizer, #menu-resizer { display: none; }
    .site-container { flex-direction: column; height: calc(100dvh - var(--bottom-nav-height) - env(safe-area-inset-bottom)); }
    .content-container { flex: 1; overflow-y: auto; transition: flex 0.3s ease, min-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease; margin-right: 0 !important; }
    .right-panel, .right-panel:not(.visible) { flex: 1; overflow-y: auto; position: static; width: 100%; border-left: none; border-top: 1px solid var(--color-border); transform: none !important; transition: flex 0.3s ease; }
    .bottom-nav, .bottom-nav.hidden { padding: 0; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); transform: none !important; }
    .nav-content-wrapper { margin-right: 0 !important; padding: 0 15px; }
    .nav-links a { padding: 10px; }
    .nav-links svg { display: block; width: 24px; height: 24px; }
    .nav-links span { display: none; }
    #mobile-chat-toggle { display: flex; }
    body.mobile-chat-expanded .content-container { flex: 0; min-height: 0; opacity: 0; padding: 0; border: none; }
    body.mobile-chat-expanded .right-panel { flex: 100; border-top: none; }
    body.mobile-chat-expanded #mobile-chat-toggle .icon-expand { display: none; }
    body.mobile-chat-expanded #mobile-chat-toggle .icon-collapse { display: block; }
}

/* style.css 파일 맨 아래에 추가 */

/* style.css 파일의 Discord 관련 스타일을 아래 코드로 교체 */

/* --- Discord 채팅 모드 스타일 --- */

/* 기본적으로 widgetbot 컨테이너는 숨겨둡니다. */
#discord-widget-container {
    display: none;
    width: 100%;
    height: 100%;
}

/* F5를 눌러 chat-active 상태가 되면, iframe이 보입니다. (기본) */
.right-panel.chat-active #chat-welcome-message { display: none; }
.right-panel.chat-active .chat-iframe { display: block; }

/* [핵심 수정] discord-mode가 추가되면, iframe은 숨기고 widgetbot 컨테이너를 보여줍니다. */
.right-panel.discord-mode.chat-active .chat-iframe { display: none; }
.right-panel.discord-mode.chat-active #discord-widget-container { display: block; }
