:root {
  --bg-main: #131314;
  --bg-sidebar: #1e1f20;
  --bg-input: #1e1f20;
  --bg-bubble: #282a2c;
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;
  --accent-color: #a8c7fa;
  --gradient-gemini: linear-gradient(90deg, #4285f4, #9b72cb, #d96570);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

.gemini-wrap { display: flex; width: 100vw; height: 100vh; }

/* 사이드바 */
.gemini-sidebar {
  width: 350px; background-color: var(--bg-sidebar);
  display: flex; flex-direction: column; padding: 20px 0;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.new-chat-container { padding: 0 20px 20px; }
.new-chat-btn {
  display: inline-flex; align-items: center; gap: 12px;
  background-color: var(--bg-main); padding: 12px 18px;
  border-radius: 50px; color: var(--text-secondary);
  font-weight: 500; font-size: 14px; transition: background-color 0.2s;
}
.new-chat-btn:hover { background-color: rgba(255,255,255,0.08); }

.sidebar-scroll-area { flex: 1; overflow-y: auto; padding: 0 20px; }
.sidebar-scroll-area::-webkit-scrollbar { width: 6px; }
.sidebar-scroll-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sidebar-section { margin-bottom: 30px; }
.section-title { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; }

.gemini-recent-list li a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  color: var(--text-secondary); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gemini-recent-list li a::before { content: "💬"; font-size: 12px; opacity: 0.7; }
.gemini-recent-list li a:hover { background-color: rgba(255,255,255,0.05); color: var(--text-primary); }

.gemini-category-list ul li { margin-bottom: 6px; }
.gemini-category-list ul li a {
  display: block; font-size: 13px; color: var(--text-secondary);
  padding: 8px 12px; border-radius: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gemini-category-list ul li a:hover { background-color: rgba(255,255,255,0.05); color: var(--text-primary); }
.gemini-metrics li { font-size: 13px; color: var(--text-secondary); padding: 4px 12px; }
/* 카테고리 글 개수 스타일 조정 */
.c_cnt {
  font-size: 12px;
  color: #8e918f; /* 회색 톤으로 은은하게 표시 */
  margin-left: 6px;
}

.gemini-profile {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px 0; border-top: 1px solid rgba(255,255,255,0.05); margin-top: auto;
}
.gemini-profile .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.profile-info .name { font-size: 14px; font-weight: 600; }
.profile-info .role { font-size: 12px; color: var(--text-muted); }

/* 메인 영역 */
.gemini-main { flex: 1; display: flex; flex-direction: column; position: relative; }

.gemini-header { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 18px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.sparkle { background: var(--gradient-gemini); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.gemini-content-area {
  flex: 1; overflow-y: auto; padding-bottom: 0; display: flex; justify-content: center;
}
.content-container { width: 100%; max-width: 1000px; padding: 20px 24px 0 24px; display: flex; flex-direction: column; }

.gemini-greeting { margin-bottom: 60px; }
.gemini-greeting h1 { font-size: 56px; font-weight: 600; letter-spacing: -1.5px; margin-bottom: 10px; }
.gradient-text { background: var(--gradient-gemini); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sub-greeting { font-size: 56px; font-weight: 600; color: #444746; letter-spacing: -1.5px; }

.posts-stream { display: flex; flex-direction: column; gap: 50px; }

.prompt-bubble { display: flex; justify-content: flex-end; margin-bottom: 24px; }
.prompt-bubble .bubble-text {
  background-color: #313335; color: #ffffff; padding: 16px 24px;
  border-radius: 24px; font-size: 18px; font-weight: 700;
  max-width: 85%; line-height: 1.4; letter-spacing: -0.3px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.prompt-bubble .bubble-text a:hover { text-decoration: underline; }

.response-bubble { display: flex; gap: 16px; width: 100%; }
.ai-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-gemini); display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; flex-shrink: 0;
}
.response-content { flex: 1; min-width: 0; padding-top: 6px; }

.summary-text {
  font-size: 16px; line-height: 1.6; margin-bottom: 20px; color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis;
}

.response-attachment {
  position: relative;
  width: 100%;
  max-width: 700px;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  background-color: #222;
  display: block;
}
.response-attachment img { 
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important; 
  height: 100% !important; 
  object-fit: cover !important; 
  display: block !important; 
}

.response-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }
.read-more { color: var(--accent-color); font-weight: 500; }
.read-more:hover { text-decoration: underline; }

/* 상세 화면(본문) 및 관리자 툴 */
.detail-header-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.gemini-detail-view .detail-category { font-size: 14px; color: var(--text-muted); }
.admin-tools { display: flex; gap: 12px; font-size: 13px; }
.admin-tools a { color: var(--text-muted); transition: color 0.2s; }
.admin-tools a:hover { color: #ff5f56; text-decoration: underline; }

/* 본문 내 이미지들의 인라인 스타일 강제 무력화 및 노출 보장 */
.gemini-detail-view .detail-body img,
.gemini-detail-view .detail-body figure.imageblock img,
.gemini-detail-view .detail-body span.imageblock img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  border-radius: 12px;
  margin: 20px 0;
  display: block !important;
}

.gemini-detail-view .detail-body { font-size: 16px; line-height: 1.8; color: var(--text-primary); word-break: break-all; width: 100%; }
.gemini-detail-view .detail-body h1, .gemini-detail-view .detail-body h2 { margin: 30px 0 15px; color: #fff; }
.gemini-detail-view .detail-body p { margin-bottom: 20px; }
.gemini-detail-view .detail-body pre { background-color: #000; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 20px 0; }

.detail-tags { margin-top: 40px; display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.detail-tags a { background-color: var(--bg-input); padding: 6px 12px; border-radius: 16px; font-size: 13px; color: var(--text-secondary); }

/* 댓글 UI */
.gemini-comments { margin-top: 60px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.05); }
.comments-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 24px; }
.comment-item { background-color: var(--bg-input); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.comment-item.rp_secret { opacity: 0.7; }

/* 대댓글(답글) 들여쓰기 스타일 추가 */
.nested-comments { margin-top: 16px; border-left: 2px solid rgba(255,255,255,0.1); padding-left: 16px; }
.comment-item.nested { background-color: transparent; padding: 0; margin-bottom: 16px; border-radius: 0; }

.comment-meta { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.comment-author { font-weight: 600; color: var(--text-primary); }
.comment-date { color: var(--text-muted); }
.comment-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.comment-desc img{ max-width:100%; height:auto; display:block; margin:10px 0; }
.comment-desc p{ margin-bottom:10px; }
.comment-desc a{ color:var(--accent-color); }

/* 해결 2: 댓글 수정 삭제 버튼 스타일링 */
.comment-actions { display: flex; gap: 12px; align-items: center; }
.reply-btn { font-size: 12px; color: var(--accent-color); }
.reply-btn:hover { text-decoration: underline; }
.modify-btn { color: var(--text-muted); }
.modify-btn:hover { color: #ff5f56; }

.comment-form { margin-top: 30px; background-color: var(--bg-input); padding: 20px; border-radius: 16px; }
.comment-inputs { display: flex; gap: 16px; margin-bottom: 12px; }
.comment-inputs input {
  flex: 1; background-color: var(--bg-main); border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary);
  padding: 10px 14px; border-radius: 8px; outline: none; font-size: 14px;
}
.comment-secret-check { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.comment-form textarea {
  width: 100%; background-color: var(--bg-main); border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary);
  padding: 14px; border-radius: 8px; outline: none; font-size: 14px; height: 100px; resize: none; margin-bottom: 16px;
}
.submit-comment {
  background-color: var(--text-primary); color: var(--bg-main); border: none;
  padding: 10px 20px; border-radius: 20px; font-weight: 600; cursor: pointer; float: right;
}
.submit-comment:hover { background-color: #fff; }
.comment-form::after { content: ""; display: table; clear: both; }

/* 페이징 */
.gemini-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 60px; }
.page-numbers { display: flex; gap: 8px; min-height: 36px; }
.page-arrow, .page-numbers a, .page-numbers span { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 14px; color: var(--text-secondary); }
.page-arrow:hover, .page-numbers a:hover { background-color: var(--bg-input); }
.page-numbers .selected { background-color: rgba(255,255,255,0.1); color: var(--text-primary); font-weight: bold; }

/* 스크롤 빈 공간 */
.scroll-spacer { width: 100%; height: 250px; flex-shrink: 0; pointer-events: none; }

/* 하단 프롬프트 입력창 */
.gemini-input-area {
  position: absolute; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(to top, var(--bg-main) 75%, transparent);
  display: flex; justify-content: center; padding: 0 24px 24px;
}
.input-container { width: 100%; max-width: 1000px; display: flex; flex-direction: column; align-items: center; }
.prompt-box { width: 100%; background-color: var(--bg-input); border-radius: 30px; display: flex; align-items: center; padding: 12px 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.prompt-box input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-size: 16px; padding: 10px 0; }
.prompt-box input::placeholder { color: var(--text-muted); }
.submit-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; padding: 10px; border-radius: 50%; transition: color 0.2s, background-color 0.2s; display: flex; align-items: center; justify-content: center; }
.submit-btn:hover { background-color: rgba(255,255,255,0.1); color: var(--text-primary); }
.input-footer { font-size: 12px; color: var(--text-muted); margin-top: 12px; text-align: center; }

/* 사이드바 하단 영역 컨테이너 */
.gemini-sidebar-footer {
  margin-top: auto; /* 사이드바의 남은 공간을 밀어내어 최하단 배치 */
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background-color: var(--bg-sidebar);
}

/* 관리자 메뉴 스타일 */
.sidebar-element {
  display: flex;
  justify-content: center;
  padding: 10px 20px;
  gap: 10px;
}

.btn_tistory {
	display: flex;
  justify-content: center;
  width: 150px;
	height: 40px;
	padding: 0px 0;
	border-radius: 20px;
	border: 1px solid #e0e0e0;
	font-size: 14px;
	color: #000;
	line-height: 38px;
	box-sizing: border-box;
	text-align: center;
	background-color: #fff;
	-webkit-transition: background-color .1s linear,border-color .1s linear;
	-moz-transition: background-color .1s linear,border-color .1s linear;
	transition: background-color .1s linear,border-color .1s linear;
}

/* 버튼을 어둡게 색상 반전 시킵니다. */
.btn_log_info {
	color: #fff;
	border: 1px solid #000;
	background-color: #000;
}
/* 본문 내 리스트 태그 범위 이탈 방지 */
.gemini-detail-view .detail-body ul, 
.gemini-detail-view .detail-body ol {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding-left: 24px !important; /* 점(-) 아이콘이 들어갈 왼쪽 여백 확보 */
  margin: 12px 0 !important;
  word-break: break-all !important; /* 텍스트가 길어질 때 강제 줄바꿈 */
}

.gemini-detail-view .detail-body li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 6px;
  max-width: 100% !important;
  word-break: break-all !important;
}
/* ====================================
   티스토리 에디터 인라인 스타일 충돌 해결 (다크모드 보정)
   ==================================== */

/* 1. 본문 내 모든 제목 태그 색상 강제 지정 */
.gemini-detail-view .detail-body h1,
.gemini-detail-view .detail-body h2,
.gemini-detail-view .detail-body h3,
.gemini-detail-view .detail-body h4 {
  color: #ffffff !important; /* 무조건 흰색으로 출력 */
}

/* 2. 에디터가 텍스트에 강제로 넣은 검은색/어두운 회색 무력화 */
.gemini-detail-view .detail-body p span,
.gemini-detail-view .detail-body p {
  /* 인라인 스타일로 color가 잡혀있어도 어두운 색이면 회색/흰색 계열로 필터링 */
  color: var(--text-primary);
}

/* 3. 테이블(표) 내부 다크모드 최적화 */
.gemini-detail-view .detail-body table {
  width: 100% !important;
  border-collapse: collapse;
  margin: 20px 0;
  background-color: var(--bg-bubble) !important; /* 표 배경을 살짝 밝은 회색으로 */
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.gemini-detail-view .detail-body table td,
.gemini-detail-view .detail-body table th {
  padding: 10px 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text-secondary) !important; /* 테이블 안의 글자색 강제 보정 */
  font-size: 14px;
}

.gemini-detail-view .detail-body table th {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
  font-weight: 600;
}

/* 4. 에디터 인라인 스타일 중 검은색 계열 글자색 강제 치환 (인라인 컬러 제거용) */
.gemini-detail-view .detail-body [style*="color:#000"],
.gemini-detail-view .detail-body [style*="color: #000"],
.gemini-detail-view .detail-body [style*="color:rgb(0"],
.gemini-detail-view .detail-body [style*="color: rgb(0"] {
  color: var(--text-primary) !important;
}