/* ==================================================================
   푸터 · 뉴스티커 · 컨트롤바 · 버튼 · 모달 틀 · 설정 패널
   구 style.css 482~993줄
   ⚠️ 파일명 번호 = 로드 순서. 뒤 파일이 앞을 덮어쓰므로 순서를 바꾸면 화면이 깨진다.
   ================================================================== */
/* --- Footer --- */
.floating-footer {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    background: var(--ns-glass-bg, rgba(22, 27, 46, 0.85));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    box-shadow: var(--ns-shadow-float, 0 -4px 20px rgba(0, 0, 0, 0.5));
    display: none;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: 30px;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 모드가 활성화되었을 때만 하단 바 표시 */
body.admin-mode .floating-footer,
body.tv-mode .floating-footer,
body.viewer-mode .floating-footer {
    display: flex;
}


.news-ticker-container {
    height: 30px;
    background: rgba(0, 240, 255, 0.06);
    border-top: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-bottom: 1px solid var(--ns-border-subtle, rgba(255, 255, 255, 0.06));
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    z-index: 2001;
}

.ticker-label {
    background: var(--ns-gradient-accent, linear-gradient(135deg, #00f0ff, #bd00ff));
    color: #000;
    font-weight: bold;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.ticker-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
    color: #fff;
    font-size: 0.85rem;
    line-height: 30px;
}

.news-item {
    margin-right: 30px;
}

.news-up {
    color: var(--ns-color-up, #ff3366);
}

.news-down {
    color: var(--ns-color-down, #3388ff);
}

@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

.controls {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2002;
}

/* Modified for Identical Layout */
.tv-mode .controls,
.viewer-mode .controls {
    /* 관전/송출 모드에서는 하단 바(회색바) 자체를 제거하고 NEWS만 남김 */
    display: none !important;
}

.tv-mode .controls button,
.viewer-mode .controls button,
.tv-mode .controls .button-group,
.viewer-mode .controls .button-group {
    visibility: hidden !important;
    /* Hide buttons but keep layout space if needed, or display:none if we just want the bar */
    display: none !important;
    /* Actually, we want to hide them completely to avoid clicking, but keep the bar height? 
                               No, user wants "Copy Everything". The best way is to keep the bar structure. */
}

/* Ensure Round Display is Visible */
/* Ensure Round Display is HIDDEN explicitly as per user request */
.tv-mode #round-display-group,
.viewer-mode #round-display-group {
    display: none !important;
}

.tv-mode #round-display,
.viewer-mode #round-display {
    display: none !important;
}

#round-display {
    margin: 0;
    font-size: 1rem;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
}

.button-group {
    display: flex;
    gap: 5px;
    position: relative;
    z-index: 2003;
}

.sub-btn {
    padding: 12px 15px;
    font-size: 0.9rem;
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    border-radius: var(--ns-radius-md, 10px);
    cursor: pointer;
    color: var(--ns-text-primary, #e0e6ed);
    background: var(--ns-bg-elevated, #1c2333);
    white-space: nowrap;
    flex: 1;
    touch-action: manipulation;
    transition: all var(--ns-transition-fast, 0.15s ease);
}

.sub-btn:hover {
    border-color: var(--ns-accent-cyan, #00f0ff);
    box-shadow: var(--ns-glow-cyan, 0 0 12px rgba(0, 240, 255, 0.3));
}

.sub-btn:active {
    transform: scale(0.97);
}

.info-btn {
    background: linear-gradient(135deg, var(--ns-accent-blue, #0066ff), #0044cc);
    border-color: transparent;
}

.main-btn {
    padding: 12px 20px;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--ns-radius-md, 10px);
    cursor: pointer;
    font-weight: bold;
    color: white;
    background: var(--ns-gradient-success, linear-gradient(135deg, #00e676, #00c853));
    box-shadow: 0 2px 10px rgba(0, 230, 118, 0.25);
    white-space: nowrap;
    flex: 1;
    touch-action: manipulation;
    transition: all var(--ns-transition-fast, 0.15s ease);
    letter-spacing: 0.5px;
}

.main-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 230, 118, 0.35);
}

.main-btn:active {
    transform: scale(0.97);
}

.main-btn:disabled {
    background: #2a2a3a;
    cursor: not-allowed;
    color: var(--ns-text-tertiary, #5c6b7f);
    box-shadow: none;
    transform: none;
}

@media (max-width: 768px) {
    .controls {
        gap: 8px;
        padding: 8px;
    }

    .button-group {
        flex: 1.5;
    }

    #round-display-group {
        flex: 0.8;
        background: var(--ns-bg-elevated, #1c2333);
        border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
        border-radius: var(--ns-radius-sm, 6px);
        padding: 5px 0;
    }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--ns-bg-card, #161b2e);
    padding: 15px;
    border-radius: var(--ns-radius-lg, 14px);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--ns-text-primary, #e0e6ed);
    margin: auto;
    box-shadow: var(--ns-shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.6));
}

/* 테마 선택 모달 전용 스타일 */
#theme-modal .modal-content {
    max-width: 420px;
    padding: 18px;
    background: var(--ns-bg-card, #161b2e);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-radius: var(--ns-radius-lg, 14px);
    box-shadow: var(--ns-shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.6));
    height: auto;
    max-height: 80vh;
}

@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        max-height: 85vh !important;
        height: auto !important;
        padding: 10px;
        overflow-y: auto;
    }

    /* 모바일: 설정 영역이 밀리지 않도록 스크롤 처리 */
    .scenario-panel {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 설정 입력 필드 크기 조정 */
    .scenario-panel input[type="number"] {
        min-width: 40px;
    }
}

/* 모달 헤더 공통 — 제목과 X를 같은 축에 두고 아래 구분선으로 마감 */
.ns-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--ns-border-subtle, rgba(255, 255, 255, 0.06));
}

.ns-modal-head h2,
.ns-modal-head h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* 모달 닫기(X) — 제목 우측에 딱 맞게. 예전엔 50x50 + 32px라
   상자가 크게 떠 보이고 제목과 축이 어긋났다. */
.close-btn {
    flex: 0 0 auto;
    /* align-self를 지정하지 않는다 — 부모 헤더의 align-items를 그대로 따르게 */
    background: none;
    border: none;
    color: #8a93a6;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: color 0.15s ease, background 0.15s ease;
}

.close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.scenario-panel {
    background: #2a2a2a;
    padding: 10px;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    border: 1px solid #444;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .scenario-panel {
        padding: 8px;
        gap: 6px;
    }

    .scenario-panel input[type="number"] {
        font-size: 14px !important;
        padding: 6px !important;
    }
}

.scenario-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.scenario-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 80px;
}

.scenario-select {
    background: #444;
    color: white;
    border: 1px solid #666;
    padding: 8px;
    border-radius: 5px;
    font-size: 0.9rem;
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #333;
    padding: 5px 10px;
    border-radius: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #ccc;
}

.radio-label input:checked+span {
    color: #ffd700;
    font-weight: bold;
}

.stock-control-btn {
    background: #555;
    color: white;
    border: 1px solid #777;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.stock-control-btn:hover {
    background: #777;
}

.ai-btn-row {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-direction: row;
}

.ai-gen-btn {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
    border: none;
    font-weight: bold;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
}

.table-wrapper {
    flex-grow: 1;
    overflow: auto;
    border: 1px solid #444;
    margin-bottom: 10px;
    background: #1a1a1a;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
}

th,
td {
    border: 1px solid #444;
    padding: 6px;
    text-align: center;
    color: #ddd;
    font-size: 0.85rem;
    white-space: nowrap;
}

.keyword-input {
    width: 90%;
    background: #444;
    color: #ffd700;
    font-weight: bold;
    border: 1px solid #666;
    cursor: pointer;
}

.keyword-input:focus {
    background: #222;
    border-color: #ffd700;
}

.keyword-input::placeholder {
    color: #888;
    font-weight: normal;
}

input {
    background: #333;
    color: white;
    border: 1px solid #555;
    text-align: center;
    padding: 5px;
    font-size: 0.85rem;
}

.prob-input {
    width: 40px;
}

.name-input {
    width: 70px;
}

.num-input {
    width: 50px;
}
