/* 공통 스타일 - juDart */

/* 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Malgun Gothic', sans-serif;
    background: #f5f5f5;
}

/* 컨테이너 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

/* 검색/설정 박스 */
.search-box,
.compare-settings {
    background: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.search-row,
.settings-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 0;
}

.search-row:last-child,
.settings-row:last-child {
    margin-bottom: 0;
}

.search-box label,
.compare-settings label {
    font-weight: bold;
    color: #555;
    font-size: 12px;
    min-width: auto;
    white-space: nowrap;
}

.search-box select,
.compare-settings select,
.search-box input[type="text"],
.compare-settings input[type="text"] {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    min-width: 90px;
}

.search-box select:disabled,
.compare-settings select:disabled {
    background: #f5f5f5;
    color: #999;
}

.search-box button,
.compare-settings button {
    padding: 6px 12px;
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.search-box button:hover,
.compare-settings button:hover {
    background: #1976D2;
}

.search-box button:disabled,
.compare-settings button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-add {
    background: #4CAF50 !important;
}

.btn-add:hover {
    background: #388E3C !important;
}

/* 회사 검색 자동완성 */
.company-search-wrapper {
    position: relative;
    display: inline-block;
}

.company-input-container {
    position: relative;
    width: 180px;
}

.company-input-container input#companyKeyword {
    padding: 6px 28px 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}

.company-input-container input#companyKeyword::placeholder {
    font-size: 11px;
    color: #999;
}

.company-input-container input#companyKeyword:focus {
    outline: none;
    border-color: #2196F3;
}

.clear-input-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
}

.clear-input-btn.show {
    display: block;
}

.clear-input-btn:hover {
    color: #666;
}

/* 자동완성 드롭다운 */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #e3f2fd;
}

.autocomplete-item .company-name {
    font-weight: 500;
    font-size: 12px;
}

.autocomplete-item .stock-code {
    font-size: 11px;
    color: #666;
}

.autocomplete-item .industry-info {
    font-size: 10px;
    color: #999;
}

.autocomplete-count {
    padding: 5px 10px;
    background: #f5f5f5;
    font-size: 11px;
    color: #666;
    border-bottom: 1px solid #ddd;
}

/* 회사 태그 */
.company-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.company-tag .remove {
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.company-tag .remove:hover {
    background: rgba(255,255,255,0.3);
}

.selected-companies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 30px;
    align-items: center;
}

/* 로딩 / 데이터없음 */
.loading {
    text-align: center;
    padding: 50px;
    display: none;
}

.loading.active {
    display: block;
}

.no-data {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* 테이블 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 13px;
}

th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f5f5f5;
    font-weight: bold;
    color: #333;
}

td {
    color: #666;
}

.amount {
    text-align: right;
    font-family: 'Consolas', monospace;
}

/* 섹션 박스 */
.comparison-section,
.statement-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 15px;
}

.comparison-section h2,
.statement-section h3 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-size: 16px;
}

/* 차트 */
.chart-container {
    position: relative;
    height: 350px;
    margin-bottom: 20px;
}

.chart-box {
    position: relative;
    height: 350px;
    margin-bottom: 20px;
}

/* 태블릿 반응형 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .search-row,
    .settings-row {
        flex-wrap: wrap;
    }

    .search-box select,
    .compare-settings select {
        min-width: 80px;
    }

    .company-input-container {
        width: 150px;
    }

    .chart-container,
    .chart-box {
        height: 300px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 6px;
    }
}

/* 모바일 반응형 */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .search-box,
    .compare-settings {
        padding: 10px;
    }

    .search-row,
    .settings-row {
        gap: 8px;
    }

    .search-box label,
    .compare-settings label {
        font-size: 11px;
    }

    .search-box select,
    .compare-settings select,
    .search-box input[type="text"],
    .compare-settings input[type="text"] {
        padding: 5px 6px;
        font-size: 11px;
        min-width: 70px;
    }

    .search-box button,
    .compare-settings button {
        padding: 5px 10px;
        font-size: 11px;
    }

    .company-input-container {
        width: 100%;
        max-width: 140px;
    }

    .company-input-container input#companyKeyword {
        font-size: 11px;
        padding: 5px 25px 5px 8px;
    }

    .company-tag {
        padding: 4px 8px;
        font-size: 11px;
    }

    .autocomplete-dropdown {
        max-height: 200px;
    }

    .comparison-section,
    .statement-section {
        padding: 12px;
    }

    .comparison-section h2,
    .statement-section h3 {
        font-size: 14px;
    }

    .chart-container,
    .chart-box {
        height: 250px;
    }

    table {
        font-size: 11px;
    }

    th, td {
        padding: 6px 4px;
    }
}
