/* style.css - 마스터/속성 검색 시스템 스타일 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    color: #333;
}

/* 탭 컨테이너 */
.tab-container {
    background: white;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0;
}

.tab-btn {
    padding: 15px 30px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
    background: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 서브 탭 스타일 */
.sub-tab-container {
    background: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.sub-tab-btn {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.sub-tab-btn:hover {
    color: #667eea;
    border-color: #667eea;
    background: #f0f4ff;
}

.sub-tab-btn.active {
    color: white;
    background: #667eea;
    border-color: #667eea;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}

/* 로그인 페이지 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 24px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

/* 헤더 */
.header {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
    font-size: 22px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
}

.user-info strong {
    color: #667eea;
}

/* 메인 컨테이너 */
.main-container {
    padding: 20px;
    max-width: 100%;
    margin: 0;
}

/* 검색 패널 */
.search-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-panel h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 20px;
}

/* 폼 레이아웃 */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
}

.form-group {
    flex: 0.8;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* 버튼 그룹 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 버튼 스타일 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

.btn-separator {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    color: #bdc3c7;
    font-size: 1.2em;
    user-select: none;
}

.btn-logout {
    background: #e74c3c;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
}

.btn-logout:hover {
    background: #c0392b;
}

/* Help 버튼 (헤더 영역) */
.btn-help {
    background: none;
    border: 2px solid rgba(102, 126, 234, 0.6);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: #667eea;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-help:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}
/* 브랜드코드북 헤더용 (어두운 배경) */
.brand-header .btn-help {
    border-color: rgba(255, 255, 255, 0.6);
    color: white;
}
.brand-header .btn-help:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
}

/* 일괄수정 버튼 - 활성 상태 (Web_표준화업무 btn-warning 대응) */
.btn-bulk-active {
    background-color: #F59E0B;
    color: white;
}
.btn-bulk-active:hover:not(:disabled) {
    background-color: #D97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

/* 작은 버튼 스타일 (테이블 내 개별 저장 버튼용) */
.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    min-width: 50px;
}

/* 메시지 박스 */
.message-box {
    margin-top: 15px;
    padding: 12px;
    border-radius: 5px;
    font-size: 14px;
}

.message-box.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-box.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.message-box.loading {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
}

/* 결과 컨테이너 (좌우 2분할) */
.results-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

/* LID단위재수집 탭 전용 레이아웃 (속성정보 40% 축소) */
#attrRecollect .results-container {
    grid-template-columns: 1.9fr 0.6fr;
}

.result-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.panel-header h3 {
    color: #667eea;
    font-size: 18px;
}

.count-badge {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
}

/* 테이블 컨테이너 (스크롤) */
.table-container {
    max-height: 500px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* 테이블 스타일 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    position: sticky;
    top: 0;
    background: #667eea;
    color: white;
    z-index: 10;
}

.data-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

/* 카테코드 컬럼 */
.data-table th.col-narrow,
.data-table td.col-narrow {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
}

/* 카테고리명 컬럼 */
.data-table th.col-category-name,
.data-table td.col-category-name {
    text-align: left;
    width: 140px;
    min-width: 140px;
}

.data-table td.col-category-name input {
    width: 100%;
    direction: rtl;
    text-align: left;
}

/* 브랜드 컬럼 */
.data-table th.col-brand,
.data-table td.col-brand {
    width: 144px;
    min-width: 144px;
}

.data-table td.col-brand input {
    width: 100%;
}

/* P브랜드 컬럼 (브랜드의 50%) */
.data-table th.col-pbrand,
.data-table td.col-pbrand {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
}

.data-table td.col-pbrand input {
    width: 100%;
}

/* 보조명 컬럼 (확대) */
.data-table th.col-keyword,
.data-table td.col-keyword {
    width: 180px;
    min-width: 180px;
}

.data-table td.col-keyword input {
    width: 100%;
}

/* 모델번호 컬럼 (30% 축소: 220px -> 154px) */
.data-table th.col-model-no,
.data-table td.col-model-no {
    width: 154px;
    min-width: 154px;
}

.data-table td.col-model-no input {
    width: 100%;
}

/* 속성수정 탭 표준화 정보용 모델번호 컬럼 (40% 축소: 154px -> 92px) */
.data-table th.col-model-no-sm,
.data-table td.col-model-no-sm {
    width: 92px;
    min-width: 92px;
}

/* value_unit 컬럼 좁게 */
.data-table th.col-value-unit,
.data-table td.col-value-unit {
    width: 60px;
    max-width: 60px;
}

.data-table td.col-value-unit input {
    width: 100%;
}

/* attr_name 컬럼 */
.data-table th.col-attr-name,
.data-table td.col-attr-name {
    width: 144px;
    min-width: 144px;
}

/* value_name 컬럼 넓게 */
.data-table th.col-value-name,
.data-table td.col-value-name {
    width: 180px;
    min-width: 180px;
}

.data-table td.col-value-name input {
    width: 100%;
}

/* 상품명 컬럼 */
.data-table th.col-goods-name,
.data-table td.col-goods-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* category_code 불일치 시 붉은색 표시 */
.data-table td.col-category-code-mismatch {
    color: #e74c3c;
    font-weight: bold;
}

.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table tbody tr.selected {
    background-color: #e3f2fd !important;
}

.data-table input[type="text"],
.data-table input[type="number"] {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
}

.data-table input[type="text"]:focus,
.data-table input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.data-table input[type="radio"] {
    cursor: pointer;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px !important;
    font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
}

/* 스크롤바 스타일 */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 데이터발란스 전용 스타일 */
.results-container-full {
    grid-template-columns: 1fr;
}

.result-panel-full {
    width: 100%;
}

.table-container-large {
    max-height: 600px;
}

.form-group-wide {
    flex: 2;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #667eea;
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.modal-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-search input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.modal-search input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-table-container {
    max-height: 400px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.modal-table-container .data-table tbody tr {
    cursor: pointer;
}

.modal-table-container .data-table tbody tr:hover {
    background-color: #e3f2fd;
}

/* 검색 버튼이 있는 입력 필드 */
.input-with-btn {
    display: flex;
    gap: 5px;
    align-items: center;
}

.input-with-btn input {
    flex: 1;
}

.input-with-btn .btn-search-icon {
    padding: 5px 8px;
    font-size: 12px;
    background: transparent;
    color: #667eea;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.input-with-btn .btn-search-icon:hover {
    background: transparent;
    color: #5568d3;
}

/* 숨겨진 필드 */
.hidden-field {
    display: none;
}

/* 부분재수집 속성 요약 패널 */
.attr-summary-panel {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #d1ecf1;
    border-radius: 5px;
    background: #f8f9fa;
}

.attr-summary-panel > label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.attr-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    margin-bottom: 4px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
}

.attr-summary-item .category-name {
    font-weight: 600;
    color: #667eea;
    min-width: 80px;
}

.attr-summary-item .attr-names {
    flex: 1;
    margin-left: 8px;
    color: #333;
}

.attr-summary-item .attr-count {
    color: #888;
    margin-left: 8px;
    white-space: nowrap;
}

.attr-summary-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    margin-left: 8px;
    line-height: 1;
}

.attr-summary-remove:hover {
    color: #a71d2a;
}

.attr-summary-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e9ecef;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
