﻿/* ===== 우측 사이드바 토글 CSS ===== */

/* 축소된 상태 */
.right-sidebar.collapsed {
    transform: translateX(100%);
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
}

/* 토글 버튼 스타일 개선 */
.chart-header-sidebar-toggle {
    border-radius: 4px;
    padding: 8px 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

    .chart-header-sidebar-toggle:hover {
        transform: scale(1.1);
        color: #fa4646;
        background-color: rgba(250, 70, 70, 0.1);
    }

    .chart-header-sidebar-toggle i {
        font-size: 21px;
        transition: transform 0.3s ease;
    }

/* 차트 영역 조정 */
.chart-container, .main-chart-area {
    transition: margin-right 0.3s ease, width 0.3s ease;
}

/* 우측 사이드바가 접혀있을 때 차트 영역 확장 */
.right-sidebar.collapsed ~ .chart-container,
.right-sidebar.collapsed + .chart-container {
    margin-right: 0;
    width: calc(100% - 280px);
}

/* 메인 콘텐츠 영역 조정 */
.main-content {
    transition: margin-right 0.3s ease;
}

.right-sidebar.collapsed ~ .main-content {
    margin-right: 0;
}

/* iframe 영역 조정 */
.right-sidebar.collapsed #CalendarContent,
.right-sidebar.collapsed #EconomicIndicatorContent {
    width: calc(100vw - 280px);
    transition: width 0.3s ease;
}

/* 디버깅용 (임시) */
.right-sidebar {
    border-left: 2px solid #333; /* 경계선으로 영역 확인 */
}

    .right-sidebar.collapsed {
        border-left: none;
    }

/* ===== 개선된 호가창 CSS ===== */

/* 기본 컨테이너 설정 - 사이드바 내부에서 작동 */
#HogaSection {
    height: 100% !important;
    width: 100% !important;
    overflow: hidden;
    background: #000;
    position: relative;
}

/* 메인 호가창 컨테이너 - 마진 추가 */
.mobile-hoga-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: #1a1a1a;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    position: relative;
    padding: 5px; /* 전체 컨테이너에 패딩 추가 */
}

/* 종목 정보 헤더 - 마진 개선 */
.stockorder-header {
    padding: 16px 20px;
    flex-shrink: 0;
    background: #12121212;
    border-radius: 8px 8px 0 0;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stock-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.stock-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.stock-code {
    font-size: 14px;
    color: #ccc;
    font-weight: 500;
    background: linear-gradient(135deg, #333, #444);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #555;
}

.market-badge {
    font-size: 14px;
    color: #ccc;
    background: linear-gradient(135deg, #444, #555);
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: auto;
    border: 1px solid #666;
}

.price-info-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}

.current-price {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.change-info {
    font-size: 17px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.volume-info {
    font-size: 16px;
    color: #ccc;
    margin-left: auto;
}

.additional-info-row {
    display: flex;
    gap: 20px;
    font-size: 15px;
    color: #ccc;
}

/* 메인 컨텐츠 영역 - 마진 개선 */
.main-content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
    max-height: 60vh;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 좌측 호가 섹션 개선 */
.left-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 250px;
    height: 100%;
    overflow: hidden;
    transition: min-width 0.3s ease;
    background: linear-gradient(180deg, #1a1a1a 0%, #1e1e1e 100%);
    border-radius: 8px 0 0 8px;
    padding: 8px;
}

/* 호가 섹션 */
.hoga-section {
    flex: 1;
    overflow-y: hidden;
    padding: 0;
    min-height: 0;
    height: 100%;
}

    /* 수정요구사항 2) - 호가 스크롤바 완전히 숨기기 */
    .hoga-section::-webkit-scrollbar {
        display: none;
        width: 0;
    }

.hoga-section {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* 호가 리스트 개선 - 수정요구사항 2) 반영 */
#hogaList {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, #1a1a1a 0%, #1e1e1e 100%);
    border-radius: 6px;
    /* 수정요구사항 2) - 스크롤바 완전히 숨기기 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}


    /* 웹킷 기반 브라우저에서 스크롤바 숨기기 */
    #hogaList::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

/* 호가 아이템 - 테이블 형태로 개선 */
.hoga-item {
    display: flex;
    align-items: center;
    padding: 0;
    margin-bottom: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    min-height: 40px;
    position: relative;
    overflow: hidden;
    border: none;
}

/* 호가 내용 레이아웃 - 표 형태 (가격 세로 배치) */
.hoga-content {
    display: grid;
    grid-template-columns: 55px 85px 105px;
    align-items: center;
    width: 100%;
    gap: 0;
    height: 55px;
    padding: 0 12px;
}

/* 각 셀 스타일 */
.hoga-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    justify-content: center;
    padding: 4px 0;
    height: 100%;
}

.hoga-center {
    text-align: right;
    padding: 4px 8px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.hoga-right {
    text-align: right;
    padding: 4px 4px;
}

/* 체결량 차이 표시 개선 */
.hoga-diff {
    font-size: 12px;
    font-weight: 400;
    padding: 2px 4px;
    border-radius: 3px;
    min-height: 14px;
    text-align: center;
    display: inline-block;
    min-width: 28px;
    background: transparent;
    border: 1px solid transparent;
    line-height: 1;
}

.diff-red {
    color: #ff6b7d !important;
    background: rgba(255, 107, 125, 0.25);
    border-color: rgba(255, 107, 125, 0.5);
    box-shadow: 0 1px 3px rgba(255, 107, 125, 0.2);
}

.diff-dblue {
    color: #4dabf7 !important;
    background: rgba(77, 171, 247, 0.25);
    border-color: rgba(77, 171, 247, 0.5);
    box-shadow: 0 1px 3px rgba(77, 171, 247, 0.2);
}

/* 호가 텍스트 스타일 개선 */
.hoga-price {
    font-size: 17px;
    font-weight: 450;
    color: #fff;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.hoga-volume {
    font-size: 14px;
    font-weight: 450;
    text-align: left;
    margin-top: 1px;
}

.sell-volume {
    color: #ff8a95;
}

.buy-volume {
    color: #74c0fc;
}

.hoga-change {
    font-size: 12px;
    font-weight: 450;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* 매도/매수 호가 배경 개선 */
.sell-item {
    background: linear-gradient(90deg, rgba(255, 107, 125, 0.2) 0%, rgba(255, 107, 125, 0.1) 50%, rgba(255, 107, 125, 0.05) 100%);
    border-left: 3px solid rgba(255, 107, 125, 0.6);
}

.buy-item {
    background: linear-gradient(90deg, rgba(77, 171, 247, 0.05) 0%, rgba(77, 171, 247, 0.1) 50%, rgba(77, 171, 247, 0.2) 100%);
    border-right: 3px solid rgba(77, 171, 247, 0.6);
}

/* 현재가 하이라이트 강화 */
.current-price-item {
    border: 2px solid #ffd43b !important;
    background: linear-gradient(90deg, rgba(255, 212, 59, 0.3) 0%, rgba(255, 212, 59, 0.2) 50%, rgba(255, 212, 59, 0.3) 100%) !important;
    animation: currentPriceFlash 1.5s ease-in-out infinite;
    z-index: 10;
    border-radius: 4px !important;
    position: relative;
    box-shadow: 0 2px 8px rgba(255, 212, 59, 0.4);
}

@keyframes currentPriceFlash {
    0%, 100% {
        border-color: #ffd43b;
        box-shadow: 0 2px 8px rgba(255, 212, 59, 0.4);
    }

    50% {
        border-color: #fff176;
        box-shadow: 0 2px 12px rgba(255, 212, 59, 0.6);
    }
}

/* 상한가/하한가 스타일 개선 */
.limit-item {
    border: 2px solid;
    font-weight: bold;
    position: relative;
    z-index: 5;
    margin: 4px 0;
    border-radius: 6px;
}

.upper-limit {
    background: linear-gradient(90deg, rgba(255, 107, 125, 0.35) 0%, rgba(255, 107, 125, 0.25) 50%, rgba(255, 107, 125, 0.35) 100%) !important;
    border-color: #ff6b7d;
    box-shadow: 0 3px 10px rgba(255, 107, 125, 0.4);
}

.lower-limit {
    background: linear-gradient(90deg, rgba(77, 171, 247, 0.35) 0%, rgba(77, 171, 247, 0.25) 50%, rgba(77, 171, 247, 0.35) 100%) !important;
    border-color: #4dabf7;
    box-shadow: 0 3px 10px rgba(77, 171, 247, 0.4);
}

.limit-label {
    font-size: 11px;
    font-weight: bold;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 가격 색상 */
.up, .price-up {
    color: #ff6b7d !important;
    text-shadow: 0 1px 2px rgba(255, 107, 125, 0.3);
}

.down, .price-down {
    color: #4dabf7 !important;
    text-shadow: 0 1px 2px rgba(77, 171, 247, 0.3);
}

.same, .price-same {
    color: #f8f9fa !important;
    text-shadow: 0 1px 2px rgba(248, 249, 250, 0.2);
}

/* 우측 체결내역 섹션 개선 */
.right-section {
    width: 213px;
    background: linear-gradient(135deg, #212529, #2d3436);
    border-left: 1px solid #495057;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
    padding: 8px;
}

/* 체결내역 섹션 */
.execution-section {
    background: transparent;
    height: 100%;
    border-bottom: none;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.execution-header {
    background: linear-gradient(135deg, #2d3436, #373c3f);
    color: #f8f9fa;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-bottom: 1px solid #495057;
    flex-shrink: 0;
}

.execution-list {
    flex: 1;
    overflow-y: auto;
    padding:8px;
    min-height: 0;
    background: #12121212;
    border-radius: 0 0 6px 6px;
    margin-top:8px;
}

/* 체결내역 아이템 개선 */
.execution-item {
    display: grid;
    grid-template-columns: 85px 65px 45px;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #2a2a2a, #323232);
    border-radius: 4px;
    font-size: 15px;
    font-weight: 450;
    min-height: 45px;
    border: 1px solid #404040;
    transition: background 0.2s ease;
}

    .execution-item:hover {
        background: linear-gradient(90deg, #323232, #3a3a3a);
        border-color: #555;
    }

.execution-price {
    font-size: 15px;
    font-weight: 450;
    text-align: right;
}

.execution-volume {
    font-size: 15px;
    color: #ced4da;
    text-align: right;
}

.execution-type {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}

/* 데이터 없음 메시지 */
.no-execution-data {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    background: linear-gradient(180deg, #212529, #2d3436);
    border-radius: 0 0 6px 6px;
}

/* 주문 영역 마진 및 스타일 개선 */
.order-area {
    background: linear-gradient(135deg, #212529, #2d3436);
    border-top: none;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 350px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin: 0 4px 4px 4px; /* 주문 영역에 마진 추가 */
}

/* 주문 탭 개선 */
.order-tabs {
    display: flex;
    border-bottom: 1px solid #495057;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.order-tab {
    flex: 1;
    padding: 14px 16px;
    background: linear-gradient(135deg, #2a2a2a, #343a40);
    border: none;
    color: #adb5bd;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    border-right: 1px solid #495057;
}

    .order-tab:last-child {
        border-right: none;
    }

    .order-tab:hover {
        background: linear-gradient(135deg, #343a40, #495057);
        color: #f8f9fa;
    }

    .order-tab.active.buy {
        background: linear-gradient(135deg, #dc3545, #c82333);
        color: #fff;
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    }

    .order-tab.active.sell {
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: #fff;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    }

/* 주문 폼 컨테이너 개선 */
.order-form-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 4px;
}

/* 주문 유형 섹션 */
.order-type-section {
    padding: 12px 16px;
    border-bottom: 1px solid #495057;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(42, 42, 42, 0.5), rgba(51, 51, 51, 0.3));
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-size: 12px;
    color: #ccc;
    font-weight: 500;
}

.order-type-select {
    background: linear-gradient(135deg, #333, #444);
    border: 1px solid #555;
    color: #fff;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

    .order-type-select:focus {
        border-color: #dc3545;
        outline: none;
        box-shadow: 0 0 6px rgba(220, 53, 69, 0.3);
    }

/* 입력 섹션 */
.input-section {
    padding: 12px 16px;
    border-bottom: 1px solid #495057;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.8), rgba(36, 36, 36, 0.5));
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .input-group label {
        font-size: 12px;
        color: #ccc;
        font-weight: 500;
    }

.input-with-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-input, .quantity-input {
    flex: 1;
    background: linear-gradient(135deg, #333, #3a3a3a);
    border: 2px solid #555;
    color: #fff;
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 4px;
    text-align: right;
    font-weight: bold;
    transition: all 0.2s ease;
}

    .price-input:focus, .quantity-input:focus {
        border-color: #dc3545;
        outline: none;
        box-shadow: 0 0 6px rgba(220, 53, 69, 0.3);
        background: linear-gradient(135deg, #3a3a3a, #444);
    }

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.control-btn {
    background: linear-gradient(135deg, #444, #555);
    border: 1px solid #555;
    color: #fff;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 9px;
    border-radius: 2px;
    width: 24px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

    .control-btn:hover {
        background: linear-gradient(135deg, #555, #666);
        border-color: #dc3545;
        transform: scale(1.05);
    }

.input-unit {
    font-size: 10px;
    color: #888;
    min-width: 20px;
}

/* 주문 요약 */
.order-summary {
    padding: 10px 16px;
    background: linear-gradient(135deg, #333, #3a3a3a);
    margin: 0 16px 12px;
    border-radius: 4px;
    border: 1px solid #444;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.summary-label {
    color: #ccc;
    font-weight: 500;
}

.summary-value {
    font-weight: bold;
    color: #fff;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 주문 버튼 */
.order-submit {
    margin: 0 16px 16px;
    padding: 14px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

    .order-submit.buy {
        background: linear-gradient(135deg, #dc3545, #c82333);
        color: #fff;
        box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
    }

    .order-submit.sell {
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: #fff;
        box-shadow: 0 3px 12px rgba(0, 123, 255, 0.3);
    }

    .order-submit:hover {
        transform: translateY(-1px);
    }

    .order-submit.buy:hover {
        box-shadow: 0 4px 14px rgba(220, 53, 69, 0.4);
        background: linear-gradient(135deg, #e4606d, #dc3545);
    }

    .order-submit.sell:hover {
        box-shadow: 0 4px 14px rgba(0, 123, 255, 0.4);
        background: linear-gradient(135deg, #339af0, #007bff);
    }

/* 데이터 없음 메시지 스타일 */
.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80%;
    min-height: 300px;
    padding: 40px 20px;
    text-align: center;
    color: #888;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.8), rgba(36, 36, 36, 0.5));
    border-radius: 8px;
    margin: 20px;
    border: 1px solid #333;
}

    .no-data-message.error {
        border-color: #dc3545;
        background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.no-data-icon, .error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.message-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-title {
    font-size: 16px;
    font-weight: bold;
    color: #ccc;
}

.message-subtitle {
    font-size: 16px;
    color: #fff;
    line-height: 1.4;
}

.no-data-message.error .message-title {
    color: #ff8a95;
}

.no-data-message.error .message-subtitle {
    color: #ff6b7a;
}

/* 스크롤바 스타일링 - 다른 영역은 유지 */
.execution-list::-webkit-scrollbar,
.order-form-container::-webkit-scrollbar {
    width: 6px;
}

.execution-list::-webkit-scrollbar-track,
.order-form-container::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.execution-list::-webkit-scrollbar-thumb,
.order-form-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #555, #666);
    border-radius: 3px;
}

    .execution-list::-webkit-scrollbar-thumb:hover,
    .order-form-container::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #666, #777);
    }

/* 반응형 조정 */
@media (max-width: 768px) {
    .mobile-hoga-container {
        padding: 4px;
    }

    .stockorder-header {
        padding: 12px 16px;
    }

    .stock-name {
        font-size: 16px;
    }

    .current-price {
        font-size: 20px;
    }

    .hoga-content {
        grid-template-columns: 45px 70px 90px;
        padding: 0 8px;
    }

    .hoga-price {
        font-size: 13px;
    }

    .hoga-volume {
        font-size: 10px;
    }

    .hoga-change {
        font-size: 9px;
    }

    .hoga-diff {
        font-size: 10px;
        min-width: 22px;
    }

    .right-section {
        width: 180px;
    }

    .order-area {
        margin: 0 2px 2px 2px;
    }
}

/* 애니메이션 성능 최적화 */
@media (prefers-reduced-motion: reduce) {
    .current-price-item,
    .hoga-diff {
        animation: none;
    }

    .hoga-item {
        transition: none;
    }
}

/* 접근성 개선 */
.hoga-item:focus {
    outline: 2px solid #ffd43b;
    outline-offset: 2px;
}
