/* ==================================================================
   연말 결산(뉴스) 모달
   구 style.css 1461~2298줄
   ⚠️ 파일명 번호 = 로드 순서. 뒤 파일이 앞을 덮어쓰므로 순서를 바꾸면 화면이 깨진다.
   ================================================================== */
/* --- Market Close Alert (New) --- */
.market-close-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #ff4d4d;
    border-radius: 2px;
    padding: 30px 50px;
    z-index: 5000;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 77, 77, 0.5);
    display: none;
    /* JS로 제어 */
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.5s;
}

.market-close-alert.show {
    display: flex;
    opacity: 1;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.market-close-text {
    color: #ff4d4d;
    font-size: 3rem;
    font-weight: 900;
    text-shadow: 0 0 10px #ff4d4d;
}

.market-close-sub {
    color: #fff;
    font-size: 1.2rem;
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* --- News Modal Styles --- */
.news-modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    padding: 30px;
    border-radius: 2px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    width: 95%;
    max-width: 1400px;
    max-height: 85vh !important;
    /* 최대 높이 설정 */
    overflow-y: auto !important;
    /* 스크롤 활성화 */
    overflow-x: hidden;
    /* 가로 스크롤 방지 */
    display: flex;
    flex-direction: column;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* 스크롤바 디자인 (다크 테마) */
.news-modal-content::-webkit-scrollbar {
    width: 8px;
}

.news-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.news-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 4px;
}

.news-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}

/* 카드뉴스 닫기 버튼 투명 디자인 - 모든 클래스명 포함 */
.news-modal-close-btn,
#news-modal .close-modal-btn,
.close-btn-fixed {
    background: transparent !important;
    border: 2px solid #fff !important;
    color: #fff !important;
    box-shadow: none !important;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    transition: all 0.3s ease;
}

/* X 버튼 스타일 (고정 위치) */
.close-btn-fixed {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 10000 !important;
}

.news-modal-close-btn:hover,
#news-modal .close-modal-btn:hover,
.close-btn-fixed:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4) !important;
}

.news-modal-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.news-modal-header h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.news-modal-subtitle {
    font-size: 1.1rem;
    color: #aaa;
    margin: 0;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.news-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 2px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
    position: relative;
    overflow: hidden;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.3);
}

.news-stock-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-stock-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.news-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    border-left: 3px solid rgba(255, 215, 0, 0.5);
    min-height: 80px;
}

.news-percentage-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    padding: 20px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.news-percentage-display.rise {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.4);
}

.news-percentage-display.fall {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 30px rgba(79, 172, 254, 0.4);
}

.news-percentage-icon {
    font-size: 2rem;
    margin-right: 15px;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.news-percentage-value {
    font-size: 3rem;
    font-weight: 900;
    font-family: 'Noto Sans KR', monospace;
}

.news-percentage-label {
    font-size: 1.2rem;
    margin-left: 10px;
    opacity: 0.9;
}

.reversal-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 8px 15px;
    border-radius: 2px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.news-modal-close-btn {
    padding: 12px 30px;
    background: transparent !important;
    /* 투명 배경 */
    border: 2px solid #fff !important;
    /* 흰색 테두리 */
    border-radius: 50px;
    color: #fff !important;
    /* 흰색 글씨 */
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.news-modal-close-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15) !important;
    /* 호버시 약간 밝게 */
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
}

/* Medium screens (tablets) */
@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Tablet: 3 columns */
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .news-modal-content {
        padding: 15px 10px;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        overflow-y: auto;
    }

    .news-modal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .news-modal-header h2 {
        font-size: 1.8rem;
    }

    .news-modal-subtitle {
        font-size: 0.9rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
        /* Mobile: single column */
        gap: 15px;
        margin-bottom: 20px;
    }

    .news-card {
        padding: 20px;
    }

    .news-stock-name {
        font-size: 1.3rem;
    }

    .news-stock-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .news-content {
        font-size: 0.95rem;
        padding: 12px;
        min-height: 70px;
    }

    .news-percentage-display {
        padding: 15px;
    }

    .news-percentage-icon {
        font-size: 1.5rem;
        margin-right: 10px;
    }

    .news-percentage-value {
        font-size: 2.5rem;
    }

    .news-percentage-label {
        font-size: 1rem;
    }

    .reversal-badge {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .news-modal-close-btn {
        padding: 10px 25px;
        /* 모바일에서 더 작게 */
        font-size: 0.95rem;
        width: 100%;
        max-width: 300px;
    }
}

/* Extra small screens (phones in landscape) */
@media (max-width: 480px) {
    .news-modal-content {
        padding: 15px 10px;
    }

    .news-modal-header h2 {
        font-size: 1.5rem;
    }

    .news-modal-subtitle {
        font-size: 0.85rem;
    }

    .news-card {
        padding: 15px;
    }

    .news-stock-name {
        font-size: 1.1rem;
        gap: 8px;
    }

    .news-stock-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .news-content {
        font-size: 0.9rem;
        padding: 10px;
        line-height: 1.5;
    }

    .news-percentage-value {
        font-size: 2rem;
    }

    .news-percentage-icon {
        font-size: 1.3rem;
    }

    .reversal-badge {
        font-size: 0.75rem;
        padding: 5px 10px;
        top: 8px;
        right: 8px;
    }
}

/* News Modal - Market Header */
.market-header-card {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border: 1px solid #4a90e2;
    border-radius: 2px;
    padding: 15px 20px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    animation: slideDown 0.5s ease-out;
}

.market-badge {
    background: #ffd700;
    color: #000;
    font-weight: 900;
    padding: 5px 15px;
    border-radius: 2px;
    font-size: 1.1rem;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.market-content {
    font-size: 1.2rem;
    line-height: 1.5;
    color: #fff;
    font-weight: 500;
}

/* Stock Card Animations */
@keyframes flashGreen {
    0% {
        background-color: rgba(255, 0, 0, 0);
    }

    50% {
        background-color: rgba(255, 0, 0, 0.3);
    }

    /* KR Red for Rise */
    100% {
        background-color: rgba(255, 0, 0, 0);
    }
}

@keyframes flashBlue {
    0% {
        background-color: rgba(0, 0, 255, 0);
    }

    50% {
        background-color: rgba(0, 0, 255, 0.3);
    }

    /* KR Blue for Fall */
    100% {
        background-color: rgba(0, 0, 255, 0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.animate-flash-red {
    animation: flashGreen 1s ease-in-out infinite;
    /* flashGreen acts as Red in KR context logic above, but let's fix naming */
}

/* Let's fix naming to avoid confusion. flashGrid -> flashUp (Red), flashBlue -> flashDown (Blue) */
@keyframes flashUp {
    0% {
        box-shadow: 0 0 0 transparent;
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 50, 50, 0.8) inset;
    }

    100% {
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes flashDown {
    0% {
        box-shadow: 0 0 0 transparent;
    }

    50% {
        box-shadow: 0 0 20px rgba(50, 50, 255, 0.8) inset;
    }

    100% {
        box-shadow: 0 0 0 transparent;
    }
}

.animate-flash-red {
    animation: flashUp 1.5s infinite;
}

.animate-flash-blue {
    animation: flashDown 1.5s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
    border: 2px solid red !important;
}

.stock-change-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.change-val {
    font-size: 1.2rem;
    font-weight: bold;
}

.change-pct {
    font-size: 0.9rem;
    opacity: 0.8;
}

.news-price-display {
    font-size: 1.5rem;
    font-weight: 900;
    text-align: right;
    margin: 5px 0;
    color: #ffd700;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    align-self: flex-end;
}

.news-card {
    align-items: stretch !important;
    /* Override flex align */
}

/* Delist Badge */
.delist-badge {
    background: #ff0000;
    color: white;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 10px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Enhanced Info Shop Design */
.info-card {
    border: 2px solid #444;
    border-radius: 2px;
    padding: 16px;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    border-color: #ffd700;
}

.info-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
}

.reveal-box {
    position: relative;
    min-height: 80px;
    background: #333;
    border-radius: 2px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px dashed #555;
}

.reveal-box:hover {
    border-color: #ffd700;
    background: #3a3a3a;
}

.reveal-box .click-guide {
    display: block;
    text-align: center;
    color: #ffd700;
    font-size: 1rem;
    font-weight: 600;
    padding: 20px;
    animation: pulse 2s infinite;
}

.reveal-box .reveal-text {
    display: none;
    color: #fff;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.reveal-box.revealed .click-guide {
    display: none;
}

.reveal-box.revealed .reveal-text {
    display: block;
}

.reveal-box.revealed {
    background: linear-gradient(135deg, #2a4858 0%, #1e3a4a 100%);
    border-style: solid;
    border-color: #4a90e2;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Improved Price Tags */
.price-tag {
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 2px;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.price-low {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.price-mid {
    background: linear-gradient(135deg, #28a745, #218838);
}

.price-high {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000;
}

.price-max {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Shop Tabs Enhancement */
.shop-tab {
    padding: 12px 18px;
    background: linear-gradient(135deg, #444, #555);
    border: 2px solid transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.shop-tab:hover {
    background: linear-gradient(135deg, #555, #666);
    transform: translateY(-1px);
}

.shop-tab.active {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-weight: bold;
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

/* Enhanced Market Briefing Readability */
.market-header-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 2px;
    padding: 20px 25px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.market-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-weight: 900;
    padding: 8px 20px;
    border-radius: 2px;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    display: inline-block;
    margin-bottom: 15px;
}

.market-content {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #fff;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 2px;
    border-left: 4px solid #ffd700;
}
