/* 공통 헤더/네비/테마/사이드바 스타일 */

/* Header */
.topbar{background:var(--card); backdrop-filter:saturate(140%) blur(8px); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50}
.topbar .container{display:flex; align-items:center; justify-content:center; padding:8px 0; position:relative}
.topbar .left{flex:0 0 auto}
.topbar .right{position:absolute; right:4%; top:8px}
.brand{display:flex; align-items:center; gap:10px; text-decoration:none}
.brand-logo{height:60px; width:auto; object-fit:contain}

/* GNB */
.gnb{background:var(--card); border-bottom:1px solid var(--line); position:relative}
.gnb .container{display:flex; align-items:center; justify-content:center; position:relative}
.gnb ul{display:flex; gap:26px; list-style:none; margin:0; padding:15px 0; justify-content:center; position:relative; overflow:visible}
.gnb a{color:#ffffff; text-decoration:none; padding:10px 12px; border-radius:8px; font-size:1rem; font-weight:500}
.gnb a:hover{color:#ffffff; background:rgba(255,255,255,.12)}

/* 알림 버튼 래퍼 */
.notification-wrapper {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* topbar의 알림 버튼 래퍼 (모바일/PC 모두) */
.topbar .notification-wrapper {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* gnb의 알림 버튼 래퍼 (PC 환경에서만 표시) */
.gnb .notification-wrapper {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* 모바일 환경에서는 gnb의 알림 버튼 숨기기 */
@media (max-width: 1024px) {
  .gnb .notification-wrapper {
    display: none;
  }
}

/* 알림 버튼 */
.notification-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.notification-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.notification-btn svg {
  width: 20px;
  height: 20px;
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #dc3545;
  color: white;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0 4px;
  border: 2px solid var(--card);
}

/* 알림 드롭다운 */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-height: 500px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notification-dropdown.show {
  display: flex;
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.notification-dropdown-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.notification-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.notification-close-btn:hover {
  color: var(--text);
}

.notification-dropdown-body {
  max-height: 400px;
  overflow-y: auto;
}

.notification-list {
  padding: 8px 0;
}

.notification-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: rgba(30, 99, 255, 0.3);
}

.notification-item.unread:hover {
  background: rgba(30, 99, 255, 0.12);
}

.notification-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notification-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.notification-item-message {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.notification-item-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* 모바일 환경에서 알림 드롭다운 크기 조정 */
@media (max-width: 480px) {
  .notification-dropdown {
    width: calc(100vw - 40px);
    max-width: 360px;
    right: -10px;
  }
}
/* 드롭다운 */
.gnb li{position:relative}
.gnb .has-sub .sub{display:none; position:absolute; top:100%; left:0; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:8px 0; list-style:none; margin:6px 0 0; min-width:160px; box-shadow:0 8px 20px rgba(0,0,0,.35); z-index:1000; overflow:visible}
.gnb .has-sub:hover .sub{display:block}
.gnb .sub a{display:block; padding:10px 14px; color:#ffffff; font-size:1rem}
.gnb .sub a:hover{background:rgba(255,255,255,.12); color:#ffffff}
.gnb .sub, .gnb .sub li, .gnb .sub a{background:var(--card)}

/* Sidebar account widget buttons */
.account .guest p{color:var(--muted); margin-bottom:12px}
.account .btn{background:#f0f2f6; color:#0f1a34; border:1px solid #d8dde7}
.account .actions{display:flex; gap:8px}

/* PC 환경 로그인/회원가입 버튼 스타일 */
#btnLogin {
  background: #3a3d4a;
  color: #ffffff;
  border: 1px solid #4a4d5a;
}

#btnLogin:hover {
  background: #4a4d5a;
  border-color: #5a5d6a;
}

#btnSignup {
  background: var(--blue);
  color: #ffffff;
  border: 1px solid var(--blue);
}

#btnSignup:hover {
  background: #1a55e6;
  border-color: #1a55e6;
}

/* Account widget: member view */
.account .profile{display:flex; align-items:center; gap:10px}
.account .profile .avatar{width:30px; height:30px; display:flex; align-items:center; justify-content:center; color:var(--text)}
.account .profile .meta .nick{font-weight:600; color:var(--text)}
.account .profile .links{display:flex; gap:12px; color:var(--muted); font-size:.92rem}
.account .profile .links .link{color:var(--muted); text-decoration:none; transition:color 0.2s ease}
.account .profile .links .link:hover{color:var(--text)}
.account .tabs-line{display:flex; align-items:center; gap:12px; margin:12px 0 8px; color:var(--text)}
.account .tabs-line .tab{background:transparent; border:0; padding:6px 0; color:var(--muted); cursor:pointer; transition:color 0.2s ease}
.account .tabs-line .tab:hover{color:var(--text)}
.account .tabs-line .tab.active{font-weight:700; color:var(--text)}
.account .tabs-line .divider{flex:1; height:1px; background:var(--line)}

/* Footer */
.site-footer{margin-top:24px; border-top:1px solid var(--line); background:var(--bg)}
.site-footer .container{display:flex; align-items:center; justify-content:space-between; padding:18px 0; color:var(--muted)}
.footer-nav a{color:var(--muted); margin-left:12px; text-decoration:none}

/* Back to top */
.back-to-top{position:fixed; right:18px; bottom:18px; width:42px; height:42px; border-radius:50%; border:1px solid var(--line); background:#0b1430; color:#fff; display:none; align-items:center; justify-content:center; cursor:pointer; box-shadow:var(--shadow)}
.back-to-top.show{display:flex}

/* 모바일 네비게이션 */
.mobile-nav{
  margin-top:20px;
}
.mobile-nav ul{
  list-style:none;
  padding:0;
  margin:0;
}
.mobile-nav li{
  margin-bottom:8px;
}
.mobile-nav a{
  display:block;
  color:#e8ecf5;
  text-decoration:none;
  padding:12px 16px;
  border-radius:8px;
  transition:background .2s ease;
  min-height:44px;
  display:flex;
  align-items:center;
}
.mobile-nav a:hover{
  background:rgb(255, 255, 255);
}
.mobile-nav .has-sub .sub{
  margin-left:20px;
  margin-top:8px;
}
.mobile-nav .has-sub .sub a{
  padding:8px 16px;
  font-size:14px;
  color:#8fa3c8;
}

/* 태블릿/모바일 터치 최적화 (1024px 이하) */
@media (max-width:1024px){
  .topbar .container{
    padding: 12px 0;
  }
  
  .brand-logo{
    height: 50px;
  }
  
  .gnb a,
  .mobile-nav a{
    min-height:44px;
    display:flex;
    align-items:center;
  }
  .gnb a:active,
  .mobile-nav a:active{
    background:rgba(255,255,255,.2);
  }
  
  /* 푸터 모바일 최적화 */
  .site-footer .container{
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    text-align: center;
  }
  
  /* 모바일에서 순서 변경: 링크를 위로, 저작권을 아래로 */
  .site-footer .container p {
    order: 2;
    margin: 0;
  }
  
  .footer-nav{
    order: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  
  .footer-nav a{
    margin: 0;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

/* Sidebar account widget buttons - duplicate removed, using updated version above */

/* Back to top */
.back-to-top{position:fixed; right:18px; bottom:18px; width:42px; height:42px; border-radius:50%; border:1px solid var(--line); background:#0b1430; color:#fff; display:none; align-items:center; justify-content:center; cursor:pointer; box-shadow:var(--shadow)}
.back-to-top.show{display:flex}

/* 로그인 모달창 */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.login-modal-content {
  background: #2a2d3a;
  border-radius: 14px;
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid #3a3d4a;
}

.login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #3a3d4a;
}

.login-modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: #ffffff;
}

.login-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.login-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.login-modal-body {
  padding: 24px;
}

.login-input-group {
  margin-bottom: 16px;
}

.login-input-group input {
  width: 100%;
  padding: 14px 18px;
  background: #3a3d4a;
  border: 1px solid #4a4d5a;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #ffffff;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.login-input-group input::placeholder {
  color: #8a8d9a;
}

.login-input-group input:focus {
  outline: none;
  border-color: #5a5d6a;
  background: #404350;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.login-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 6px;
  color: #e74c3c;
  font-size: 0.85rem;
  line-height: 1.4;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.login-checkboxes {
  display: flex;
  gap: 16px;
}

.login-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  color: #ffffff;
  user-select: none;
}

.login-checkbox input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  background: #3a3d4a;
  border: 1px solid #4a4d5a;
  border-radius: 3px;
  margin-right: 6px;
  position: relative;
  transition: all 0.2s ease;
}

.login-checkbox input[type="checkbox"]:checked + .checkmark {
  background: #4a4d5a;
  border-color: #5a5d6a;
}

.login-checkbox input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
}

.login-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.login-link:hover {
  color: #8a8d9a;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.login-btn {
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}


.login-submit-btn {
  background: #3a3d4a;
  color: #ffffff;
  border: 1px solid #4a4d5a;
}

.login-submit-btn:hover {
  background: #4a4d5a;
  border-color: #5a5d6a;
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 1rem;
  font-weight: bold;
}

/* 태블릿/모바일 최적화 (1024px 이하) */
@media (max-width: 1024px) {
  .login-modal-content {
    width: 95%;
    margin: 16px;
  }
  
  .login-modal-header {
    padding: 18px 20px 14px;
  }
  
  .login-modal-body {
    padding: 20px;
  }
  
  .login-checkboxes {
    flex-direction: column;
    gap: 12px;
  }
  
  .login-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .login-actions {
    flex-direction: column;
  }
  
  .login-btn {
    width: 100%;
  }
}

/* 더 작은 모바일 화면 최적화 */
@media (max-width: 480px) {
  .topbar .container{
    padding: 10px 0;
  }
  
  .brand-logo{
    height: 45px;
  }
  
  .site-footer .container{
    padding: 14px 0;
    gap: 6px;
  }
  
  .footer-nav{
    gap: 6px;
  }
  
  .footer-nav a{
    font-size: 0.8rem;
  }
}

/* 햄버거 메뉴 버튼 - 기본적으로 숨김 */
.mobile-menu-toggle {
  display: none !important;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
  padding: 6px;
  margin-right: 12px;
  z-index: 1001;
  position: relative;
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: #ffffff;
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
  margin: 2px 0;
}

/* PC 버전에서 모바일 전용 메타 정보 숨기기 */
@media (min-width: 1025px) {
  .post-meta {
    display: none !important;
  }
}

/* 모바일 환경에서 PC용 사이드바 숨기기 */
@media (max-width: 1024px) {
  .layout {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    padding: 0 !important;
  }
  
  .sidebar {
    display: none !important;
  }
  
}

/* 모바일 사이드바 오버레이 */
.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 70%;
  max-width: 280px;
  height: 100%;
  background: var(--card);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-right: 1px solid var(--line);
}

.mobile-sidebar-overlay.active .mobile-sidebar {
  transform: translateX(0);
}

/* 모바일 사이드바 헤더 */
.mobile-sidebar-header {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
}

.mobile-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.mobile-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
}

.mobile-user-info {
  flex: 1;
}

.mobile-user-nickname {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 6px;
}

.mobile-user-links {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
}

.mobile-user-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-user-link:hover {
  color: var(--text);
}

.mobile-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.mobile-close-btn:hover {
  color: var(--text);
}

/* 모바일 사이드바 게스트 상태 */
.mobile-sidebar-guest {
  padding: 16px 0;
}

.mobile-guest-message {
  text-align: center;
  margin-bottom: 20px;
}

.mobile-guest-message p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.mobile-guest-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.mobile-login-btn,
.mobile-signup-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-login-btn {
  background: #3a3d4a;
  color: #ffffff;
  border: 1px solid #4a4d5a;
}

.mobile-login-btn:hover {
  background: #4a4d5a;
  border-color: #5a5d6a;
  transform: translateY(-1px);
}

.mobile-signup-btn {
  background: var(--blue);
  color: #ffffff;
  border: 1px solid var(--blue);
}

.mobile-signup-btn:hover {
  background: var(--navy);
  border-color: var(--navy);
  transform: translateY(-1px);
}

.mobile-close-section {
  display: none;
}

.mobile-user-info {
  flex: 1;
}

.mobile-user-nickname {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.mobile-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-close-btn {
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.mobile-logout-btn {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.mobile-user-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mobile-user-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mobile-user-btn:hover {
  background: var(--navy);
}


.mobile-level-info {
  background: rgba(255,255,255,.05);
  border-radius: 6px;
  padding: 12px;
  border: 1px solid var(--line);
}

.mobile-level-bar {
  height: 8px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.mobile-level-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.mobile-level-text {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

/* 모바일 사이드바 메뉴 */
.mobile-sidebar-menu {
  padding: 14px;
}

.mobile-menu-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.mobile-menu-item {
  margin-bottom: 8px;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.mobile-menu-header:hover {
  background: rgba(255,255,255,.1);
  border-color: var(--blue);
}

.mobile-menu-header:active {
  transform: scale(0.98);
}

.mobile-menu-icon {
  font-size: 16px;
}

.mobile-menu-text {
  flex: 1;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.mobile-menu-stars {
  font-size: 12px;
}

.mobile-menu-arrow {
  color: var(--muted);
  font-size: 12px;
}

.mobile-menu-sub {
  margin-top: 4px;
  margin-left: 16px;
  display: none;
}

.mobile-menu-expanded .mobile-menu-sub {
  display: block;
}

.mobile-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.mobile-sub-item:hover {
  color: var(--text);
}

.mobile-sub-icon {
  font-size: 12px;
}

.mobile-sub-text {
  flex: 1;
}

/* PC에서는 햄버거 버튼 숨김, GNB 표시 */
@media (min-width: 1025px) {
  .mobile-menu-toggle {
    display: none !important;
  }
  
  .gnb {
    display: block !important;
  }
  
  .topbar .left {
    justify-content: center;
  }
}

/* 모바일/태블릿에서 햄버거 버튼 표시, GNB 숨김 */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: flex !important;
  }
  
  .gnb {
    display: none !important;
  }
  
  .topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
  }
  
  .topbar .left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
  }
  
  .topbar .brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}


