/* Spotter - 심플하고 단백한 스타일 */

/* ===== CSS 변수 정의 ===== */
:root {
  /* 컬러 시스템 */
  --color-primary: #007bff;
  --color-primary-hover: #0056b3;
  --color-secondary: #6c757d;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-warning: #ffc107;
  --color-info: #17a2b8;
  
  /* 그레이스케일 */
  --color-gray-50: #f8f9fa;
  --color-gray-100: #e9ecef;
  --color-gray-200: #dee2e6;
  --color-gray-300: #ced4da;
  --color-gray-400: #adb5bd;
  --color-gray-500: #6c757d;
  --color-gray-600: #495057;
  --color-gray-700: #343a40;
  --color-gray-800: #212529;
  --color-gray-900: #1a1a1a;
  
  /* 텍스트 컬러 */
  --color-text-primary: #333;
  --color-text-secondary: #666;
  --color-text-muted: #6c757d;
  --color-text-light: #adb5bd;
  
  /* 배경 컬러 */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8f9fa;
  --color-bg-muted: #e9ecef;
  
  /* 간격 시스템 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* 폰트 시스템 */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.75rem;
  --font-size-4xl: 2rem;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.2;
  --line-height-base: 1.5;
  --line-height-relaxed: 1.6;
  
  /* 보더 & 라디우스 */
  --border-width: 1px;
  --border-color: var(--color-gray-200);
  --border-radius-sm: 0.25rem;
  --border-radius-base: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  
  /* 그림자 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
  
  /* 트랜지션 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  
  /* Z-인덱스 */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* 다크모드 변수 */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text-primary: #e9ecef;
    --color-text-secondary: #adb5bd;
    --color-text-muted: #6c757d;
    
    --color-bg-primary: #2d2d2d;
    --color-bg-secondary: #1a1a1a;
    --color-bg-muted: #495057;
    
    --border-color: #495057;
  }
}

/* ===== 기본 리셋 ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Toast UI Editor 스타일 ===== */
.toast-editor-container {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.toast-editor-container .toastui-editor {
  border: none;
}

.toast-editor-container .toastui-editor .toastui-editor-toolbar {
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.toast-editor-container .toastui-editor .toastui-editor-contents {
  font-family: inherit;
  line-height: 1.6;
}

.toast-editor-container .toastui-editor .toastui-editor-contents h1,
.toast-editor-container .toastui-editor .toastui-editor-contents h2,
.toast-editor-container .toastui-editor .toastui-editor-contents h3,
.toast-editor-container .toastui-editor .toastui-editor-contents h4,
.toast-editor-container .toastui-editor .toastui-editor-contents h5,
.toast-editor-container .toastui-editor .toastui-editor-contents h6 {
  margin: 1.5rem 0 1rem 0;
  font-weight: 600;
  color: #333;
}

.toast-editor-container .toastui-editor .toastui-editor-contents p {
  margin: 0 0 1rem 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5rem 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents blockquote {
  border-left: 4px solid #007bff;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #666;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 0 4px 4px 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents code {
  background: #f1f3f4;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.9em;
}

.toast-editor-container .toastui-editor .toastui-editor-contents pre {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents pre code {
  background: none;
  padding: 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents ul,
.toast-editor-container .toastui-editor .toastui-editor-contents ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.toast-editor-container .toastui-editor .toastui-editor-contents li {
  margin: 0.5rem 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.toast-editor-container .toastui-editor .toastui-editor-contents th,
.toast-editor-container .toastui-editor .toastui-editor-contents td {
  border: 1px solid #e9ecef;
  padding: 0.5rem;
  text-align: left;
}

.toast-editor-container .toastui-editor .toastui-editor-contents th {
  background: #f8f9fa;
  font-weight: 600;
}

/* ===== 마크다운 콘텐츠 스타일 ===== */
.markdown-content {
  line-height: 1.6;
  color: #333;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 1.5rem 0 1rem 0;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.markdown-content h1 {
  font-size: 1.8rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.markdown-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.3rem;
}

.markdown-content h3 {
  font-size: 1.3rem;
}

.markdown-content h4 {
  font-size: 1.1rem;
}

.markdown-content p {
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.markdown-content blockquote {
  border-left: 4px solid #007bff;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: #f8f9fa;
  border-radius: 0 6px 6px 0;
  color: #666;
  font-style: italic;
}

.markdown-content code {
  background: #f1f3f4;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

.markdown-content pre {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid #e9ecef;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: #333;
  font-size: 0.9em;
}

.markdown-content ul,
.markdown-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.markdown-content li {
  margin: 0.5rem 0;
  line-height: 1.5;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  overflow: hidden;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #e9ecef;
  padding: 0.75rem 1rem;
  text-align: left;
}

.markdown-content th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

.markdown-content tr:nth-child(even) {
  background: #f8f9fa;
}

.markdown-content a {
  color: #007bff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

.markdown-content a:hover {
  border-bottom-color: #007bff;
}

.markdown-content hr {
  border: none;
  height: 2px;
  background: #e9ecef;
  margin: 2rem 0;
  border-radius: 1px;
}

body {
  font-family: var(--font-family-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 레이아웃 ===== */
/* 메인 헤더 고정 (body의 직접 자식만) */
body > header,
.header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-md) 0;
  width: 100%;
}

/* 페이지 내부 header 태그는 고정 스타일 제거 */
main header,
section header {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: auto !important;
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: var(--spacing-md) 0 0 0 !important;
  width: auto !important;
}

/* 헤더 내부 구조 */
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
}

.home-button {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-decoration: none;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xl);
  transition: var(--transition-fast);
}

.home-button:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.logo-placeholder {
  font-size: var(--font-size-2xl);
}

.brand-name {
  font-weight: var(--font-weight-bold);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: var(--spacing-xl);
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-base);
  transition: var(--transition-fast);
}

.main-nav a:hover {
  color: var(--color-primary);
  background-color: var(--color-bg-secondary);
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
}

.auth-buttons {
  display: flex;
  gap: 0.5rem;
}

.user-menu {
  position: relative;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.15s ease;
}

.user-info:hover {
  background-color: #f8f9fa;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-weight: 500;
}

.dropdown-arrow {
  transition: transform 0.15s ease;
}

.user-info:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1001;
  display: none;
}

.user-dropdown.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.dropdown-divider {
  height: 1px;
  background-color: #e9ecef;
  margin: 0.25rem 0;
}

/* 메인 푸터 - 콘텐츠 아래 위치 */
body > footer,
.footer {
  position: relative;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  width: 100%;
  margin-top: auto;
}

/* 푸터 내부 구조 */
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  text-align: center;
}

.footer-content {
  color: #6c757d;
  font-size: 0.9rem;
}

/* 메인 컨텐츠 */
.main-content {
  padding-top: 100px; /* 기본값, JavaScript에서 동적으로 조정 */
  padding-bottom: 20px; /* 푸터와의 간격 */
  position: relative;
  z-index: 1;
  flex-grow: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== 타이포그래피 ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}
h2 {
  font-size: 1.75rem;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}
h5 {
  font-size: 1.125rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  text-decoration: underline;
  color: var(--color-primary-hover);
}

/* ===== 폼 요소 ===== */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-sm);
  border: var(--border-width) solid var(--color-gray-300);
  border-radius: var(--border-radius-base);
  background-color: var(--color-bg-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

input:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

button {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-xs);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  border: var(--border-width) solid transparent;
  border-radius: var(--border-radius-base);
  background-color: var(--color-primary);
  color: var(--color-bg-primary);
  transition: var(--transition-fast);
  font-family: inherit;
}

button:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

button:focus {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 버튼 변형 */
button.secondary {
  background-color: #6c757d;
  border-color: #6c757d;
}

button.secondary:hover {
  background-color: #545b62;
  border-color: #4e555b;
}

button.outline {
  background-color: transparent;
  color: #007bff;
  border-color: #007bff;
}

button.outline:hover {
  background-color: #007bff;
  color: #fff;
}

/* ===== 레이아웃 컴포넌트 ===== */
/* 헤더 내부 */
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

header nav p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* 폼 레이아웃 */
form p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

form p label {
  font-weight: 500;
  min-width: 100px;
}

/* 검색 영역 스타일 */
#search-input {
  flex: 1;
  margin-right: 0.5rem;
}

#search-btn {
  white-space: nowrap;
}

/* 빠른 필터 버튼 */
.quick-filter {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: #f8f9fa;
  border-color: #dee2e6;
  color: #495057;
}

.quick-filter:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.quick-filter.active {
  background-color: #007bff;
  border-color: #007bff;
  color: white;
}

/* ===== 게시글 목록 ===== */
#posts-list {
  margin: 2rem 0;
  clear: both; /* 플로팅 요소 정리 */
  position: relative;
  z-index: 1;
}

#posts-list article {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
  cursor: pointer;
}

#posts-list article:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

#posts-list article header {
  position: static !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
}

#posts-list article h3 {
  margin-bottom: 0.5rem;
  color: #007bff;
  font-size: 1.25rem;
  font-weight: 600;
}

#posts-list article p {
  color: #666;
  line-height: 1.6;
}

#posts-list article footer {
  position: static !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#posts-list article footer p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#posts-list article img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  vertical-align: middle;
}

/* 게시글 메타 정보 */
#posts-list article small {
  color: #6c757d;
  font-size: 0.875rem;
}

#posts-list article strong {
  font-weight: 600;
  color: #333;
}

/* 새 게시글 레이아웃 스타일 */
#posts-list article .post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #f0f0f0;
}

#posts-list article .post-meta-left {
  flex: 1;
}

#posts-list article .post-meta-left small {
  font-size: 0.8rem;
  color: #666;
}

#posts-list article .post-meta-right {
  flex-shrink: 0;
  margin-left: 1rem;
}

#posts-list article .post-author {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

#posts-list article .post-status {
  margin-bottom: 0.75rem;
}

#posts-list article .post-status .remaining-time {
  color: #e74c3c;
  font-weight: 500;
}

#posts-list article .post-status .expired {
  color: #95a5a6;
  font-weight: 500;
}

/* 메인 콘텐츠 레이아웃 */
#posts-list article .post-content {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

#posts-list article .post-image {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  overflow: hidden;
  border-radius: 4px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
}

#posts-list article .post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 이미지가 없을 때의 플레이스홀더 */
#posts-list article .post-image:empty {
  display: none;
}

#posts-list article .post-details {
  flex: 1;
  min-width: 0; /* flexbox 텍스트 오버플로우 방지 */
}

#posts-list article .post-details h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  line-height: 1.4;
  /* 텍스트 오버플로우 처리 */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

#posts-list article .post-stats {
  color: #6c757d;
  font-size: 0.8rem;
  margin: 0;
}

#posts-list article .post-stats small {
  font-size: 0.8rem;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  #posts-list article .post-content {
    flex-direction: column;
  }
  
  #posts-list article .post-image {
    width: 100%;
    height: 120px;
    margin-bottom: 0.5rem;
  }
  
  #posts-list article .post-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  #posts-list article .post-meta-right {
    margin-left: 0;
  }
}

/* ===== 채팅 ===== */
.chat-message {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid #007bff;
}

.chat-message .message-author {
  font-weight: 600;
  color: #007bff;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.chat-message .message-content {
  color: #333;
  margin-bottom: 0.25rem;
}

.chat-message .message-time {
  color: #6c757d;
  font-size: 0.8rem;
}

.login-required-message {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* ===== 유틸리티 ===== */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-3 {
  margin-bottom: 1rem;
}
.mb-4 {
  margin-bottom: 1.5rem;
}
.mb-5 {
  margin-bottom: 3rem;
}

.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 1rem;
}
.mt-4 {
  margin-top: 1.5rem;
}
.mt-5 {
  margin-top: 3rem;
}

.p-1 {
  padding: 0.25rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-3 {
  padding: 1rem;
}
.p-4 {
  padding: 1.5rem;
}
.p-5 {
  padding: 3rem;
}

.d-flex {
  display: flex;
}
.d-block {
  display: block;
}
.d-inline {
  display: inline;
}
.d-inline-block {
  display: inline-block;
}
.d-none {
  display: none;
}

.justify-content-start {
  justify-content: flex-start;
}
.justify-content-center {
  justify-content: center;
}
.justify-content-end {
  justify-content: flex-end;
}
.justify-content-between {
  justify-content: space-between;
}

.align-items-start {
  align-items: flex-start;
}
.align-items-center {
  align-items: center;
}
.align-items-end {
  align-items: flex-end;
}

.flex-wrap {
  flex-wrap: wrap;
}
.flex-nowrap {
  flex-wrap: nowrap;
}

.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 1rem;
}
.gap-4 {
  gap: 1.5rem;
}
.gap-5 {
  gap: 3rem;
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }

  .main-content {
    /* padding-top은 JavaScript에서 동적으로 조정 */
    padding-bottom: 20px;
  }

  /* 헤더 모바일 */
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

  .header-center {
    order: 3;
    width: 100%;
  }

  .main-nav ul {
    justify-content: center;
    gap: 1rem;
  }

  .main-nav a {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* 폼 모바일 */
  form p {
    flex-direction: column;
    align-items: stretch;
  }

  form p label {
    min-width: auto;
  }

  /* 게시글 목록 모바일 */
  #posts-list article {
    padding: 1rem;
  }

  #posts-list article footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===== 다크 모드 ===== */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #e9ecef;
  }

  header,
  footer {
    background: rgba(33, 37, 41, 0.95);
    border-color: #495057;
  }

  #posts-list article {
    background: #2d2d2d;
    border-color: #495057;
    color: #e9ecef;
  }

  input,
  textarea,
  select {
    background-color: #2d2d2d;
    border-color: #495057;
    color: #e9ecef;
  }

  .chat-message {
    background: #2d2d2d;
    border-color: #495057;
    color: #e9ecef;
  }

  .login-required-message {
    background: #2d2d2d;
    border-color: #495057;
    color: #e9ecef;
  }
}

/* 채팅 링크 스타일 */
.chat-link {
  color: #007bff;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}

.chat-link:hover {
  color: #0056b3;
  text-decoration: none;
}

/* 남은 시간 표시 스타일 */
.remaining-time {
  color: #28a745;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.remaining-time.expired {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
}

/* 채팅 이미지 스타일 */
.chat-image-container {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 300px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-image-container:hover {
  transform: scale(1.02);
}

.chat-image {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 이미지 모달 스타일 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.image-modal.show {
  opacity: 1;
  visibility: visible;
}

.image-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.image-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.image-modal.show .image-modal-content {
  transform: scale(1);
}

.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.image-modal-title {
  font-weight: 600;
  color: #495057;
  font-size: 16px;
}

.image-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.image-modal-close:hover {
  background: #e9ecef;
  color: #495057;
}

.image-modal-body {
  padding: 20px;
  text-align: center;
}

.image-modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 다크 모드 이미지 모달 */
@media (prefers-color-scheme: dark) {
  .image-modal-content {
    background: #2d2d2d;
  }

  .image-modal-header {
    background: #1a1a1a;
    border-bottom-color: #495057;
  }

  .image-modal-title {
    color: #e9ecef;
  }

  .image-modal-close {
    color: #adb5bd;
  }

  .image-modal-close:hover {
    background: #495057;
    color: #e9ecef;
  }

  /* 다크 모드 채팅 링크 */
  .chat-link {
    color: #66b3ff;
  }

  .chat-link:hover {
    color: #99ccff;
  }
}

/* ===== 게시물 이미지 미리보기 ===== */
.post-image-preview {
  margin: 10px 0;
  text-align: center;
}

.post-thumbnail {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-thumbnail:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 이미지 모달 스타일 (기존 스타일 개선) */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
}

.image-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  cursor: default;
}

.image-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.8);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 1);
  color: #333;
}

.image-modal-img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* 다크 모드 게시물 이미지 미리보기 */
@media (prefers-color-scheme: dark) {
  .post-thumbnail {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .post-thumbnail:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }

  .image-modal-content {
    background: #2d2d2d;
  }

  .image-modal-close {
    color: #ccc;
    background: rgba(45, 45, 45, 0.8);
  }

  .image-modal-close:hover {
    background: rgba(45, 45, 45, 1);
    color: #fff;
  }
}
