/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h3 {
    font-size: 1.2rem;
    color: #cccccc;
    font-weight: 400;
    margin-bottom: 15px;
}

/* CTA Button */
.cta-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
    align-items: center; /* 버튼과 화살표 수직 정렬 */
}

.arrow-icon {
    font-size: 1.5em;
    color: #ffd700;
    animation: arrowBounce 2s ease-in-out infinite;
    margin-left: 10px;
}

/* 화살표 좌우 이동 애니메이션 */
@keyframes arrowBounce {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.8;
    }
    25% {
        transform: translateX(-8px);
        opacity: 1;
    }
    50% {
        transform: translateX(5px);
        opacity: 0.9;
    }
    75% {
        transform: translateX(-3px);
        opacity: 1;
    }
}

.cta-button {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #1e3c72;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 200px;
    text-align: center;
    /* 클릭 애니메이션을 위한 기본 설정 */
    transform: translateY(0);
    animation: pulse 2s infinite;
}

/* 펄스 애니메이션 */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
}

/* 호버 효과 */
.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
    animation: none; /* 호버시 펄스 중지 */
}

/* 클릭/터치 효과 */
.cta-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
    transition: all 0.1s ease;
}

/* 리플 효과를 위한 가상 요소 */
.cta-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    z-index: 0;
}

.cta-button:active::before {
    width: 300px;
    height: 300px;
}

/* 텍스트가 리플 효과 위에 오도록 */
.cta-button span {
    position: relative;
    z-index: 1;
}


/* Controls Section */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
    justify-content: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.9em;
    opacity: 0.8;
    color: #ffd700;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Select and Button Controls */
select {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1em;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

select:hover {
    background: rgba(255, 255, 255, 0.3);
}

select option {
    background: #2a5298;
    color: white;
}

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

.timeframe-btn {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.timeframe-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.timeframe-btn.active {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #1e3c72;
    border-color: #ffd700;
    font-weight: bold;
}

/* Chart Controls */
#controls {
    margin: 10px;
    text-align: center;
}

#controls button {
    padding: 8px 16px;
    margin: 0 5px;
    font-size: 16px;
    border: none;
    background: #444;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#controls button:hover {
    background: #666;
}

/* Status Messages */
.status {
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: bold;
}

.status.loading {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.status.success {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.status.error {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 500px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    padding-bottom: 40px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
    touch-action: none;
}

.custom-chart {
    width: 100%;
    height: 100%;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
}

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

.chart-svg {
    width: 100%;
    height: 100%;
}

/* Chart Elements */
.price-line {
    fill: none;
    stroke: #ffd700;
    stroke-width: 2;
}

.price-area {
    fill: url(#priceGradient);
    opacity: 0.3;
}

.grid-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
}

.axis-text {
    fill: white;
    font-size: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Price Information Cards */
.price-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.price-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    backdrop-filter: blur(5px);
}

.price-card h3 {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    opacity: 0.8;
}

.price-card .value {
    font-size: 1.2em;
    font-weight: bold;
}

/* Position Information */
.position-info {
    background: rgba(0, 0, 0, 0.3);  /* 어두운 배경으로 변경 */
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);  /* 경계선 추가 */
}

.position-group {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);  /* 중간 어두운 배경 */
    border-radius: 10px;
    border-left: 3px solid #ffd700;
}

.position-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);  /* 가장 어두운 배경 */
    border-radius: 8px;
    margin-bottom: 4px;
}

.position-header h3 {
    margin: 0 0 15px 0;
    color: #ffd700;
    text-align: center;
}

.position-data {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.position-symbol {
    margin: 0 0 10px 0;
    color: #ffd700;
    font-size: 1.1em;
    font-weight: bold;
}


.position-item .label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

.position-item .value {
    font-weight: bold;
    color: white;
}

.position-item .value.profit {
    color: #28a745;
}

.position-item .value.loss {
    color: #dc3545;
}

.no-position {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    padding: 20px;
}

/* Trading Points */
.trade-point {
    stroke-width: 2;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
}

.trade-point.buy {
    fill: #28a745;
    stroke: #1e7e34;
}

.trade-point.sell {
    fill: #dc3545;
    stroke: #c82333;
}

.trade-point:hover {
    r: 8;
    filter: brightness(1.2);
}

.trade-text {
    font-weight: bold;
    pointer-events: none;
}

.trade-text.buy {
    fill: #28a745;
}

.trade-text.sell {
    fill: #dc3545;
}

/* Tooltip Styles */
.trade-tooltip {
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.tooltip-header {
    font-weight: bold;
    padding: 5px 0;
    text-align: center;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px 8px 0 0;
}

.tooltip-header.buy {
    color: #28a745;
    background: rgba(40, 167, 69, 0.4);
}

.tooltip-header.sell {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.4);
}

.tooltip-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    margin: 2px 0;
    font-size: 11px;
}

.tooltip-item span:first-child {
    opacity: 0.8;
    font-weight: 500;
}

.tooltip-item .profit {
    color: #28a745;
    font-weight: bold;
}

.tooltip-item .loss {
    color: #dc3545;
    font-weight: bold;
}

/* Copy Trading Section */
.copy-trading-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(5px);
}

.trading-info-header h2 {
    color: #ffd700;
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.trading-info-content {
    color: white;
    line-height: 1.6;
}

.highlight-box {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 237, 78, 0.2));
    border-left: 4px solid #ffd700;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
}

.highlight-box h3 {
    color: #ffd700;
    margin: 0 0 10px 0;
}

.trading-settings, .strategy-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px 15px 15px 35px;
    margin: 15px 0;
}

.trading-settings li, .strategy-list li {
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.9);
}

.trading-settings ul {
    margin-top: 5px;
    padding-left: 20px;
}

.trading-settings ul li {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
}

/* Risk Warning */
.risk-warning {
    background: rgba(220, 53, 69, 0.2);
    border: 2px solid #dc3545;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.risk-warning h4 {
    color: #ff6b6b;
    margin: 0 0 10px 0;
}

.risk-warning p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    margin: 0;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
    }

    .container {
        padding: 15px;
        overflow-x: hidden;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header h3 {
        font-size: 1rem;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .timeframe-buttons {
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-container {
        height: 400px;
        padding: 10px;
        padding-bottom: 45px;
    }

    .price-info {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .price-card {
        padding: 10px;
    }

    .price-card h3 {
        font-size: 0.8em;
    }

    .price-card .value {
        font-size: 1em;
    }

    /* Position Info Mobile */
    .position-info {
        padding: 15px;
    }

    .position-data {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .position-item {
        padding: 6px 10px;
    }

    .position-item .label,
    .position-item .value {
        font-size: 0.85em;
    }

    /* Trading Points Mobile */
    .trade-point {
        r: 8;
        stroke-width: 3;
    }

    .trade-point:active {
        r: 10;
        filter: brightness(1.3);
    }

    .trade-text {
        font-size: 8px;
    }

    /* Tooltip Mobile */
    .trade-tooltip {
        max-width: 280px;
        font-size: 11px;
    }

    .tooltip-item {
        font-size: 10px;
    }

    /* Copy Trading Mobile */
    .copy-trading-section {
        padding: 15px;
    }

    .trading-info-header h2 {
        font-size: 1.2em;
    }

    .cta-buttons {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    .arrow-icon {
        font-size: 1.3em;
        margin-left: 8px;
    }

    .cta-button {
        width: auto; /* auto로 변경하여 원래 width 유지 */
        text-align: center;
        min-width: 180px; /* 최소 너비만 지정 */
        /* 모바일에서 터치 반응성 향상 */
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

}