/* ========================================
   다크모드 전환 애니메이션
   ======================================== */
body,
.wrapper,
.header-wrap,
.navbar,
.basic-body,
.footer,
.widget-card,
.section-header-minimal,
.board-list,
.board-view,
.sidebar-right,
.eyoom-form,
.modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========================================
   data-theme="dark" 셀렉터: FOUC 방지용
   Eyoom dark_mode.css가 로드되기 전에도 기본 배경/텍스트 적용
   ======================================== */
[data-theme="dark"] body,
[data-theme="dark"] .wrapper {
    background-color: #0d1116;
    color: #858585;
}

/* ========================================
   CSS 변수 오버라이드 (다크모드)
   ======================================== */
[data-theme="dark"] {
    --mulwang-dark: #ecf0f1;
    --mulwang-light: #1a1a2e;
    --gray-50: #1a1a1a;
    --gray-100: #2d2d2d;
    --gray-200: #3d3d3d;
    --gray-300: #4d4d4d;
    --gray-400: #6d6d6d;
    --gray-500: #8d8d8d;
    --gray-600: #adadad;
    --gray-700: #cdcdcd;
    --gray-800: #e0e0e0;
    --gray-900: #f0f0f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 2px 15px rgba(0, 0, 0, 0.25);
    --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* ========================================
   커스텀 위젯 다크모드 보완
   (Eyoom dark_mode.css에 없는 요소들)
   ======================================== */

/* --- 섹션 헤더 --- */
[data-theme="dark"] .section-header-minimal {
    border-color: #30363d;
}
[data-theme="dark"] .section-header-minimal h2,
[data-theme="dark"] .section-header-minimal .section-title {
    color: #d5d5d5;
}
[data-theme="dark"] .section-header-minimal .section-more a {
    color: #858585 !important;
}

/* --- 위젯 카드 --- */
[data-theme="dark"] .widget-card {
    background-color: #161b22;
    border-color: #30363d;
}
[data-theme="dark"] .widget-card::before {
    background: linear-gradient(135deg, rgba(26,188,156,0.05) 0%, transparent 60%);
}
[data-theme="dark"] .widget-card-header {
    border-color: #30363d;
}
[data-theme="dark"] .widget-card-title {
    color: #d5d5d5;
}
[data-theme="dark"] .widget-card-more {
    color: #858585 !important;
}
[data-theme="dark"] .widget-card-more:hover {
    color: #b5b5b5 !important;
}

/* --- SNS 피드 --- */
[data-theme="dark"] .feed-container,
[data-theme="dark"] .feed-item {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .feed-item:hover {
    background-color: #1c2129;
}
[data-theme="dark"] .feed-meta {
    color: #858585;
}
[data-theme="dark"] .feed-content {
    color: #b5b5b5;
}
[data-theme="dark"] .feed-actions a,
[data-theme="dark"] .feed-actions button {
    color: #858585 !important;
}
[data-theme="dark"] .feed-actions a:hover,
[data-theme="dark"] .feed-actions button:hover {
    color: #d5d5d5 !important;
}
[data-theme="dark"] .feed-tab-bar {
    background-color: #0d1116;
    border-color: #30363d;
}
[data-theme="dark"] .feed-tab-bar a {
    color: #858585 !important;
}
[data-theme="dark"] .feed-tab-bar a.active {
    color: #d5d5d5 !important;
    border-color: #1abc9c !important;
}

/* --- 운세(Fortune) 위젯 --- */
[data-theme="dark"] .fortune-widget {
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* --- MBTI 위젯 --- */
[data-theme="dark"] .mbti-widget,
[data-theme="dark"] .mbti-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .mbti-result-card {
    background-color: #1e2530;
    border-color: #30363d;
}

/* --- 급식표 위젯 --- */
[data-theme="dark"] .meal-widget,
[data-theme="dark"] .meal-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .meal-day {
    background-color: #0d1116;
    border-color: #30363d;
}
[data-theme="dark"] .meal-day.today {
    border-color: #1abc9c;
}

/* --- 분리배출 위젯 --- */
[data-theme="dark"] .trash-widget,
[data-theme="dark"] .trash-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .trash-day-item {
    background-color: #0d1116;
    border-color: #30363d;
}

/* --- 쿠폰 위젯 --- */
[data-theme="dark"] .coupon-widget,
[data-theme="dark"] .coupon-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .coupon-item {
    background-color: #0d1116;
    border-color: #30363d;
}

/* --- 구인구직 위젯 --- */
[data-theme="dark"] .job-widget,
[data-theme="dark"] .job-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .job-item {
    background-color: #0d1116;
    border-color: #30363d;
}

/* --- 빠른 메뉴 --- */
[data-theme="dark"] .quick-menu-grid .quick-menu-item {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .quick-menu-grid .quick-menu-item:hover {
    background-color: #1c2129;
}
[data-theme="dark"] .quick-menu-grid .quick-menu-label {
    color: #b5b5b5;
}

/* --- 통계 위젯 --- */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .community-stat-section {
    background-color: #161b22;
    border-color: #30363d;
}
[data-theme="dark"] .stat-card .stat-label {
    color: #858585;
}
[data-theme="dark"] .stat-card .stat-value {
    color: #d5d5d5;
}

/* --- 날씨 위젯 --- */
[data-theme="dark"] .weather-bar,
[data-theme="dark"] .weather-widget {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}

/* --- 뉴스 티커 --- */
[data-theme="dark"] .news-ticker-section .news-ticker-wrap {
    background-color: #0d1116;
    border-color: #30363d;
}

/* --- 게시판 섹션 --- */
[data-theme="dark"] .board-section {
    background-color: transparent;
}
[data-theme="dark"] .board-section .headline-short-alt {
    color: #d5d5d5;
}

/* --- 갤러리 / 이미지 --- */
[data-theme="dark"] .photo-gallery-section .gallery-item,
[data-theme="dark"] .image-gallery-section .gallery-item {
    background-color: #161b22;
    border-color: #30363d;
}

/* --- 회원가입 유도 배너 --- */
[data-theme="dark"] .signup-conversion-bar {
    background-color: #161b22;
    border-color: #30363d;
}

/* --- 모바일 하단 바 --- */
[data-theme="dark"] .mob-bnav,
[data-theme="dark"] #mobileBottomNav {
    background: #161b22;
    border-top-color: #30363d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}
[data-theme="dark"] .mob-bnav-item {
    color: #858585;
}
[data-theme="dark"] .mob-bnav-item.active {
    color: #1abc9c;
}

/* --- 모바일 하단 탭바 --- */
[data-theme="dark"] .mobile-bottom-tabbar,
[data-theme="dark"] #mobileBottomTabbar {
    background: #161b22;
    border-top-color: #30363d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}
[data-theme="dark"] .mobile-bottom-tabbar .tabbar-item,
[data-theme="dark"] #mobileBottomTabbar .tabbar-item {
    color: #858585;
}
[data-theme="dark"] .mobile-bottom-tabbar .tabbar-item.active,
[data-theme="dark"] #mobileBottomTabbar .tabbar-item.active {
    color: #1abc9c;
}
[data-theme="dark"] .tabbar-fab .fab-circle {
    background: linear-gradient(135deg, #1abc9c, #3498db);
}

/* --- 글쓰기 모달 --- */
[data-theme="dark"] .write-modal-overlay {
    background: rgba(0,0,0,0.7);
}
[data-theme="dark"] .write-modal {
    background: #161b22;
    border-color: #30363d;
}
[data-theme="dark"] .write-modal-header {
    border-color: #30363d;
    color: #d5d5d5;
}
[data-theme="dark"] .write-modal-header h3 {
    color: #d5d5d5;
}
[data-theme="dark"] .write-modal-close {
    color: #858585;
}
[data-theme="dark"] .write-modal-item {
    background: #0d1116;
    border-color: #30363d;
}
[data-theme="dark"] .write-modal-item:hover {
    background: #1c2129;
}
[data-theme="dark"] .write-modal-info h4 {
    color: #d5d5d5;
}
[data-theme="dark"] .write-modal-info p {
    color: #858585;
}

/* --- 알림 드롭다운 --- */
[data-theme="dark"] .notification-dropdown {
    background: #161b22;
    border-color: #30363d;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
[data-theme="dark"] .noti-header {
    border-color: #30363d;
    color: #d5d5d5;
}
[data-theme="dark"] .noti-item {
    border-color: #23272c;
    color: #b5b5b5;
}
[data-theme="dark"] .noti-item:hover {
    background: #1c2129;
}
[data-theme="dark"] .noti-item.unread {
    background: rgba(26,188,156,0.08);
}
[data-theme="dark"] .noti-title {
    color: #d5d5d5;
}
[data-theme="dark"] .noti-content {
    color: #858585;
}
[data-theme="dark"] .noti-icon {
    background: #30363d;
}
[data-theme="dark"] .noti-view-all {
    background: #0d1116;
    border-top: 1px solid #30363d;
}

/* --- 환영 팝업 --- */
[data-theme="dark"] .welcome-popup {
    background: #161b22;
}
[data-theme="dark"] .welcome-popup-body {
    color: #b5b5b5;
}
[data-theme="dark"] .welcome-feature {
    background: #0d1116;
    color: #b5b5b5;
}
[data-theme="dark"] .welcome-feature:hover {
    background: #1c2129;
}
[data-theme="dark"] .welcome-feature .info h4 {
    color: #d5d5d5;
}
[data-theme="dark"] .welcome-feature .info p {
    color: #858585;
}

/* --- 검색 풀스크린 --- */
[data-theme="dark"] .search-full {
    background-color: rgba(13,17,22,0.97);
}
[data-theme="dark"] .search-full input {
    color: #d5d5d5;
    border-color: #30363d;
}

/* --- 스크롤바 다크 스타일 --- */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0d1116;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4a535e;
}

/* --- 일반 폼 요소 --- */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: #0d1116;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: #4a535e;
}

/* --- 게임 카드 --- */
[data-theme="dark"] .game-card,
[data-theme="dark"] .game-item {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .game-card:hover {
    background-color: #1c2129;
}

/* --- 광고 배너 --- */
[data-theme="dark"] .ad-banner-wrapper {
    background-color: #161b22;
    border-color: #30363d;
}

/* --- 사주 페이지 --- */
[data-theme="dark"] .saju-section,
[data-theme="dark"] .saju-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}
[data-theme="dark"] .saju-card .card-header {
    background-color: #0d1116;
    border-color: #30363d;
}

/* --- 프로필 페이지 --- */
[data-theme="dark"] .profile-section,
[data-theme="dark"] .profile-card {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}

/* --- 카카오맵 인포윈도우 --- */
[data-theme="dark"] .kakao-map-info {
    background-color: #161b22;
    border-color: #30363d;
    color: #b5b5b5;
}

/* --- 페이지 본문 영역 --- */
[data-theme="dark"] .page-body,
[data-theme="dark"] .eb-container {
    background-color: #0d1116;
}
[data-theme="dark"] .page-title-wrap {
    background-color: #161b22;
    border-color: #30363d;
}
[data-theme="dark"] .page-title-wrap h2 {
    color: #d5d5d5;
}

/* --- 이미지 밝기 조정 --- */
[data-theme="dark"] img:not(.no-dark-filter):not([src*="logo"]):not([src*="icon"]) {
    filter: brightness(0.9);
}

/* ========================================
   다크모드 토글 버튼 (PC + 모바일)
   ======================================== */

/* PC 토글: top-header 우측 */
.darkmode-toggle-pc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.3s ease;
    color: #666;
    font-size: 16px;
    vertical-align: middle;
    margin-left: 8px;
}
.darkmode-toggle-pc:hover {
    background-color: rgba(0,0,0,0.06);
    color: #333;
}
[data-theme="dark"] .darkmode-toggle-pc {
    color: #ffc107;
}
[data-theme="dark"] .darkmode-toggle-pc:hover {
    background-color: rgba(255,255,255,0.08);
    color: #ffd54f;
}

/* 아이콘 회전 애니메이션 */
.darkmode-toggle-pc i,
.darkmode-toggle-mob i {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}
.darkmode-toggle-pc.active i {
    transform: rotate(360deg);
}

/* 모바일 FAB 토글 */
.darkmode-toggle-mob {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 9991;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 18px;
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s;
    -webkit-tap-highlight-color: transparent;
}
.darkmode-toggle-mob:active {
    transform: scale(0.9);
}
[data-theme="dark"] .darkmode-toggle-mob {
    background: #1e2530;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    color: #ffc107;
}

@media (max-width: 991px) {
    .darkmode-toggle-mob {
        display: flex;
    }
    /* safe area 대응: 하단 바가 있을 때 위치 조정 */
    body[style*="padding-bottom"] .darkmode-toggle-mob {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* 기존 네비바 다크모드 버튼 보완 */
[data-theme="dark"] .darkmode-menu a {
    color: #ffc107 !important;
}
