/* Custom styles for crypto trading simulator */

/* Fixed navbar styles */
.navbar.fixed-top {
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    background-color: rgba(33, 37, 41, 0.95) !important;
}

.card {
    border: 1px solid var(--bs-border-color);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.badge {
    font-size: 0.8em;
}

.position-fixed {
    z-index: 1050;
}

/* Scrollbar styling for trade logs */
.card-body::-webkit-scrollbar {
    width: 6px;
}

.card-body::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
}

.card-body::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 3px;
}

.card-body::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

/* Animation for status changes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-active {
    background-color: var(--bs-success);
    animation: pulse 2s infinite;
}

.status-inactive {
    background-color: var(--bs-secondary);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Price change animations */
.price-up {
    color: var(--bs-success) !important;
    animation: priceFlash 1s ease-out;
}

.price-down {
    color: var(--bs-danger) !important;
    animation: priceFlash 1s ease-out;
}

@keyframes priceFlash {
    0% { background-color: rgba(255, 255, 255, 0.3); }
    100% { background-color: transparent; }
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bs-border-color);
    border-radius: 50%;
    border-top-color: var(--bs-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auto trading status styles */
.auto-trade-active {
    color: var(--bs-success) !important;
    font-weight: bold;
    position: relative;
    display: inline-block !important;
    padding: 10px 18px;
    border-radius: 25px;
    background: rgba(25, 135, 84, 0.15);
    border: 2px solid var(--bs-success);
    overflow: visible;
    animation: trackBlink 1.5s ease-in-out infinite;
}

/* 트랙 테두리 */
.auto-trade-active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    border-radius: 29px;
    border: 2px solid rgba(25, 135, 84, 0.3);
    z-index: -1;
}

/* 빨간색 점 제거됨 - 이제 트랙과 메시지 전체가 깜빡임 */

.auto-trade-inactive {
    color: var(--bs-muted);
    display: inline-block;
    padding: 10px 18px;
}

/* 둥근 트랙과 메시지 전체 깜빡이는 애니메이션 */
@keyframes trackBlink {
    0% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.3);
        border-color: var(--bs-success);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
        box-shadow: 0 0 8px rgba(25, 135, 84, 0.4);
        border-color: rgba(25, 135, 84, 0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.3);
        border-color: var(--bs-success);
    }
}

/* Auto trading status indicator dot - 완전히 숨김 */
.auto-trade-indicator {
    display: none !important; /* 점 표시기 완전 숨김 */
}

.auto-trade-indicator.active {
    display: none !important; /* 점 표시기 완전 숨김 */
}

/* Laptop screen optimization - Compact layout */
.container {
    max-width: 1400px; /* Wider container for laptop screens */
}

.card {
    margin-bottom: 0.75rem !important; /* Reduced card spacing */
}

.card-header {
    padding: 0.5rem 1rem !important; /* Compact header padding */
}

.card-body {
    padding: 0.75rem 1rem !important; /* Compact body padding */
}

.row {
    margin-bottom: 0.5rem; /* Reduced row spacing */
}

/* Price display optimizations */
.price-box {
    min-height: 80px; /* Consistent height for price boxes */
}

/* Equal width for all price information boxes */
.d-flex.justify-content-between.align-items-center .flex-fill {
    flex: 1 1 0 !important; /* Equal flex basis for all boxes */
    min-width: 0; /* Allow boxes to shrink if needed */
    width: calc(20% - 0.5rem); /* Exact 20% width minus margin */
}

/* Target coin highlighting - ETH (Blue) */
.target-coin-eth {
    border: 3px solid #0d6efd !important;
    animation: targetBlinkBlue 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.3);
}

@keyframes targetBlinkBlue {
    0% {
        border-color: #0d6efd;
        box-shadow: 0 0 10px rgba(13, 110, 253, 0.3);
    }
    50% {
        border-color: rgba(13, 110, 253, 0.6);
        box-shadow: 0 0 15px rgba(13, 110, 253, 0.5);
    }
    100% {
        border-color: #0d6efd;
        box-shadow: 0 0 10px rgba(13, 110, 253, 0.3);
    }
}

/* Target coin highlighting - XRP (Orange) */
.target-coin-xrp {
    border: 3px solid #fd7e14 !important;
    animation: targetBlinkOrange 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(253, 126, 20, 0.3);
}

@keyframes targetBlinkOrange {
    0% {
        border-color: #fd7e14;
        box-shadow: 0 0 10px rgba(253, 126, 20, 0.3);
    }
    50% {
        border-color: rgba(253, 126, 20, 0.6);
        box-shadow: 0 0 15px rgba(253, 126, 20, 0.5);
    }
    100% {
        border-color: #fd7e14;
        box-shadow: 0 0 10px rgba(253, 126, 20, 0.3);
    }
}

/* Auto trading box active animation */
.auto-trading-active {
    animation: autoTradingBlink 1.2s ease-in-out infinite;
    border: 2px solid var(--bs-success) !important;
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.2), rgba(25, 135, 84, 0.1));
}

@keyframes autoTradingBlink {
    0% {
        box-shadow: 0 0 8px rgba(25, 135, 84, 0.5);
        border-color: var(--bs-success);
        background: linear-gradient(135deg, rgba(25, 135, 84, 0.2), rgba(25, 135, 84, 0.1));
    }
    50% {
        box-shadow: 0 0 25px rgba(25, 135, 84, 0.8);
        border-color: rgba(25, 135, 84, 1);
        background: linear-gradient(135deg, rgba(25, 135, 84, 0.3), rgba(25, 135, 84, 0.15));
    }
    100% {
        box-shadow: 0 0 8px rgba(25, 135, 84, 0.5);
        border-color: var(--bs-success);
        background: linear-gradient(135deg, rgba(25, 135, 84, 0.2), rgba(25, 135, 84, 0.1));
    }
}

/* 1위 코인 카드 - 황금색 굵은 테두리 + 깜빡임 애니메이션 */
.coin-card-first {
    border: 3px solid #ffd700 !important;
    animation: first-place-blink 0.5s infinite alternate;
}

@keyframes first-place-blink {
    0% {
        border-color: #ffd700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    }
    100% {
        border-color: #ffed4e;
        box-shadow: 0 0 15px rgba(255, 215, 0, 1);
    }
}

/* 5위 코인 카드 - 빨간색 굵은 테두리 + 깜빡임 애니메이션 */
.coin-card-last {
    border: 3px solid #dc3545 !important;
    animation: last-place-blink 0.5s infinite alternate;
}

@keyframes last-place-blink {
    0% {
        border-color: #dc3545;
        box-shadow: 0 0 10px rgba(220, 53, 69, 0.7);
    }
    100% {
        border-color: #f5596b;
        box-shadow: 0 0 15px rgba(220, 53, 69, 1);
    }
}

/* 볼린저밴드 지표 색상 */
/* 중간선 이격 - 초록색 */
[id$="-middle-deviation"] {
    color: #28a745 !important;
}

/* 상단선 이격 - 금색 */
[id$="-upper-deviation"] {
    color: #ffd700 !important;
}

/* Select 요소 색상 지정 - 다크테마 호환 */
select.form-select {
    color: #ffffff !important;
    background-color: #2b3035 !important;
}

/* 트레일링 모드 활성화 깜빡임 효과 */
.trailing-active {
    position: relative;
    overflow: visible;
    animation: trailingBlink 1.5s ease-in-out infinite;
    border: 2px solid var(--bs-warning) !important;
    background: rgba(255, 193, 7, 0.1) !important;
}

/* 트레일링 모드 외부 테두리 */
.trailing-active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    border-radius: inherit;
    border: 2px solid rgba(255, 193, 7, 0.3);
    z-index: -1;
}

/* 트레일링 모드 깜빡이는 애니메이션 (노란색 테마) */
@keyframes trailingBlink {
    0% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.3);
        border-color: var(--bs-warning);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.01);
        box-shadow: 0 0 12px rgba(255, 193, 7, 0.4);
        border-color: rgba(255, 193, 7, 0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.3);
        border-color: var(--bs-warning);
    }
}

/* 트레일링 박스 슬라이드 애니메이션 */
.trailing-box-animated {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top center;
}

/* 슬라이드 다운 애니메이션 (나타날 때) */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scaleY(0.95);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        max-height: 200px;
    }
}

/* 슬라이드 업 애니메이션 (사라질 때) */
@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scaleY(0.95);
        max-height: 0;
    }
}

/* 애니메이션 클래스 */
.slide-down {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 페어링 대상 코인 카드 - LONG 포지션 (녹색 굵은 테두리 + 부드러운 깜빡임) */
.pairing-long {
    border: 3px solid #28a745 !important;
    animation: pairingBlinkLong 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
}

@keyframes pairingBlinkLong {
    0% {
        border-color: #28a745;
        box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
    }
    50% {
        border-color: rgba(40, 167, 69, 0.6);
        box-shadow: 0 0 25px rgba(40, 167, 69, 0.6);
    }
    100% {
        border-color: #28a745;
        box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
    }
}

/* 페어링 대상 코인 카드 - SHORT 포지션 (빨간색 굵은 테두리 + 부드러운 깜빡임) */
.pairing-short {
    border: 3px solid #dc3545 !important;
    animation: pairingBlinkShort 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
}

@keyframes pairingBlinkShort {
    0% {
        border-color: #dc3545;
        box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
    }
    50% {
        border-color: rgba(220, 53, 69, 0.6);
        box-shadow: 0 0 25px rgba(220, 53, 69, 0.6);
    }
    100% {
        border-color: #dc3545;
        box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
    }
}

/* 드롭다운 선택된 항목 텍스트 가시성 개선 */
.form-select option:checked,
.form-select option:active,
select.form-select option:checked {
    color: #ffffff !important;
    background-color: #0d6efd !important;
}

/* 다크 모드에서 드롭다운 옵션 가시성 */
select.form-select option {
    color: #ffffff !important;
    background-color: #2b3035 !important;
}

/* 🚦 트레일링 모드 신호등 스타일 */
.traffic-lights-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.traffic-light {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

/* 빨간색 신호등 - 대기중 (은은한 깜빡임) */
.traffic-light-red.active {
    background-color: #dc3545;
    border-color: #dc3545;
    animation: blinkSlow 2.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.8), inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.traffic-light-red.inactive {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
}

@keyframes blinkSlow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(220, 53, 69, 0.8), inset 0 0 5px rgba(0, 0, 0, 0.3);
    }
    50% {
        opacity: 0.4;
        box-shadow: 0 0 5px rgba(220, 53, 69, 0.4), inset 0 0 5px rgba(0, 0, 0, 0.3);
    }
}

/* 노란색 신호등 - 미사용 (항상 어두움) */
.traffic-light-yellow {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.3);
}

/* 파란색 신호등 - 활성중 (격렬한 깜빡임) */
.traffic-light-blue.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    animation: blinkFast 0.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(13, 110, 253, 1), inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.traffic-light-blue.inactive {
    background-color: rgba(13, 110, 253, 0.2);
    border-color: rgba(13, 110, 253, 0.3);
}

@keyframes blinkFast {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 20px rgba(13, 110, 253, 1), inset 0 0 5px rgba(0, 0, 0, 0.3);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(13, 110, 253, 1), inset 0 0 5px rgba(0, 0, 0, 0.3);
    }
}
