/* Working Capital Analysis Styles */

/* 입력 카드 스타일 */
.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;
}

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

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

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

/* 섹션 타이틀 */
.section-title {
    font-weight: 600;
    color: #003366;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    align-items: center;
}

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

/* 폼 스타일 */
form {
    padding: 20px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 폼 레이아웃 */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px 15px;
    width: 100%;
    box-sizing: border-box;
}

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

.form-group.full-width {
    flex: 1 1 100%;
}

/* 레이블 스타일 */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
}

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

/* 입력 필드 스타일 */
input[type="text"], 
input[type="number"],
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[type="text"]:focus, 
input[type="number"]:focus,
select:focus {
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15);
    outline: none;
}

/* 입력 필드 아이콘 */
.input-with-icon {
    position: relative;
}

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

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

.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;
}

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

/* 티커 검색 링크 */
.ticker-lookup {
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.ticker-lookup a {
    color: #007bff;
    text-decoration: none;
}

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

/* Helper text */
.helper-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* Submit button */
.submit-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 20px;
    display: block;
    width: 100%;
}

.submit-btn:hover {
    background-color: #0056b3;
}

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

.components-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.component-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.component-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.component-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.component-header i {
    font-size: 1.5rem;
    color: #007bff;
}

.component-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.component-value {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
    margin: 1rem 0;
    text-align: center;
}

.component-explanation {
    color: #6c757d;
    line-height: 1.6;
}

.component-explanation ul {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
}

.component-explanation li {
    margin: 0.5rem 0;
}

.calculation-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calculation-card .card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.calculation-card .card-header h5 {
    margin: 0;
    font-size: 1.3rem;
    color: #2c3e50;
}

.formula-box {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #007bff;
}

.formula-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.formula-explanation {
    margin-top: 0.75rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.calculation-breakdown {
    margin: 1.5rem 0;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.breakdown-item.total {
    background: #e3f2fd;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    border: none;
}

.breakdown-item .label {
    color: #495057;
}

.breakdown-item .value {
    color: #007bff;
    font-weight: 600;
}

.explanation-text {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    color: #495057;
    line-height: 1.6;
}

.explanation-text ul {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
}

.explanation-text li {
    margin: 0.5rem 0;
}

.ccc-flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flow-step.final {
    background: #d4edda;
    border: 2px solid #28a745;
}

.flow-icon {
    font-size: 2rem;
    color: #007bff;
}

.flow-step.final .flow-icon {
    color: #28a745;
}

.flow-label {
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    font-size: 0.9rem;
}

.flow-desc {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
}

.flow-arrow {
    font-size: 1.5rem;
    color: #007bff;
    font-weight: 700;
}

.efficiency-analysis {
    margin: 2rem 0;
}

.efficiency-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.efficiency-card h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.efficiency-metrics {
    margin-top: 1rem;
}

.metric-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.metric-item.industry-comparison {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    background: #e7f3ff;
    border-left: 4px solid #3b82f6;
}

.metric-label {
    font-weight: 600;
    color: #495057;
}

.metric-item.industry-comparison .metric-label {
    color: #1f2937;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comparison-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.industry-avg {
    font-weight: 600;
    color: #3b82f6;
    font-size: 0.95rem;
}

.comparison-text {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comparison-text .text-success {
    color: #10b981;
}

.comparison-text .text-warning {
    color: #f59e0b;
}

.comparison-text .text-info {
    color: #3b82f6;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-value.good {
    color: #28a745;
}

.metric-value.moderate {
    color: #ffc107;
}

.metric-value.poor {
    color: #dc3545;
}

.metric-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.improvement-suggestions {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.improvement-suggestions h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.suggestion-item {
    padding: 1rem;
    margin: 0.75rem 0;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.suggestion-item.good {
    background: #d4edda;
    border-left-color: #28a745;
}

.suggestion-item i {
    color: #ffc107;
    margin-top: 0.25rem;
}

.suggestion-item.good i {
    color: #28a745;
}

.chart-section {
    margin: 2rem 0;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
}

.chart-section h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

#components-chart,
#trend-chart {
    height: 400px;
    margin-top: 1rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
    overflow: hidden;
}

/* Plotly 차트 컨테이너가 width를 꽉 채우도록 */
#components-chart .js-plotly-plot,
#trend-chart .js-plotly-plot {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

#components-chart .plotly,
#trend-chart .plotly {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

#components-chart svg,
#trend-chart svg {
    width: 100% !important;
    max-width: 100% !important;
}

/* step 내부의 차트 섹션이 전체 width를 사용하도록 */
.step .chart-section {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Step navigation styles */
.step {
    display: none;
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-x: hidden;
    animation: fadeIn 0.5s;
}

.step.active {
    display: block;
}

/* 1단계 전용 스타일 - 깔끔한 흰색 디자인 */
#step-1 {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#step-1 h3 {
    color: #1f2937;
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
}

#step-1 .step-description {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
    padding: 18px 20px;
    margin: 20px 0 30px 0;
    border-radius: 8px;
    font-size: 1rem;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#step-1 .explanation-panel {
    margin: 30px 0;
    padding: 0;
    background: transparent;
}

#step-1 .explanation-panel .alert {
    margin-bottom: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#step-1 .explanation-panel .alert-info {
    background: #ffffff;
    border-left: 4px solid #3b82f6;
}

#step-1 .explanation-panel .alert-heading {
    color: #1f2937;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

#step-1 .explanation-panel .alert-heading i {
    color: #3b82f6;
    font-size: 1.4rem;
}

#step-1 .explanation-panel .alert p {
    color: #4b5563;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 0;
}

#step-1 .formula-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-radius: 10px;
    margin: 25px 0;
    border-left: 4px solid #3b82f6;
}

#step-1 .formula-title {
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#step-1 .formula {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
}

#step-1 .explanation-details {
    margin-top: 25px;
}

#step-1 .detail-item {
    margin: 20px 0;
    padding: 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    border-left: 4px solid #10b981;
    transition: all 0.2s ease;
}

#step-1 .detail-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

#step-1 .detail-item strong {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1f2937;
    margin-bottom: 12px;
    font-size: 1rem;
}

#step-1 .detail-item strong i {
    color: #10b981;
    font-size: 1.1rem;
}

#step-1 .detail-item p {
    margin: 0;
    color: #4b5563;
    line-height: 1.7;
    font-size: 0.95rem;
}

#step-1 .input-summary-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#step-1 .summary-section .section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f6;
}

#step-1 .summary-item {
    padding: 18px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
}

#step-1 .summary-item strong {
    color: #1f2937;
    font-size: 0.95rem;
}

#step-1 .summary-item .value {
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

#step-1 .summary-item .explanation {
    color: #6b7280;
    font-size: 0.85rem;
}

.step h3 {
    color: #003366;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
}

.step-description {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    color: #495057;
}

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

.next-step,
.show-all {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 10px 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.next-step:hover,
.show-all:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.next-step:active,
.show-all:active {
    background-color: #004085;
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.next-step i,
.show-all i {
    margin-left: 8px;
}

.step > .next-step,
.step > .show-all {
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.show-all {
    background-color: #6c757d;
}

.show-all:hover {
    background-color: #5a6268;
}

/* Input summary card styles */
.input-summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.summary-section {
    margin-bottom: 1.5rem;
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-section .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.summary-item strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.summary-item .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #007bff;
    margin: 0.5rem 0;
}

.summary-item .explanation {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
}

.industry-info {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    color: #0d47a1;
    font-size: 0.95rem;
}

.explanation-panel {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.explanation-panel .alert {
    margin-bottom: 0;
}

.explanation-details {
    margin-top: 1rem;
}

.detail-item {
    margin: 1rem 0;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
}

.detail-item strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.detail-item p {
    margin: 0.5rem 0 0 0;
    color: #495057;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .input-card {
        margin-top: -80px !important;
        position: relative;
        z-index: 10;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        padding: 0;
        min-width: 100%;
    }
    
    .components-breakdown {
        grid-template-columns: 1fr;
    }
    
    .ccc-flow-diagram {
        flex-direction: column;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }
    
    .metric-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .next-step,
    .show-all {
        margin: 15px auto;
        display: block;
        width: fit-content;
        scroll-margin-top: 80px;
    }
    
    .step {
        scroll-margin-top: 80px;
        padding-bottom: 20px;
    }
    
    .step:target {
        scroll-margin-top: 80px;
    }
    
    .summary-row {
        grid-template-columns: 1fr;
    }
    
    .submit-btn {
        width: 100%;
    }
}

/* Loading Spinner */
#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);
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: #003366;
    margin: 0 auto 15px;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
    display: inline-block;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

#loading p {
    margin: 0;
    color: #003366;
    font-size: 16px;
    font-weight: 500;
}

