/* =====================
   태그 관리자 스타일
   ===================== */

/* 태그 관리 모달 */
#tag-manager-modal .modal {
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#tag-manager-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

#tag-manager-modal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

#tag-manager-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

#tag-manager-modal .modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 탭 네비게이션 */
.tag-manager-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.tag-manager-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tag-manager-tab:hover {
    color: #374151;
}

.tag-manager-tab.active {
    color: #4285f4;
    border-bottom-color: #4285f4;
    font-weight: 500;
}

/* 탭 패널 */
.tag-manager-panel {
    display: none;
}

.tag-manager-panel.active {
    display: block;
}

/* 태그 목록 */
.tag-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tag-list-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #374151;
}

.tag-list-actions {
    display: flex;
    gap: 8px;
}

.tag-list-actions button {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.tag-list-actions button:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.tag-list-actions button.primary {
    background: #4285f4;
    color: white;
    border-color: #4285f4;
}

.tag-list-actions button.primary:hover {
    background: #3367d6;
}

/* 태그 아이템 */
.tag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s;
}

.tag-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tag-item.system-tag {
    background: #f9fafb;
}

.tag-item-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.tag-item-info {
    flex: 1;
    min-width: 0;
}

.tag-item-name {
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-item-name .system-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: #e5e7eb;
    border-radius: 4px;
    color: #6b7280;
}

.tag-item-aliases {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
}

.tag-item-aliases code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

.tag-item-actions {
    display: flex;
    gap: 4px;
}

.tag-item-actions button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}

.tag-item-actions button:hover {
    background: #f3f4f6;
}

.tag-item-actions button.delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* 그룹별 태그 목록 */
.tag-group-section {
    margin-bottom: 24px;
}

.tag-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 12px;
}

.tag-group-icon {
    font-size: 1.25rem;
}

.tag-group-name {
    font-weight: 500;
    color: #374151;
}

.tag-group-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: #6b7280;
}

/* 태그 편집 폼 */
.tag-edit-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tag-edit-form label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.tag-edit-form input[type="text"],
.tag-edit-form textarea,
.tag-edit-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.tag-edit-form input[type="text"]:focus,
.tag-edit-form textarea:focus,
.tag-edit-form select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.tag-edit-form .form-row {
    display: flex;
    gap: 16px;
}

.tag-edit-form .form-row .form-field {
    flex: 1;
}

/* 색상 선택기 */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-picker-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-picker-option:hover {
    transform: scale(1.1);
}

.color-picker-option.selected {
    border-color: #374151;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #374151;
}

/* 아이콘 선택기 */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.icon-picker-option {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-picker-option:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.icon-picker-option.selected {
    border-color: #4285f4;
    background: #eff6ff;
}

/* 별칭 입력 */
.alias-input-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alias-input-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.alias-input-item input {
    flex: 1;
}

.alias-input-item button {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alias-input-item button:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.add-alias-btn {
    padding: 8px 16px;
    border: 1px dashed #d1d5db;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
    width: 100%;
}

.add-alias-btn:hover {
    border-color: #9ca3af;
    color: #374151;
}

/* 미등록 태그 섹션 */
.unknown-tags-section {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.unknown-tags-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #92400e;
    margin-bottom: 12px;
}

.unknown-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.unknown-tag-chip {
    padding: 6px 12px;
    background: white;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unknown-tag-chip button {
    width: 20px;
    height: 20px;
    border: none;
    background: #fef3c7;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #92400e;
}

.unknown-tag-chip button:hover {
    background: #fde68a;
}

/* 태그 통계 */
.tag-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tag-stat-card {
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tag-stat-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.tag-stat-info {
    flex: 1;
}

.tag-stat-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.tag-stat-count {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4285f4;
}

/* 태그 자동완성 */
.tag-autocomplete-container {
    position: relative;
}

.tag-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tag-autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.tag-autocomplete-item .tag-icon {
    font-size: 1.25rem;
}

.tag-autocomplete-item .tag-name {
    flex: 1;
    font-weight: 500;
}

.tag-autocomplete-item .tag-alias {
    font-size: 0.8rem;
    color: #6b7280;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 1rem;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    #tag-manager-modal .modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .color-picker-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .icon-picker-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .tag-edit-form .form-row {
        flex-direction: column;
        gap: 12px;
    }

    .tag-item {
        flex-wrap: wrap;
    }

    .tag-item-actions {
        margin-left: auto;
    }
}
