/* ================================================
   Account Tab Styles - Trading-X v3.1
   중복 제거 + 정리 완료
   ================================================ */

/* ========== Account Summary 카드 ========== */
.account-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.summary-box {
    background: #1e2127;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.summary-box .value {
    font-size: 19px;
    font-weight: bold;
    color: var(--accent-cyan);
}

.summary-box .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ========== 탭 헤더 (Trade History / Open Positions) ========== */
.acc-tab-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin: -8px -15px 12px -15px;
}

.acc-tab {
    flex: 1;
    text-align: left;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.acc-tab.active {
    color: var(--text-primary);
}

.acc-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 15px;
    right: 15px;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 1px;
}

.acc-tab-count {
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.acc-tab-content {
    display: none;
}

.acc-tab-content.active {
    display: block;
}

/* ========== Trade History 리스트 (3컬럼 레이아웃) ========== */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 5px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    gap: 8px;
    font-size: 13px;
}

.history-item:last-child {
    border-bottom: none;
}

/* 왼쪽: 종목 + BUY/SELL + 랏수 */
.history-left {
    flex-shrink: 0;
    min-width: 165px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-left .buy {
    color: var(--buy-color);
    font-weight: 600;
    font-style: italic;
    font-size: 12px;
}

.history-left .sell {
    color: var(--sell-color);
    font-weight: 600;
    font-style: italic;
    font-size: 12px;
}

.history-left .lot {
    color: rgba(255,255,255,0.35);
    font-weight: 400;
    font-size: 11px;
}

/* 중앙: 청산 시간 */
.history-center {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    color: rgba(255,255,255,0.3);
    font-size: 11px;
    white-space: nowrap;
}

/* 오른쪽: 손익 */
.history-right {
    flex-shrink: 0;
    text-align: right;
    min-width: 80px;
    font-size: 14px;
    font-weight: 600;
}

.history-right.profit-positive,
.history-right.positive {
    color: var(--buy-color);
}

.history-right.profit-negative,
.history-right.negative {
    color: var(--sell-color);
}

/* ★ 기존 클래스 호환 (다른 곳에서 사용 중) */
.history-symbol-type {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.history-symbol {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.history-type {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
}

.history-type.type-buy {
    color: var(--buy-color);
    background: rgba(0, 200, 117, 0.15);
}

.history-type.type-sell {
    color: var(--sell-color);
    background: rgba(255, 90, 90, 0.15);
}

.history-datetime-lot {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.history-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-divider-text {
    color: rgba(255, 255, 255, 0.2);
    font-size: 12px;
}

.history-volume {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-profit {
    font-size: 14px;
    font-weight: 600;
    min-width: 80px;
    text-align: right;
    margin-right: 5px;
    flex-shrink: 0;
}

.history-profit.positive,
.history-profit.profit-positive {
    color: var(--buy-color);
}

.history-profit.negative,
.history-profit.profit-negative {
    color: var(--sell-color);
}

.history-profit.neutral {
    color: var(--text-primary);
}

/* ========== Trade History 서머리 ========== */
.history-summary-value {
    font-size: 15px;
}

.history-summary-value.positive {
    color: var(--buy-color);
}

.history-summary-value.negative {
    color: var(--sell-color);
}

/* ========== Open Positions 카드 ========== */
.open-pos-list {
    max-height: 400px;
    overflow-y: auto;
}

.open-pos-card {
    position: relative;
    padding: 11px 12px 11px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
    /* ★ 롱프레스 지원: pan-y만 허용 (수직 스크롤), 다른 제스처는 JS에서 처리 */
    touch-action: pan-y;
    -webkit-touch-callout: none;
}

.open-pos-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 2px;
    background: transparent;
}

.open-pos-card:active {
    background: rgba(255,255,255,0.03);
}

.open-pos-card.buy-card::before {
    background: var(--buy-color);
}

.open-pos-card.sell-card::before {
    background: var(--sell-color);
}

.open-pos-card.selected {
    background: rgba(0, 212, 164, 0.08);
}

.open-pos-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}

.open-pos-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
}

.open-pos-symbol {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 600;
}

.open-pos-type {
    font-size: 12px;
    font-weight: 600;
    font-style: italic;
}

.open-pos-type.buy { color: var(--buy-color); }
.open-pos-type.sell { color: var(--sell-color); }

.open-pos-volume {
    font-size: 12px;
    color: var(--text-muted);
}

.open-pos-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5);
}

.open-pos-badge.badge-pro {
    background: transparent;
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: rgba(0, 212, 255, 0.6);
}

.open-pos-badge.badge-easy {
    background: transparent;
    border: 1px solid rgba(0, 212, 164, 0.3);
    color: rgba(0, 212, 164, 0.6);
}

.open-pos-badge.badge-v5 {
    background: transparent;
    border: 1px solid rgba(160, 120, 255, 0.3);
    color: rgba(160, 120, 255, 0.6);
}

.open-pos-badge.badge-chart {
    background: transparent;
    border: 1px solid rgba(255, 180, 50, 0.3);
    color: rgba(255, 180, 50, 0.6);
}

.open-pos-profit {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.open-pos-profit.positive { color: var(--buy-color); }
.open-pos-profit.negative { color: var(--sell-color); }
.open-pos-profit.neutral { color: var(--text-primary); }

.open-pos-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}

.open-pos-time {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}

.open-pos-prices {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}

.open-pos-arrow {
    color: rgba(255,255,255,0.25);
    margin: 0 3px;
}

.open-pos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* ========== 체크박스 ========== */
.open-pos-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    margin-right: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.open-pos-checkbox.checked {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.open-pos-checkbox.checked::after {
    content: '\2713';
    color: #000;
    font-size: 12px;
    font-weight: 700;
}

/* ========== 하단 청산 버튼 (고정 배치) ========== */
.close-pos-bar {
    position: fixed;
    bottom: 65px;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    z-index: 99;
    padding: 8px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.close-pos-btn-inactive {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed rgba(255,255,255,0.15);
    border-radius: 10px;
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.close-pos-btn-inactive:active {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.5);
}

.close-pos-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 65px;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    z-index: 99;
    padding: 8px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.close-pos-select-all {
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
}

.close-pos-execute {
    flex: 1;
    max-width: 160px;
    padding: 10px 16px;
    background: var(--sell-color);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.close-pos-execute:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.close-pos-cancel {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
}

/* ========== 청산 확인 바텀시트 ========== */
.close-confirm-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
}

.close-confirm-sheet.active {
    display: block;
}

.close-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.close-confirm-sheet.active .close-confirm-overlay {
    opacity: 1;
}

.close-confirm-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card, #1a1d23);
    border-radius: 16px 16px 0 0;
    padding: 20px 20px 30px;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.close-confirm-sheet.active .close-confirm-panel {
    transform: translateY(0);
}

.close-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.close-confirm-content {
    padding: 12px 0;
    margin-bottom: 16px;
}

.close-confirm-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.close-confirm-symbol {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-confirm-type {
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}

.close-confirm-type.buy { color: var(--buy-color); }
.close-confirm-type.sell { color: var(--sell-color); }

.close-confirm-profit {
    font-size: 15px;
    font-weight: 700;
}

.close-confirm-profit.positive { color: var(--buy-color); }
.close-confirm-profit.negative { color: var(--sell-color); }
.close-confirm-profit.neutral { color: var(--text-primary); }

.close-confirm-message {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    padding: 8px 0;
}

.close-confirm-buttons {
    display: flex;
    gap: 12px;
}

.close-confirm-cancel {
    flex: 1;
    padding: 14px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.close-confirm-execute {
    flex: 1;
    padding: 14px;
    background: var(--sell-color);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ========== Account Info 새 레이아웃 (A-2 왼쪽정렬) ========== */
.acc-info-card {
    padding: 18px 15px;
}

.acc-info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent) !important;
    z-index: 1;
}

.acc-info-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent) !important;
    z-index: 1;
}

.acc-info-top {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

.acc-info-equity-row {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.acc-info-equity-label {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.acc-info-equity-value {
    font-size: 28px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: -0.5px;
}

.acc-info-cpl {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 0;
    position: absolute;
    left: 40%;
    bottom: 20px;
}

.acc-info-cpl-label {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
}

.acc-info-cpl-value {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.acc-info-bottom {
    display: flex;
    gap: 0;
}

.acc-info-item {
    flex: 1;
    text-align: left;
    padding-left: 12px;
    position: relative;
}

.acc-info-item:first-child {
    padding-left: 4px;
}

.acc-info-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: rgba(255,255,255,0.08);
}

.acc-info-item-label {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.acc-info-item-value {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}


/* ★ 커미션 미반영 알림 바 */
.acc-commission-notice {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 12px) + 52px);
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(17, 19, 24, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 99;
    padding: 0 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.acc-commission-icon {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    flex-shrink: 0;
}

.acc-commission-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.acc-commission-dot {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    margin: 0 2px;
}

.acc-commission-link {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s;
}

.acc-commission-link:active {
    color: rgba(255, 255, 255, 0.9);
}

/* ===== Account 상세내역 보기 버튼 ===== */
.acc-detail-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    margin: 10px 0;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.acc-detail-btn:active { color: var(--accent-cyan); }

/* ===== Account Overview 상태 뱃지 ===== */
.account-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.account-status-badge.active {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
}
.account-status-badge.standby {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
}
.account-status-badge.preparing {
    color: #f0b90b;
    background: rgba(240, 185, 11, 0.1);
    border: 1px solid rgba(240, 185, 11, 0.3);
}
.account-status-badge.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

/* ===== 데모 계좌 개설 버튼 (모달용) ===== */
.demo-create-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #00b4d8, #00d4ff);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.demo-create-btn:hover {
    background: linear-gradient(135deg, #00d4ff, #00e5ff);
    transform: translateY(-1px);
}
.demo-create-btn:active {
    transform: translateY(0);
}
.demo-create-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== 데모 카드 왼→오른 슬라이드 애니메이션 ===== */
.demo-slide-card {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.demo-slide-card.slide-in {
    opacity: 1;
    transform: translateX(0);
}

/* ===== Quick Menu ===== */
.quick-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.quick-menu-item:active {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
    transform: scale(0.96);
}
.quick-menu-label {
    font-size: 11px;
    color: #9aa0b0;
    font-weight: 500;
}

/* ===== Account Badge Dot ===== */
.account-status-badge .badge-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}
.account-status-badge.active .badge-dot {
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}
.account-status-badge.standby .badge-dot {
    background: #00d4ff;
    box-shadow: 0 0 8px #00d4ff;
}
.account-status-badge.error .badge-dot {
    background: #ff4444;
    box-shadow: 0 0 8px #ff4444;
    animation: none;
}
