/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #000000;
    color: #ffffff;
    overflow-x: hidden;
    padding: 0 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 스타일 */
header {
    background-color: #0a0a0a;
    padding: 25px 30px;
    border: 1px solid #222;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    color: #00d632;
    font-size: 2em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

#userId, #userBalance {
    color: #ccc;
}

#userBalance {
    font-weight: bold;
    color: #00d632;
}

.daily-check-btn {
    background-color: #00d632;
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.daily-check-btn:hover {
    background-color: #00a028;
}

.daily-check-btn:disabled {
    background-color: #444;
    color: #888;
    cursor: not-allowed;
}

.share-result-btn {
    background-color: #0066cc;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.share-result-btn:hover {
    background-color: #0052a3;
}

.bankruptcy-btn {
    background-color: #ff3b3b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.bankruptcy-btn:hover {
    background-color: #cc0000;
}

/* 메인 레이아웃 */
main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    flex: 1;
}

.left-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* 차트 섹션 */
.chart-section {
    background-color: #0a0a0a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chart-controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeframe-buttons {
    display: flex;
    gap: 10px;
}

.indicator-buttons {
    display: flex;
    gap: 10px;
}

.timeframe-btn {
    background-color: #1a1a1a;
    color: #ccc;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.timeframe-btn:hover {
    background-color: #2a2a2a;
}

.timeframe-btn.active {
    background-color: #00d632;
    color: #000;
    border-color: #00d632;
}

.indicator-btn {
    background-color: #1a1a1a;
    color: #ccc;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.indicator-btn:hover {
    background-color: #2a2a2a;
}

.indicator-btn.active {
    background-color: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.chart-container {
    height: 350px;
    margin-bottom: 20px;
    cursor: grab;
}

.chart-container:active {
    cursor: grabbing;
}

.volume-container {
    height: 120px;
}

.price-info {
    display: flex;
    gap: 20px;
    font-size: 14px;
    margin: 10px 0;
    color: #ccc;
    justify-content: center; /* 가운데 정렬 추가 */
}

/* 호가창 스타일 */
.orderbook-section {
    background-color: #0a0a0a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.orderbook-section h3 {
    margin-bottom: 15px;
    color: #00d632;
}

.orderbook {
    display: flex;
    flex-direction: column;
}

.sell-orders, .buy-orders {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 3px 5px;
    font-size: 12px;
}

.sell-orders .order-row {
    background-color: rgba(255, 59, 59, 0.1);
    color: #ff3b3b;
}

.buy-orders .order-row {
    background-color: rgba(0, 214, 50, 0.1);
    color: #00d632;
}

.spread {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    background-color: #1a1a1a;
    margin: 5px 0;
}

/* 주문 타입 탭 */
.order-type-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
}

.order-type-tab {
    flex: 1;
    padding: 10px;
    background-color: #1a1a1a;
    color: #ccc;
    border: 1px solid #333;
    cursor: pointer;
    transition: all 0.3s;
}

.order-type-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.order-type-tab:last-child {
    border-radius: 0 4px 4px 0;
}

.order-type-tab.active {
    background-color: #00d632;
    color: #000;
    border-color: #00d632;
}

.limit-price-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.limit-price-control label {
    color: #ccc;
}

#limitPrice {
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    font-size: 16px;
}

/* 거래 섹션 */
.trading-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trading-panel, .position-panel {
    background-color: #0a0a0a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.trading-panel h3, .position-panel h3 {
    margin-bottom: 20px;
    color: #00d632;
}

.current-price {
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

#currentPrice {
    color: #00d632;
    font-weight: bold;
}

.trading-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.leverage-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leverage-control label {
    color: #ccc;
}

#leverageSlider {
    width: 100%;
    height: 6px;
    background: #333;
    outline: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#leverageSlider:hover {
    opacity: 1;
}

.amount-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.amount-control label {
    color: #ccc;
}

#investAmount {
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    font-size: 16px;
}

.quick-amount-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.quick-amount {
    background-color: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    padding: 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.quick-amount:hover {
    background-color: #3a3a3a;
    border-color: #00d632;
}

.trading-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.buy-btn, .sell-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
}

.buy-btn {
    background-color: #00d632;
    color: #000;
}

.sell-btn {
    background-color: #ff3b3b;
    color: #fff;
}

.buy-btn:hover, .sell-btn:hover {
    opacity: 0.8;
}

/* 포지션 리스트 */
#positionsList {
    max-height: 300px;
    overflow-y: auto;
}

.no-positions {
    color: #666;
    text-align: center;
    padding: 20px;
}

.position-item {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
}

.position-item.long {
    border-left: 4px solid #00d632;
}

.position-item.short {
    border-left: 4px solid #ff3b3b;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

/* 주문 결과 모달은 더 높은 z-index */
#orderResultModal {
    z-index: 10001;
}

/* 미체결 주문 모달도 같은 z-index */
#pendingOrdersModal {
    z-index: 10001;
}

/* 포지션 정리 모달도 같은 z-index */
#closePositionModal {
    z-index: 10001;
}

.modal-content {
    background-color: #0a0a0a;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #333;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #00d632;
    margin-bottom: 20px;
}

#closeModalBtn {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
}

#closeModalBtn:hover {
    background-color: #444;
}

/* 출석체크 상태 */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin: 20px 0;
    padding: 10px;
}

.attendance-day {
    background-color: #1a1a1a;
    border: 2px solid #333;
    padding: 20px 10px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.attendance-day.checked {
    background-color: #00d632;
    color: #000;
    border-color: #00d632;
    box-shadow: 0 0 10px rgba(0, 214, 50, 0.5);
}

.attendance-day .day-label {
    font-size: 0.9em;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.attendance-day .day-reward {
    font-size: 0.8em;
    display: block;
}

.attendance-day.checked .day-label,
.attendance-day.checked .day-reward {
    color: #000;
}

/* 패널 탭 스타일 */
.panel-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #222;
}

.panel-tab {
    flex: 1;
    padding: 12px 20px;
    background-color: #1a1a1a;
    color: #888;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.panel-tab.active {
    background-color: #00d632;
    color: #000;
}

.panel-tab:hover:not(.active) {
    background-color: #2a2a2a;
    color: #aaa;
}

.news-badge {
    display: inline-block;
    background-color: #ff3b3b;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    margin-left: 5px;
}

.panel-content {
    display: none;
}

.panel-content.active {
    display: block;
}

/* 뉴스 패널 스타일 */
.news-panel {
    background-color: #0a0a0a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 25px;
    height: calc(100vh - 300px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.news-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
}

.news-item {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s;
    cursor: pointer;
}

.news-item:hover {
    transform: translateY(-2px);
    border-color: #555;
}

.news-item.positive {
    border-left: 4px solid #00d632;
}

.news-item.negative {
    border-left: 4px solid #ff3b3b;
}

.news-item.neutral {
    border-left: 4px solid #666;
}

.news-item.unread {
    background-color: #1f1f1f;
}

.news-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px;
}

.news-type {
    font-size: 12px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
}

.positive .news-type {
    background-color: #00d632;
    color: #000;
}

.negative .news-type {
    background-color: #ff3b3b;
    color: #fff;
}

.neutral .news-type {
    background-color: #666;
    color: #fff;
}

.news-time {
    font-size: 12px;
    color: #888;
}

.news-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.news-content {
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
}

.no-news {
    text-align: center;
    color: #666;
    padding: 40px;
}

/* 뉴스 알림 */
.news-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.news-notification.positive {
    border-color: #00d632;
}

.news-notification.negative {
    border-color: #ff3b3b;
}

.news-notification.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.notification-icon {
    font-size: 24px;
}

.notification-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.notification-type {
    font-size: 12px;
    font-weight: bold;
}

.notification-title {
    font-size: 14px;
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.no-positions {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 14px;
}

/* 포지션 테이블 스타일 */
.positions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.positions-table th {
    background: #0d0d0d;
    color: #999;
    font-weight: normal;
    font-size: 12px;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.positions-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #222;
    font-size: 14px;
    color: #ccc;
}

.positions-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.positions-table tr.liquidation-warning {
    background: rgba(255, 59, 59, 0.1);
}

.positions-table tr.liquidation-warning:hover {
    background: rgba(255, 59, 59, 0.15);
}

.close-position-btn {
    background: #ff3b3b;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.close-position-btn:hover {
    background: #ff5252;
}

/* 포지션 및 호가창 새 레이아웃 */
.position-section {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #333;
}

.position-section h3 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 18px;
}

/* 포지션 탭 */
.position-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background-color: #0d0d0d;
    border-radius: 6px;
    padding: 4px;
}

.position-tab {
    flex: 1;
    padding: 8px 16px;
    background-color: transparent;
    color: #888;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.position-tab:hover {
    color: #aaa;
}

.position-tab.active {
    background-color: #1a1a1a;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.position-content {
    display: none;
}

.position-content.active {
    display: block;
}

.orderbook-panel {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #333;
}

.orderbook-panel h3 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 18px;
}

/* 실적 패널 */
.performance-panel {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #333;
}

.performance-panel h3 {
    margin: 0 0 15px 0;
    color: #fff;
    font-size: 18px;
}

.performance-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child {
    color: #999;
    font-size: 14px;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

#totalPnL.positive {
    color: #00d632;
}

#totalPnL.negative {
    color: #ff3b3b;
}

#avgProfit {
    color: #00d632;
}

#avgLoss {
    color: #ff3b3b;
}

/* 히스토리 아이템 */
.history-item {
    background-color: #0d0d0d;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 8px;
}

.history-item.profit {
    border-left: 3px solid #00d632;
}

.history-item.loss {
    border-left: 3px solid #ff3b3b;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-type {
    font-weight: bold;
    font-size: 14px;
}

.history-date {
    color: #999;
    font-size: 12px;
}

.history-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 13px;
    color: #ccc;
}

.history-pnl {
    font-size: 16px;
    font-weight: bold;
    margin-top: 8px;
}

.history-pnl.profit {
    color: #00d632;
}

.history-pnl.loss {
    color: #ff3b3b;
}

.no-history {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 14px;
}

/* 헤더 버튼 통일 스타일 */
.daily-check-btn,
.share-result-btn,
.backup-btn,
.restore-btn,
.bankruptcy-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 80px;
    height: 38px;
}

.daily-check-btn {
    background: #00d632;
    color: #000;
}

.daily-check-btn:hover {
    background: #00b82c;
}

.daily-check-btn:disabled {
    background: #666;
    color: #ccc;
    cursor: not-allowed;
}

.share-result-btn {
    background: #ff9900;
}

.share-result-btn:hover {
    background: #e68a00;
}

.backup-btn {
    background: #0066cc !important;
}

.backup-btn:hover {
    background: #0052a3 !important;
}

.restore-btn {
    background: #666 !important;
}

.restore-btn:hover {
    background: #555 !important;
}

.bankruptcy-btn {
    background: #ff3b3b;
}

.bankruptcy-btn:hover {
    background: #e62e2e;
}

/* 하이라이트 애니메이션 */
@keyframes highlight {
    0% {
        background-color: rgba(0, 214, 50, 0.3);
        box-shadow: 0 0 20px rgba(0, 214, 50, 0.5);
    }
    50% {
        background-color: rgba(0, 214, 50, 0.1);
        box-shadow: 0 0 10px rgba(0, 214, 50, 0.3);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* 토스트 메시지 스타일 */
.toast-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    z-index: 10000;
    animation: toastSlideIn 0.3s ease-out;
}

.toast-message.success {
    border-color: #00d632;
}

.toast-message.error {
    border-color: #ff3b3b;
}

.toast-icon {
    font-size: 24px;
}

.toast-text {
    font-size: 16px;
    color: #fff;
    font-weight: 500;
}

.toast-message.fade-out {
    animation: toastFadeOut 0.5s ease-out forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes toastFadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
}

/* 포지션 테이블 래퍼 */
.positions-table-wrapper {
    display: flex;
    gap: 0;
    width: 100%;
}

.positions-data-wrapper {
    flex: 1;
    overflow-x: auto;
}

.positions-button-wrapper {
    flex: 0 0 auto;
    min-width: 80px;
}

/* 데이터 테이블 */
.positions-data-table {
    width: 100%;
    border-collapse: collapse;
    border-right: 1px solid #333;
}

.positions-data-table th {
    background: #0d0d0d;
    color: #999;
    font-weight: normal;
    font-size: 12px;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.positions-data-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #222;
    font-size: 14px;
    color: #ccc;
}

.positions-data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.positions-data-table tr.liquidation-warning {
    background: rgba(255, 59, 59, 0.1);
}

/* 버튼 테이블 */
.positions-button-table {
    width: 100%;
    border-collapse: collapse;
}

.positions-button-table th {
    background: #0d0d0d;
    color: #999;
    font-weight: normal;
    font-size: 12px;
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.positions-button-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #222;
    text-align: center;
}

.positions-button-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 버튼 테이블과 데이터 테이블 행 높이 동기화 */
.positions-data-table tbody tr,
.positions-button-table tbody tr {
    height: 48px;
}

/* 판매 버튼 컨테이너 스타일 */
.sell-buttons-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-top: 1px solid #333;
}

.sell-buttons-container-mobile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.sell-buttons-container .close-position-btn {
    flex: 0 0 auto;
}

/* 포지션 테이블 래퍼 */
.positions-wrapper {
    width: 100%;
}

/* 포지션 테이블 - 기존 스타일 유지 */
.positions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.positions-table th {
    background: #0d0d0d;
    color: #999;
    font-weight: normal;
    font-size: 12px;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.positions-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #222;
    font-size: 14px;
    color: #ccc;
}

.positions-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.positions-table tr.liquidation-warning {
    background: rgba(255, 59, 59, 0.1);
}

.positions-table tr.liquidation-warning:hover {
    background: rgba(255, 59, 59, 0.15);
}
@media (min-width: 1400px) {
    .chart-container {
        height: 400px;
    }
    
    .volume-container {
        height: 140px;
    }
}

/* 초대형 화면 (1920px 이상) */
@media (min-width: 1920px) {
    .chart-container {
        height: 450px;
    }
    
    .volume-container {
        height: 150px;
    }
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .container {
        padding: 20px;
    }
    
    body {
        padding: 0 10px;
    }
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .trading-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    body {
        padding: 0;
    }
    
    header {
        padding: 15px 20px;
        margin-bottom: 20px;
    }
    
    main {
        gap: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .trading-section {
        grid-template-columns: 1fr;
    }
    
    .timeframe-buttons {
        flex-wrap: wrap;
    }
    
    /* 모바일에서의 모달 위치 조정 */
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
        max-width: 100%;
        max-height: 90vh;
    }
    
    /* 출석체크 모달 조정 */
    .attendance-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 5px;
    }
    
    .attendance-day {
        padding: 10px 5px;
    }
    
    .attendance-day .day-label {
        font-size: 0.8em;
    }
    
    .attendance-day .day-reward {
        font-size: 0.7em;
    }
    
    /* 모바일에서 박스 그림자 제거 */
    .chart-section, .orderbook-section, .trading-panel, .position-panel, .news-panel, header {
        box-shadow: none;
    }
}

/* 스마트폰 레이아웃 (480px 이하) */
@media (max-width: 480px) {
    /* 메인 레이아웃을 세로로 변경 */
    main {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    /* 차트와 포지션이 있는 왼쪽 섹션을 첫번째로 */
    .left-section {
        width: 100%;
        order: 1;
        display: flex;
        flex-direction: column;
    }
    
    /* 차트를 맨 위로 */
    .chart-section {
        order: 1;
    }
    
    /* 포지션을 맨 아래로 (나중에 보이도록) */
    .position-section {
        order: 5;
        padding: 15px;
        margin-top: 15px;
    }
    
    /* 거래 섹션 (호가창, 거래패널, 뉴스 포함) */
    .trading-section {
        width: 100%;
        order: 2;
        display: flex;
        flex-direction: column;
    }
    
    /* 거래 섹션 내부 순서 */
    #tradingPanel {
        display: flex;
        flex-direction: column;
        order: 1;
    }
    
    /* 호가창을 거래 패널 위로 */
    .orderbook-panel {
        order: -1;  /* 거래 패널보다 위로 */
        margin-top: 0;
        margin-bottom: 15px;
    }
    
    /* 거래 패널 */
    .trading-panel {
        order: 0;
        margin-bottom: 15px;
    }
    
    /* 뉴스 패널 */
    #newsPanel {
        order: 2;
    }
    
    .news-panel {
        padding: 15px;
        height: auto;
        max-height: 400px;
        margin-bottom: 15px;
    }
    /* 헤더 */
    header {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .header-content {
        gap: 10px;
    }
    
    h1 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .user-info {
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
    }
    
    #userId {
        display: none; /* ID는 모바일에서 숨김 */
    }
    
    #userBalance {
        font-size: 13px;
        font-weight: bold;
        color: #00d632;
    }
    
    #userDepositedFees {
        font-size: 13px;
        width: 100%;
        text-align: center;
        order: -1; /* 맨 위로 올림 */
        margin-bottom: 5px;
    }
    
    /* 헤더 버튼들 - 가로 배치 */
    .user-info button {
        font-size: 11px;
        padding: 6px 10px;
        min-width: auto;
        flex: 1;
    }
    
    /* 버튼 그룹 컨테이너 추가 */
    .header-buttons {
        display: flex;
        gap: 4px;
        width: 100%;
        justify-content: center;
        margin-top: 5px;
    }
    
    .header-buttons button {
        flex: 1;
        max-width: 70px;
        height: 28px;
        font-size: 10px;
        padding: 0 5px;
    }
    
    /* 백업/복원 버튼은 모바일에서도 표시 */
    .backup-btn, .restore-btn {
        display: inline-block !important;
    }
    
    /* 차트 컨트롤 - 한 줄로 표시 */
    .chart-controls {
        flex-direction: row;
        gap: 5px;
        align-items: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .chart-controls::-webkit-scrollbar {
        display: none;
    }
    
    .timeframe-buttons,
    .indicator-buttons {
        display: flex;
        gap: 3px;
        flex-shrink: 0;
    }
    
    .timeframe-btn,
    .indicator-btn {
        font-size: 11px;
        padding: 5px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 차트 - 크기 대폭 증가 */
    .chart-container {
        height: 400px;  /* 300px -> 400px */
        margin-bottom: 10px;
        touch-action: pan-y; /* 세로 스크롤만 허용, 가로는 차트 드래그로 사용 */
    }
    
    .volume-container {
        height: 120px;  /* 100px -> 120px */
        touch-action: pan-y; /* 세로 스크롤만 허용 */
    }
    
    .chart-section {
        padding: 15px;
        position: relative;
    }
    
    /* 캔들 차트를 위한 최소 높이 보장 */
    #priceChart {
        min-height: 400px;
        touch-action: pan-y; /* 세로 스크롤 허용 */
    }
    
    #volumeChart {
        min-height: 120px;
        touch-action: pan-y; /* 세로 스크롤 허용 */
    }
    
    /* 모바일 가격 정보 표시 */
    .mobile-price-info {
        display: block;
        background: #1a1a1a;
        padding: 10px;
        margin: -15px -15px 10px -15px;
        border-radius: 8px 8px 0 0;
        text-align: center;
    }
    
    .mobile-price-info .current-price {
        font-size: 1.5em;
        font-weight: bold;
        color: #00d632;
        margin-bottom: 5px;
    }
    
    .mobile-price-info .price-changes {
        display: flex;
        justify-content: space-around;
        font-size: 11px;
    }
    
    /* 최고가 색상 */
    .mobile-price-info .price-high {
        color: #00d632;
    }
    
    /* 최저가 색상 */
    .mobile-price-info .price-low {
        color: #ff3b3b;
    }
    
    /* 변동률 색상 (동적으로 적용됨) */
    .mobile-price-info .price-change.positive {
        color: #00d632;
    }
    
    .mobile-price-info .price-change.negative {
        color: #ff3b3b;
    }
    
    .mobile-price-info .price-change.neutral {
        color: #999;
    }
    
    /* 모바일에서 거래 패널의 가격 정보 숨김 */
    .trading-panel .current-price,
    .trading-panel .price-info {
        display: none;
    }
    
    /* 거래 섹션 */
    .trading-section {
        width: 100%;
        display: flex;
        flex-direction: column;
    }
    
    /* 포지션 테이블을 카드 형식으로 변경 */
    .positions-table {
        display: none;
    }
    
    /* 모바일에서는 테이블 래퍼 숨김 */
    .positions-table-wrapper {
        display: none !important;
    }
    
    /* 모바일용 포지션 카드 */
    .mobile-position-cards {
        display: block !important;
    }
    
    .position-card {
        background: #1a1a1a;
        border: 1px solid #333;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .position-card.long {
        border-left: 3px solid #00d632;
    }
    
    .position-card.short {
        border-left: 3px solid #ff3b3b;
    }
    
    .position-card.liquidation-warning {
        background: rgba(255, 59, 59, 0.1);
        border: 1px solid rgba(255, 59, 59, 0.3);
    }
    
    .position-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .position-type {
        font-weight: bold;
        font-size: 14px;
    }
    
    .position-card-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 13px;
        color: #ccc;
    }
    
    .position-card-body > div {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border-bottom: 1px solid #222;
    }
    
    .position-card-body > div:last-child {
        border-bottom: none;
    }
    
    .position-card-body span:first-child {
        color: #888;
    }
    
    .position-card-body span:last-child {
        font-weight: 500;
        color: #fff;
    }
    
    .position-card-footer {
        margin-top: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .position-pnl {
        font-size: 14px;
        font-weight: bold;
    }
    
    .position-pnl.profit {
        color: #00d632;
    }
    
    .position-pnl.loss {
        color: #ff3b3b;
    }
    
    .position-card .close-position-btn {
        font-size: 12px;
        padding: 6px 12px;
        min-width: 60px;
    }
    
    /* 모바일에서는 새로운 레이아웃 */
    .trading-panel {
        padding: 15px;
    }
    
    .orderbook-panel {
        padding: 15px;
    }
    
    .current-price {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .price-info {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 12px;
    }
    
    /* 레버리지 컨트롤 */
    .leverage-control label {
        font-size: 14px;
    }
    
    /* 금액 입력 */
    #investAmount, #limitPrice {
        font-size: 14px;
        padding: 8px;
    }
    
    /* 빠른 금액 버튼 */
    .quick-amount {
        font-size: 11px;
        padding: 8px;
    }
    
    /* 매수/매도 버튼 */
    .buy-btn, .sell-btn {
        font-size: 14px;
        padding: 10px;
    }
    
    /* 호가창 */
    .orderbook-panel {
        padding: 15px;
    }
    
    .orderbook-panel h3 {
        font-size: 16px;
    }
    
    .order-row {
        font-size: 11px;
    }
    
    .spread {
        font-size: 14px;
        padding: 8px;
    }
    
    /* 뉴스 */
    .news-panel h3 {
        font-size: 16px;
    }
    
    .news-item {
        padding: 12px;
    }
    
    .news-title {
        font-size: 13px;
    }
    
    .news-content {
        font-size: 12px;
    }
    
    /* 모달 */
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    .modal-content h2 {
        font-size: 1.2em;
    }
    
    /* 출석체크 모달 */
    .attendance-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .attendance-day {
        padding: 8px 4px;
    }
    
    /* 알림 */
    .news-notification {
        right: 10px;
        left: 10px;
        width: auto;
        font-size: 13px;
        padding: 12px;
    }
    
    /* 토스트 메시지 */
    .toast-message {
        width: 90%;
        padding: 15px;
        font-size: 14px;
    }
    
    /* 내비게이션 간소화 */
    .position-section h3,
    .orderbook-panel h3,
    .trading-panel h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    /* 스크롤바 스타일 */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #333;
        border-radius: 2px;
    }
    
    /* 터치 영역 개선 */
    button, .timeframe-btn, .indicator-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        touch-action: manipulation;
    }
    
    /* 데스크탑에서는 모바일 포지션 카드 숨김 */
    
    /* 패딩 최적화 */
    .container {
        padding: 5px;
    }
    
    .chart-section,
    .position-section,
    .trading-panel,
    .orderbook-panel,
    .news-panel {
        border-radius: 8px;
        margin-bottom: 15px;
    }
}

/* 데스크탑 및 태블릿에서는 모바일 카드 숨김 */
@media (min-width: 481px) {
    .mobile-position-cards {
        display: none !important;
    }
    
    /* 데스크탑에서는 테이블 표시 */
    .positions-table-wrapper {
        display: flex !important;
    }
}

/* 아주 작은 화면 (360px 이하) */
@media (max-width: 360px) {
    h1 {
        font-size: 1.1em;
    }
    
    .timeframe-btn {
        font-size: 11px;
        padding: 5px 8px;
    }
    
    /* 더 작은 화면에서도 차트 크기 유지 */
    .chart-container {
        height: 350px;
    }
    
    .volume-container {
        height: 100px;
    }
    
    .positions-table {
        font-size: 10px;
    }
    
    .positions-table th,
    .positions-table td {
        padding: 6px 4px;
    }
}

/* 실적 패널 추가 스타일 */
#performancePanel {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

#performancePanel h3 {
    color: #00d632;
    margin-bottom: 15px;
    font-size: 16px;
}

.performance-stats {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    padding: 20px;
    background: #0d0d0d;
    border-radius: 8px;
}

.performance-stats .stat-item {
    text-align: center;
    flex: 1;
}

.performance-stats .stat-label {
    color: #999;
    font-size: 14px;
    margin-bottom: 10px;
}

.performance-stats .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
}

/* 실적 테이블 스타일 */
.performance-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.performance-table th {
    background: #0d0d0d;
    color: #999;
    font-weight: normal;
    font-size: 14px;
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.performance-table td {
    padding: 20px 12px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #222;
}

/* 페이지네이션 스타일 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    padding: 10px 0;
}

.page-btn {
    background: #1a1a1a;
    color: #999;
    border: 1px solid #333;
    padding: 5px 10px;
    min-width: 30px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #2a2a2a;
    color: #fff;
}

.page-btn.active {
    background: #00d632;
    color: #000;
    border-color: #00d632;
    font-weight: bold;
}