/**
 * PWA 앱 설치 + 다크모드 스타일
 * 코리안투데이 전용
 */

/* ========================================
   1. 메뉴바 앱 설치 버튼
   ======================================== */
.pwa-menu-item {
    margin-left: 10px !important;
}

.pwa-header-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 20px !important;
    background: linear-gradient(135deg, #00BCD4, #00ACC1) !important;
    color: white !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    line-height: 54px !important;
    height: 54px !important;
}

.pwa-header-btn:hover {
    background: linear-gradient(135deg, #00ACC1, #0097A7) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4) !important;
    color: white !important;
}

.pwa-header-btn .pwa-icon {
    font-size: 16px;
}

/* ========================================
   2. 사이드바 PWA 박스
   ======================================== */
.pwa-sidebar-widget {
    margin-bottom: 20px !important;
}

.pwa-sidebar-box {
    background: linear-gradient(135deg, #00BCD4 0%, #00ACC1 100%);
    border-radius: 15px;
    padding: 25px 20px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.3);
}

.pwa-sidebar-box .pwa-box-icon {
    font-size: 50px;
    margin-bottom: 10px;
    animation: pwa-bounce 2s ease-in-out infinite;
}

@keyframes pwa-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.pwa-sidebar-box .pwa-box-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: white !important;
}

.pwa-sidebar-box .pwa-box-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 15px 0;
    opacity: 0.95;
}

.pwa-sidebar-box .pwa-box-desc strong {
    color: #FFD700;
    font-weight: 700;
}

.pwa-sidebar-box .pwa-box-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #00838F;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pwa-sidebar-box .pwa-box-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.pwa-sidebar-box.installed {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

/* ========================================
   3. 설치 모달 팝업
   ======================================== */
.pwa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.pwa-modal {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 40px 35px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.pwa-modal-overlay.show .pwa-modal {
    transform: scale(1);
}

.pwa-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pwa-modal-phone {
    font-size: 70px;
    margin: 15px 0;
    animation: pwa-float 3s ease-in-out infinite;
}

@keyframes pwa-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pwa-modal-desc {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.pwa-modal-desc strong {
    color: #00BCD4;
    font-weight: 700;
}

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 25px;
    background: linear-gradient(135deg, #00BCD4, #00ACC1);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pwa-install-btn:hover {
    background: linear-gradient(135deg, #00ACC1, #0097A7);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.4);
}

.pwa-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.2s;
}

.pwa-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* ========================================
   4. 다크모드 토글 버튼
   ======================================== */
.dark-mode-toggle {
    position: fixed;
    bottom: 145px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 99997;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.dark-mode-toggle .icon-sun,
.dark-mode-toggle .icon-moon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.dark-mode-toggle .icon-moon {
    opacity: 1;
    visibility: visible;
}

.dark-mode-toggle .icon-sun {
    opacity: 0;
    visibility: hidden;
}

body.dark-mode .dark-mode-toggle {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

body.dark-mode .dark-mode-toggle .icon-moon {
    opacity: 0;
    visibility: hidden;
}

body.dark-mode .dark-mode-toggle .icon-sun {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   5. 다크모드 스타일
   ======================================== */
body.dark-mode {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
}

body.dark-mode .site-header,
body.dark-mode .main-navigation {
    background-color: #16213e !important;
}

body.dark-mode .site-content,
body.dark-mode .widget,
body.dark-mode .sidebar,
body.dark-mode .inside-article {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
}

body.dark-mode a {
    color: #00BCD4 !important;
}

body.dark-mode .entry-title,
body.dark-mode h1, body.dark-mode h2, 
body.dark-mode h3, body.dark-mode h4 {
    color: #ffffff !important;
}

body.dark-mode .pwa-modal {
    background: #1e1e2f;
    color: #e0e0e0;
}

body.dark-mode .pwa-modal-title {
    color: #ffffff;
}

body.dark-mode .pwa-modal-desc {
    color: #b0b0b0;
}

body.dark-mode .pwa-sidebar-box {
    background: linear-gradient(135deg, #00838F 0%, #006064 100%);
}

/* 다크모드에서 메뉴 버튼 유지 */
body.dark-mode .pwa-header-btn {
    background: linear-gradient(135deg, #00838F, #006064) !important;
}

/* ========================================
   6. 반응형
   ======================================== */
@media (max-width: 768px) {
    /* 모바일: 메뉴 버튼 텍스트 숨김 */
    .pwa-header-btn .pwa-text {
        display: none;
    }
    
    .pwa-header-btn {
        padding: 8px 12px !important;
    }
    
    .pwa-sidebar-box {
        padding: 20px 15px;
    }
    
    .pwa-sidebar-box .pwa-box-icon {
        font-size: 40px;
    }
    
    .pwa-modal {
        padding: 30px 25px;
        margin: 20px;
    }
    
    .pwa-modal-phone {
        font-size: 55px;
    }
    
    .dark-mode-toggle {
        width: 45px;
        height: 45px;
        bottom: 140px;
        right: 20px;
    }
    
    .dark-mode-toggle .icon-sun,
    .dark-mode-toggle .icon-moon {
        font-size: 20px;
    }
}

@media (max-width: 910px) {
    .pwa-sidebar-widget {
        display: none;
    }
}
