@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

/* 피보나치 되돌림 분석 - 입력 카드 (PSAR/볼린저 동일 형식) */

.fibo-container .input-card,
.input-card {
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.fibo-container .card-header,
.input-card .card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e4e8;
}

.input-card .card-header h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.input-card .card-header h2 i {
    margin-right: 10px;
    color: #003366;
}

.input-card .section-title {
    font-weight: 600;
    color: #003366;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    align-items: center;
}

.input-card .section-title i {
    margin-right: 8px;
}

.input-card form {
    padding: 20px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.input-card .form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px 15px;
    width: 100%;
    box-sizing: border-box;
}

.input-card .form-row .form-group {
    flex: 1;
    padding: 0 10px;
    min-width: 200px;
    margin-bottom: 15px;
}

.input-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
}

.input-card label i {
    margin-right: 5px;
    color: #003366;
}

.input-card input[type="text"],
.input-card input[type="number"],
.input-card select {
    width: 100%;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid #cfd7e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-card input[type="text"]:focus,
.input-card input[type="number"]:focus,
.input-card select:focus {
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15);
    outline: none;
}

.input-card .input-with-icon {
    position: relative;
}

.input-card .input-with-icon input {
    padding-right: 30px;
}

.input-card .input-with-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.input-card .tooltip {
    position: absolute;
    top: -40px;
    left: 0;
    background-color: #003366;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
    width: 200px;
}

.input-card .tooltip:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 15px;
    border-width: 5px;
    border-style: solid;
    border-color: #003366 transparent transparent transparent;
}

.input-card .ticker-lookup {
    margin-top: 5px;
    font-size: 12px;
}

.input-card .ticker-lookup a {
    color: #007acc;
    text-decoration: none;
}

.input-card .ticker-lookup a:hover {
    text-decoration: underline;
}

.input-card .submit-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #003366;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: 600;
    margin-top: 20px;
}

.input-card .submit-btn:hover {
    background-color: #004080;
}

.input-card .submit-btn i {
    margin-right: 8px;
}

#loading {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ========== 교육 모듈 스타일 (PSAR/볼린저 참고) ========== */

#wizard-steps {
    margin-top: 30px;
}

.step {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(30, 64, 175, 0.1);
    animation: fiboFadeInUp 0.5s ease;
}

.step.active {
    display: block;
}

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

.step h3 {
    color: #1e3a8a;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step h3 i {
    color: #3b82f6;
}

.step-description {
    color: #64748b;
    margin-bottom: 25px;
    font-size: 1rem;
    line-height: 1.6;
}

.explanation-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.explanation-box h4 {
    color: #0369a1;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-box h5 {
    color: #0c4a6e;
    font-size: 1rem;
    font-weight: 600;
    margin: 20px 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-box p {
    color: #334155;
    line-height: 1.7;
    margin-bottom: 12px;
}

.explanation-box ul,
.explanation-box ol {
    color: #334155;
    padding-left: 20px;
    margin-bottom: 15px;
}

.explanation-box li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.formula-box {
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    text-align: left;
    font-size: 1rem;
}

.formula-box.highlight {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border: none;
    font-size: 1.05rem;
}

/* ── Step 2: 비율 도출 테이블 ── */
.fibo-ratio-derive-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.92rem;
}
.fibo-ratio-derive-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}
.fibo-ratio-derive-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.fibo-ratio-derive-table tbody tr:hover {
    background: #f8fafc;
}
.fibo-ratio-derive-table tbody tr.ratio-row-gold {
    background: #fffbeb;
}
.fibo-ratio-derive-table tbody tr.ratio-row-gold:hover {
    background: #fef3c7;
}
.ratio-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
}
.ratio-gold   { background: #fef3c7; color: #92400e; }
.ratio-orange { background: #ffedd5; color: #9a3412; }
.ratio-red    { background: #fee2e2; color: #991b1b; }
.ratio-cyan   { background: #cffafe; color: #155e75; }
.ratio-gray   { background: #f1f5f9; color: #475569; }

/* ── Step 2: 인사이트 박스 ── */
.fibo-insight-box {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}
.insight-highlight {
    background: white;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-top: 0.8rem;
    text-align: center;
}
.insight-highlight p {
    margin: 0.3rem 0;
    font-size: 0.95rem;
    color: #1e293b;
}
.insight-highlight .insight-sub {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
}

/* 피보나치 비율 테이블 */
.fibo-ratio-table-section {
    margin: 25px 0;
}

.fibo-ratio-table-section h4 {
    color: #0369a1;
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-instruction {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 12px;
}

.fibo-ratio-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.fibo-ratio-table th {
    background: #1e3a8a;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.fibo-ratio-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.fibo-ratio-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.fibo-ratio-row:hover {
    background-color: #f0f9ff;
}

.fibo-ratio-row.selected {
    background-color: #dbeafe;
    font-weight: 600;
}

/* 활용 방법 리스트 */
.application-list {
    padding-left: 24px;
    margin: 15px 0;
}

.application-list li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* 차트 컨테이너 */
.chart-container {
    margin: 28px 0;
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 100%;
    width: 100%;
    position: relative;
}

.chart-container > div {
    min-height: 450px;
    width: 100%;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1e40af, #1e3a8a);
    border-radius: 16px 16px 0 0;
}

.chart-container:hover {
    box-shadow: 0 8px 32px rgba(30, 64, 175, 0.15);
    transform: translateY(-2px);
}

/* 다음 단계 버튼 */
.next-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px auto 0;
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.25);
}

.next-step:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.3);
}

.next-step i {
    transition: transform 0.3s ease;
}

.next-step:hover i {
    transform: translateX(5px);
}

/* 반응형 */
@media (max-width: 768px) {
    .step {
        padding: 20px 15px;
    }
    .chart-container {
        margin: 15px 0;
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .fibo-ratio-table th,
    .fibo-ratio-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    .chart-container > div {
        min-height: 350px;
    }
}

/* ── Step 3: 인터랙티브 피보나치 그리기 ── */
.fibo-draw-guide {
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
}
.draw-guide-list {
    margin: 0.8rem 0 0.5rem 1.2rem;
    list-style: disc;
    line-height: 1.9;
    font-size: 0.95rem;
    color: #334155;
}
.fibo-draw-status {
    margin-top: 0.8rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 2.5rem;
    transition: all 0.25s ease;
}
.fibo-draw-status.waiting {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}
.fibo-draw-status.first-selected {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}
.fibo-draw-status.done {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #4ade80;
}
.fibo-draw-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}
.fibo-draw-controls {
    display: flex;
    justify-content: flex-end;
    margin: 0.5rem 0 1rem;
    padding: 0 1rem;
}
.fibo-reset-btn {
    padding: 0.5rem 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.fibo-reset-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}
.fibo-reset-btn:active {
    transform: scale(0.97);
}

/* ── Step 4: 조정 분석 결과 표 ── */
.fibo-correction-analysis {
    margin: 1.5rem 0;
    padding: 0;
}
.correction-result-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.correction-result-box h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.correction-result-box h4 i {
    color: #3b82f6;
    margin-right: 0.4rem;
}
.correction-summary {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 0.9rem 1.2rem;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    color: #0c4a6e;
}
.correction-summary p { margin: 0; }
.correction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    line-height: 1.5;
}
.correction-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 0.7rem 0.8rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}
.correction-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}
.correction-table tbody tr:hover {
    background: #f8fafc;
}
.correction-table tbody td {
    padding: 0.7rem 0.8rem;
    vertical-align: top;
    color: #334155;
}
.correction-row.matched {
    background: #fffbeb !important;
    border-left: 4px solid #f59e0b;
}
.correction-row.matched td {
    font-weight: 500;
    color: #1e293b;
}
.level-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem 0.2rem 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.desc-cell {
    max-width: 420px;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.55;
}
.indicator-cell {
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}
.match-indicator {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    letter-spacing: 0.03em;
}

@media (max-width: 768px) {
    .correction-table { font-size: 0.8rem; }
    .desc-cell { max-width: 200px; }
    .correction-result-box { padding: 1rem; }
}

/* ── Step 5: 보조지표 카드 레이아웃 ── */
.indicator-section {
    margin-bottom: 1.5rem;
}
.indicator-section-header {
    margin-bottom: 1rem;
}
.indicator-section-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.badge-trend {
    background: #dbeafe;
    color: #1e40af;
}
.badge-confirm {
    background: #dcfce7;
    color: #166534;
}
.indicator-section-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.4rem 0 0.2rem;
}
.indicator-section-desc {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}
.indicator-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
}
.indicator-card {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.indicator-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.indicator-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.indicator-card-body h5 {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem;
}
.indicator-card-body p {
    font-size: 0.82rem;
    color: #475569;
    margin: 0 0 0.5rem;
    line-height: 1.45;
}
.indicator-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.indicator-tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag-up {
    background: #dcfce7;
    color: #166534;
}
.tag-down {
    background: #fee2e2;
    color: #991b1b;
}
.tag-warn {
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 768px) {
    .indicator-cards {
        grid-template-columns: 1fr;
    }
}

/* ── Step 4: 활용 방법 3-스텝 카드 ── */
.usage-steps-container {
    margin-bottom: 1.5rem;
}
.usage-steps-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.usage-steps-title i {
    color: #3b82f6;
    margin-right: 0.4rem;
}
.usage-steps {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.usage-step-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.usage-step-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 12px rgba(59,130,246,0.1);
}
.usage-step-num {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.usage-step-body h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem;
}
.usage-step-body p {
    font-size: 0.85rem;
    color: #475569;
    margin: 0;
    line-height: 1.5;
}
.usage-step-arrow {
    color: #cbd5e1;
    font-size: 0.9rem;
    padding: 0.15rem 0;
    text-align: center;
}

/* ── Step 4: 시나리오 카드 ── */
.chart-interpret-container {
    margin-bottom: 1.5rem;
}
.chart-interpret-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.chart-interpret-title i {
    color: #3b82f6;
    margin-right: 0.4rem;
}
.scenario-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}
.scenario-card {
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    transition: transform 0.2s;
}
.scenario-card:hover {
    transform: translateY(-2px);
}
.scenario-bullish {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.scenario-bearish {
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.scenario-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.7rem;
    font-size: 1.1rem;
}
.scenario-bullish .scenario-icon {
    background: #dcfce7;
    color: #16a34a;
}
.scenario-bearish .scenario-icon {
    background: #fee2e2;
    color: #dc2626;
}
.scenario-card h5 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: #1e293b;
}
.scenario-card p {
    font-size: 0.84rem;
    color: #475569;
    margin: 0 0 0.5rem;
    line-height: 1.5;
}
.scenario-action {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
}
.scenario-bullish .scenario-action {
    background: #dcfce7;
    color: #166534;
}
.scenario-bearish .scenario-action {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Step 4: 주의사항 배너 ── */
.fibo-warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
}
.warning-icon {
    flex-shrink: 0;
    color: #f59e0b;
    font-size: 1.3rem;
    margin-top: 0.1rem;
}
.warning-body {
    font-size: 0.88rem;
    color: #78350f;
    line-height: 1.55;
}
.warning-body strong {
    color: #92400e;
}

@media (max-width: 768px) {
    .scenario-cards {
        grid-template-columns: 1fr;
    }
}
