/**
 * 파주시운정종합사회복지관 - 전 페이지 공통 다크모드/라이트모드 스타일시트
 * (Theme Universal Stylesheet)
 */

/* 1. 테마 토글 버튼 공통 스타일 */
.theme-toggle-btn {
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-color, #cbd5e1);
    color: var(--text-main, #334155);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: 6px;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.08) !important;
    transform: translateY(-1px);
}

/* 2. 네비게이션이 없는 페이지용 플로팅 토글 버튼 */
.theme-floating-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-floating-toggle-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    color: #3b82f6;
}

[data-theme="dark"] .theme-floating-toggle-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .theme-floating-toggle-btn:hover {
    background: #243049;
    border-color: #60a5fa;
    color: #60a5fa;
}

/* ==========================================================================
   3. 통합이용자 및 사례관리 시스템 (USER/) 다크모드 테마 오버라이드
   ========================================================================== */
[data-theme="dark"] {
    --bg-primary: #0b0f17 !important;
    --bg-secondary: #131b2a !important;
    --border-color: #243049 !important;
    
    --text-primary: #f8fafc !important;
    --text-secondary: #94a3b8 !important;
    --text-dim: #64748b !important;
    
    --brand-color: #60a5fa !important;
    --brand-hover: #3b82f6 !important;
    --brand-light: rgba(59, 130, 246, 0.15) !important;
    
    --glass-bg: rgba(19, 27, 42, 0.88) !important;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4) !important;
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6) !important;

    /* 인트라넷 & 게시물 관리 공통 변수 매핑 */
    --surface: #131b2a !important;
    --bg: #0b0f17 !important;
    --text-main: #f8fafc !important;
    --text-muted: #94a3b8 !important;
    --border: #243049 !important;
    --border-hover: #334155 !important;
}

[data-theme="dark"] body {
    background-color: #0b0f17 !important;
    color: #f8fafc !important;
}

/* 네비게이션 헤더 */
[data-theme="dark"] .navbar,
[data-theme="dark"] .top-nav,
[data-theme="dark"] .admin-nav {
    background: rgba(19, 27, 42, 0.94) !important;
    border-bottom: 1px solid #243049 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .navbar .nav-logo,
[data-theme="dark"] .brand-title {
    color: #ffffff !important;
}

[data-theme="dark"] .home-link {
    background: #1a2436 !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .home-link:hover {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .nav-user-info {
    color: #cbd5e1 !important;
}

/* 카드 및 컨테이너 */
[data-theme="dark"] .card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .table-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .posting-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .filter-card,
[data-theme="dark"] .guestbook-box,
[data-theme="dark"] .entry-card,
[data-theme="dark"] .section-card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu {
    background-color: #131b2a !important;
    border-color: #243049 !important;
    color: #f8fafc !important;
}

/* 폼 입력창 (인풋, 셀렉트, 텍스트에어리어) */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control {
    background-color: #1a2436 !important;
    border-color: #2b3952 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] .form-control:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

/* 테이블 스타일 */
[data-theme="dark"] table {
    color: #f8fafc !important;
}

[data-theme="dark"] th {
    background-color: #162032 !important;
    color: #94a3b8 !important;
    border-color: #243049 !important;
}

[data-theme="dark"] td {
    border-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] tbody tr:hover td {
    background-color: rgba(59, 130, 246, 0.08) !important;
}

/* 탭 바 */
[data-theme="dark"] .tab-item,
[data-theme="dark"] .nav-tab,
[data-theme="dark"] .subtab-btn {
    background: #162032 !important;
    border-color: #243049 !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .tab-item:hover,
[data-theme="dark"] .nav-tab:hover,
[data-theme="dark"] .subtab-btn:hover {
    color: #f8fafc !important;
    background: #1e293b !important;
}

[data-theme="dark"] .tab-item.active,
[data-theme="dark"] .nav-tab.active,
[data-theme="dark"] .subtab-btn.active {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

/* 버튼 */
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-outline {
    background: #1a2436 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-outline:hover {
    background: #243049 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .theme-toggle-btn {
    background: #1a2436 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* 배지 */
[data-theme="dark"] .badge-gray,
[data-theme="dark"] .badge-light {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   4. 인쇄/PDF 출력 보호 (보고서는 무조건 순백 배경 + 검정 글씨 원문 유지)
   ========================================================================== */
@media print {
    body, html, main, .container, .card, table, th, td {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
    }
    .theme-toggle-btn,
    .theme-floating-toggle-btn,
    .navbar,
    .top-nav,
    .admin-nav {
        display: none !important;
    }
}
