/* 한국 기업 재무제표 페이지 스타일 */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

/* Global body styles removed to prevent conflicts with base.css */

.page-header {
    margin-bottom: 2rem;
    margin-top: 2rem;
    text-align: center;
}

.main-page-content h1 {
    text-align: center;
    color: #003366;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 28px;
}

.model-description {
    text-align: center;
    color: #666;
    font-size: 14px;
    max-width: 700px;
    margin: 0 auto 30px;
}

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

.card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

/* 콘텐츠 섹션 스타일 */
.content-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

/* 폼 스타일 */
form {
    padding: 20px;
    margin-bottom: 0;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

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

.form-group {
    margin-bottom: 20px;
}

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

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

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

input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
    margin-bottom: 5px;
}

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

.form-actions {
    text-align: center;
    margin-top: 20px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #0069d9;
}

.download-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.download-btn:hover {
    background-color: #218838;
}

/* 결과 콘텐츠 */
.result-content {
    padding: 20px;
}

/* 테이블 스타일 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid #ddd;
}

thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #ddd;
    font-weight: 600;
    color: #333;
    background-color: #f8f9fa;
    white-space: nowrap;
}

td {
    padding: 10px 8px;
    border: 1px solid #ddd;
    text-align: center;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #f1f1f1;
    -webkit-overflow-scrolling: touch;
}

/* 기존 테이블 스타일과 구분됨 */

/* 재무제표 테이블 스타일 (comps.css 기반) */
.financial-statement {
    border-collapse: collapse;
    margin: 20px auto;
    width: 100%;
    font-size: 13px; /* 기본 글자 크기 증가 */
    table-layout: fixed;
    word-wrap: break-word;
}

.financial-statement th,
.financial-statement td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
    white-space: nowrap;
}

.financial-statement th {
    background-color: #003366;
    color: #ffffff !important; /* !important 추가하여 색상 강제 적용 */
    font-weight: bold;
    font-size: 14px; /* 헤더 글자 크기 증가 */
}

.financial-statement tr:nth-child(odd) td {
    background-color: #f9f9f9;
}

.financial-statement tr:nth-child(even) td {
    background-color: #ffffff;
}

/* 계정명은 왼쪽 정렬 */
.financial-statement td:first-child {
    text-align: left;
    padding-left: 15px;
    white-space: normal; /* 긴 계정명이 잘리지 않도록 */
}

/* 금액은 오른쪽 정렬 */
.financial-statement td:not(:first-child) {
    text-align: right;
    font-family: 'SF Pro Display', 'Segoe UI', 'Roboto', monospace;
    padding-right: 15px;
    font-size: 13px; /* 숫자 크기 증가 */
}

/* 카테고리 행 스타일 */
.financial-statement .category-header td {
    background-color: #e9ecef; /* 연한 회색 배경 */
    font-weight: bold;
    color: #003366; /* 진한 파란색 텍스트 */
    border-bottom: 2px solid #003366;
    border-top: 2px solid #003366;
}

.financial-statement th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #0d47a1 0%, #1976d2 50%, #0d47a1 100%);
}

.financial-statement .amount-header {
    text-align: center !important;
    font-weight: 600;
    color: #1a252f;
}

/* 재무제표 컴팩트 모드 */
.financial-statement.compact {
    font-size: 13px;
}

.financial-statement.compact td {
    padding: 8px 12px;
}

.financial-statement.compact .category-header {
    font-size: 14px;
}

.financial-statement.compact .account-name {
    font-size: 13px;
    padding-left: 25px !important;
}

.financial-statement.compact .amount {
    font-size: 13px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .financial-statement {
        font-size: 13px;
    }
    
    .financial-statement .category-header {
        font-size: 14px;
    }
    
    .financial-statement .account-name {
        padding-left: 20px !important;
        font-size: 13px;
    }
    
    .financial-statement .amount {
        font-size: 13px;
        padding-right: 15px !important;
    }
    
    .financial-statement td {
        padding: 10px 12px;
    }
}

/* 메인 탭 스타일 */
.main-tab-container {
    display: flex;
    border-bottom: 2px solid #e1e4e8;
    margin-bottom: 20px;
}

.main-tab-button {
    background-color: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-bottom: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-radius: 5px 5px 0 0;
    margin-right: 2px;
}

.main-tab-button:hover {
    background-color: #e9ecef;
    color: #333;
}

.main-tab-button.active {
    background-color: #fff;
    color: #003366;
    border-bottom: 2px solid #fff;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.main-tab-button i {
    margin-right: 8px;
}

/* 탭 스타일 */
.tab-container {
  overflow: hidden;
  margin-bottom: 20px;
}

.tab-container button {
  background-color: #f1f1f1;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 16px;
  transition: 0.3s;
  font-size: 14px;
  border-radius: 5px 5px 0 0;
  margin-right: 5px;
  color: #333;
}

.tab-container button:hover {
  background-color: #ddd;
}

.tab-container button.active {
  background-color: #003366;
  color: white;
  font-weight: 600;
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid #ccc;
}

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

/* 로딩 스타일 */
#loading {
    padding: 2rem 0;
    text-align: center;
}

#loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* results 요소는 JavaScript에서 제어 */
#results.show {
    display: block !important;
}

/* 탭 컨테이너 강제 표시 */
.tab-container {
    display: block !important;
}

#tables-tab-content {
    display: block !important;
}

#tables-preview {
    display: block !important;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
    }
    
    .card-header form {
        margin-top: 1rem;
    }
}

/* 테이블 반응형 스타일 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 버튼 스타일 */
.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* 알림 메시지 스타일 */
.alert {
    border-radius: 0.25rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* 테이블 정보 스타일 */
.table-info {
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
}

/* 메인 컨텐츠 여백 조정 */
.main-content {
    margin-bottom: 3rem;
}

/* 분석 탭 스타일 */
.analysis-container {
    padding: 20px;
}

.analysis-card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 100%;
}

.analysis-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e4e8;
}

.analysis-card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.analysis-card-header p {
    margin: 5px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.analysis-card-body {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

/* 분석 차트 그리드 레이아웃 */
.analysis-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 차트 컴테이너 스타일 - 균등한 크기 */
.chart-container {
    position: relative;
    width: 100%;
    height: 350px; /* 모든 차트 동일한 높이 */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    box-sizing: border-box;
}

/* 차트 캔버스 스타일 */
.chart-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* 반응형 차트 */
@media (max-width: 768px) {
    .analysis-charts {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 250px;
        padding: 10px;
    }
}

/* 탭 스타일 개선 */
.nav-tabs {
    border-bottom: 2px solid #e1e4e8;
    margin-bottom: 0;
}

.nav-tabs .nav-link {
    border: none;
    color: #666;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 0;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    background-color: #f8f9fa;
}

.nav-tabs .nav-link.active {
    color: #667eea;
    background-color: transparent;
    border-bottom: 3px solid #667eea;
    font-weight: 600;
}

.tab-content {
    background: #fff;
    border-radius: 0 0 8px 8px;
}

/* 차트 반응형 스타일 */
@media (max-width: 768px) {
    .analysis-card-body {
        padding: 15px;
        min-height: 250px;
    }
    
    .analysis-container {
        padding: 15px;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 15px;
        font-size: 14px;
    }
}
