/* 텔레그램 뉴스 표시 영역 스타일 */

.news-display-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 0; /* 위아래 마진 제거 */
    padding: 12px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative; /* sticky 요소들과 구분되는 positioning context */
}

.news-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.news-text {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    flex: 1;
    max-width: 600px;
    line-height: 1.4;
}

/* 전광판 애니메이션 제거 - 더 이상 사용 안함 */

/* 액션 버튼들 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.news-toggle-btn, .search-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-toggle-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.news-toggle-btn:hover, .search-toggle-btn:hover {
    transform: translateY(-1px);
}

.news-toggle-btn:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-toggle-btn:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.news-toggle-btn:active, .search-toggle-btn:active {
    transform: translateY(0);
}

.news-toggle-btn i, .search-toggle-btn i {
    font-size: 11px;
}

.news-toggle-btn span, .search-toggle-btn span {
    font-weight: 500;
}

/* 확장된 뉴스 패널 */
.expanded-news-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 110; /* 푸터(z-index: 100)보다 높게 */
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.expanded-news-panel.show {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 42px; /* 푸터 정확한 높이: padding(20px) + content + box-shadow = 42px */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.news-panel-container {
    background: var(--dark-bg);
    color: white;
    border-radius: 8px 8px 0 0; /* 상단에만 둥근 모서리 */
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 15px 0;
    min-height: 60px;
    max-height: calc(50vh - 80px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15); /* 위쪽으로 그림자 추가 */
    animation: slideUpFast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: none;
    position: relative;
    z-index: 111; /* 배경 패널보다도 높게 */
    margin-bottom: 0;
}

.news-panel-header {
    background: rgba(255, 255, 255, 0.1); /* 푸터와 유사한 반투명 배경 */
    color: white;
    padding: 15px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.news-panel-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.news-panel-header h3 i {
    margin-right: 10px;
    color: #667eea;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.news-content {
    flex: 1;
    overflow: hidden;
    max-width: 1400px; /* 푸터 컨테이너와 동일한 제한 */
    margin: 0 auto; /* 중앙 정렬 */
    padding: 0 20px; /* 푸터와 동일한 좌우 패딩 */
    width: 100%;
}

.news-simple-text {
    color: white;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .news-display-container {
        margin: 0; /* 모바일에서도 위아래 마진 제거 */
        padding: 10px 12px;
    }
    
    .news-content-wrapper {
        gap: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .news-text {
        font-size: 12px;
        max-width: none;
        text-align: left;
    }
    
    .news-toggle-btn {
        padding: 6px 10px;
        font-size: 11px;
        align-self: center;
    }
    
    .news-panel-container {
        width: 100%; /* 모바일에서도 전체 너비 */
        max-height: calc(70vh - 80px); /* 데스크탑과 동일한 높이 계산 */
        margin: 0; /* 여백 제거 */
        padding: 0 15px; /* 작은 패딩 */
        border-radius: 8px 8px 0 0; /* 푸터와 일치 */
    }
    
    .news-panel-header {
        padding: 15px 20px;
    }
    
    .news-panel-header h3 {
        font-size: 18px;
    }
    
    .news-content {
        padding: 20px;
    }
}

/* 뉴스 영역 호버 효과 */
.news-display-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* 뉴스 아이템 스타일 */
.news-item {
    background: rgba(255, 255, 255, 0.1); /* 푸터와 유사한 반투명 배경 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    color: white;
}

.news-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.news-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.news-item-title {
    font-weight: 600;
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.news-item-content {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.news-item-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 새로운 단순화된 뉴스 아이템 스타일 */
.news-item-simple {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.news-item-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.news-item-title-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.news-item-time-simple {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.news-item-source {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

/* 검색 모달 스타일 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1350; /* 뉴스 패널보다 높은 z-index */
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.search-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100vh);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpFast {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.search-modal-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.search-modal-header h3 i {
    margin-right: 10px;
    color: #28a745;
}

.search-modal-body {
    padding: 30px 25px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.search-type {
    flex-shrink: 0;
}

.search-type select {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-type select:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

#searchInput {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    background: #ffffff;
}

#searchInput::placeholder {
    color: #999;
    font-size: 14px;
}

#searchButton {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#searchButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#searchButton:active {
    transform: translateY(0);
}

.search-tips {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
}

.search-tips p {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.search-tips p i {
    color: #ffc107;
    margin-right: 8px;
}

.search-tips ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.search-tips li {
    position: relative;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 6px;
}

.search-tips li:before {
    content: "•";
    color: #28a745;
    font-weight: bold;
    position: absolute;
    left: -15px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .search-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .search-modal-header {
        padding: 15px 20px;
    }
    
    .search-modal-header h3 {
        font-size: 18px;
    }
    
    .search-modal-body {
        padding: 20px;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .search-type {
        order: -1;
    }
    
    #searchInput {
        font-size: 16px; /* iOS 줌 방지 */
    }
}

/* 실시간 뉴스 하이라이트 효과 */
.news-highlight {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52, #ff6b6b) !important;
    background-size: 200% 200% !important;
    animation: newsHighlight 2s ease-in-out infinite !important;
    color: white !important;
    font-weight: bold !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

@keyframes newsHighlight {
    0%, 100% {
        background-position: 0% 50%;
        transform: scale(1);
    }
    50% {
        background-position: 100% 50%;
        transform: scale(1.02);
    }
}

/* 새로운 뉴스 아이템 스타일 */
.news-new {
    border-left: 4px solid #ff6b6b !important;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(238, 90, 82, 0.05) 100%) !important;
    animation: fadeInNews 0.5s ease-out;
}

@keyframes fadeInNews {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 뉴스 모달 스타일 */
.news-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.news-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.news-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.news-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    padding-right: 20px;
}

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

.news-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.news-modal-body {
    padding: 25px;
}

.news-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}

.news-channel {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.news-time {
    color: #666;
    font-weight: 500;
}

.news-importance {
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.news-content {
    line-height: 1.6;
    font-size: 15px;
    color: #333;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.news-stocks, .news-categories {
    margin-bottom: 15px;
    padding: 12px;
    background: #e9ecef;
    border-radius: 8px;
    font-size: 14px;
}

.news-stocks strong, .news-categories strong {
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.news-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-news-url {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-news-url:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-close {
    background: #6c757d;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* 뉴스 아이템 클릭 효과 */
.news-item-content {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 6px;
}

.news-item-content:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .news-modal-content {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
    }
    
    .news-modal-header {
        padding: 15px 20px;
    }
    
    .news-modal-header h3 {
        font-size: 16px;
    }
    
    .news-modal-body {
        padding: 20px;
    }
    
    .news-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .news-modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .btn-news-url, .btn-close {
        width: 100%;
        justify-content: center;
    }
}

/* 패널 내 검색 UI 스타일 (컴팩트 크기) */
.panel-search-container {
    padding: 12px;
    color: white;
}

.panel-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* 검색 타입 선택기 제거로 인한 스타일 삭제 */

#panelSearchInput {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    transition: all 0.3s ease;
}

#panelSearchInput:focus {
    outline: none !important;
    border-color: rgba(46, 204, 113, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2) !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

#panelSearchInput::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

#panelSearchButton {
    background: rgba(46, 204, 113, 0.8) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    font-weight: 500;
}

#panelSearchButton:hover {
    background: rgba(46, 204, 113, 1) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4) !important;
}

#panelSearchButton:active {
    transform: translateY(0);
}

#backToNewsButton {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
}

#backToNewsButton:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-1px);
}

.panel-search-tips {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 12px;
    border-left: 3px solid rgba(46, 204, 113, 0.8);
}

/* 모바일에서의 패널 검색 반응형 */
@media (max-width: 768px) {
    .panel-search-box {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    #panelSearchInput {
        margin: 0 !important;
    }
    
    #panelSearchButton {
        margin-left: 0 !important;
    }
    
    .panel-search-tips {
        font-size: 10px;
        padding: 6px 8px;
    }
}